Setting up a new user for Dovecot and Postfix with SQLite
If you are using dovecot and postfix with a SQLite backend you can easily add a new user account with just a few steps. If you are using a different database such as MySQL, the following steps should be easily transferrable. We are assuming this is a new user account for an already configured and existing domain name on your mail server.
First we’ll need to generate a new password using SHA512-CRYPT encryption using the doveadm utility.
Setting up DKIM for a domain with OpenDKIM and DNS
One of the critical components of hosting a mail server and ensuring that your emails get delivered to inboxes is DKIM. DomainKeys Identified Mail is an email authentication protocol that allows receiving mail servers to verify that the email message truly came from the domain that it claims to have arrived from.
DKIM uses public-key cryptography to enable senders to sign emails, and together with DNS, recipients can verify the signatures.
Blocking a list of IP addresses with iptables
In case you need to quickly ban a list of IP addresses from connecting to your server, iptables is perfect for the job.
iptables is a user-space firewall that can control incoming and outgoing connections with policies and filter rules.
Blocking ingress from a single IP is easily done with a single iptables rule. We can use this same command to automate the creation of many rules with a bash script that will read our list of IP addresses from a file.