Tried some more ...
9. Install postgrey
postgrey is available in the EPEL repository.
sudo yum epel-release
sudo yum install postgrey
sudo nano /etc/sysconfig/postgrey
add (default delay is 60):
POSTGREY_OPTS="--inet=127.0.0.1:10023 --delay=55"
After Postfix configuration, start and enable the service:
systemctl start postgrey
systemctl enable postgrey
10. Install spamassassin
Having a little trouble locating the packages, not entirely sure if the list is correct. I couldn't find perl-Geo-IPfree and perl-Net-Ident, RPMforge doesn't have them for CentOS 7. Does anyone know a reputable repository that carries them for CentOS 7?
// (CentOS 6) Install RPMforge repo to fetch some Perl modules
// 32-bit
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
// 64-bit
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rm -rf rpmforge*.rpm
sudo yum install perl-Net-DNS pyzor perl-Razor-Agent perl-Digest-SHA perl-Encode-Detect perl-DBI perl-Geo-IPfree perl-Net-Ident
sudo yum install spamassassin
There is no /etc/default/spamassassin, so I just started it up like other services:
systemctl start spamassassin
systemctl enable spamassassin
Minor note when updating the rules, there wasn't a /etc/spamassassin directory, I just download the GPG key somewhere and import. Before "sa-update -D -v", download and import the GPG key from Apache servers (or it returns "error: GPG validation failed! The update downloaded successfully, but it was not signed with a trusted GPG ...")
wget http://spamassassin.apache.org/updates/GPG.KEY
sa-update --import GPG.KEY
sa-update -D -v
Additional note -- if running into the error below during install and can't find the kernel-headers in the main repo:
Error: Package: glibc-headers-2.17-106.el7_2.1.x86_64 (updates)
Requires: kernel-headers
Error: Package: glibc-headers-2.17-106.el7_2.1.x86_64 (updates)
Requires: kernel-headers >= 2.2.1
This is
due to kernel packages being excluded in /etc/yum.conf on some systems. Run the following command to grab the headers:
sudo yum --disableexcludes=main install kernel-headers
11. Install fail2ban
fail2ban is available in the EPEL repository.
sudo yum install epel-release
sudo yum install fail2ban
/etc/fail2ban/jail.conf recommends having a separate config file instead (/etc/fail2ban/jail.local or placed in /etc/fail2ban/jail.d) instead of editing jail.conf directly. Followed the config from there. The only thing was I couldn't find [sasl], but [postfix-sasl] (and there's no corresponding filter named sasl.conf in /etc/fail2ban/filter.d):
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.local
[postfix-sasl]
enabled = true
port = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter = postfix-sasl
# You might consider monitoring /var/log/mail.warn instead if you are
# running postfix since it would provide the same log lines at the
# "warn" level but overall at the smaller filesize.
logpath = /var/log/mail.log
Check that the log files exist or fail2ban won't start. Create them if needed:
touch /var/log/mail.log /var/log/secure
Start it up:
systemctl start fail2ban
systemctl enable fail2ban
Additional note -- as when installing spamassassin, if the ipset package requires the kernel package not yet installed, do:
sudo yum --disableexcludes=main install kernel
12. Own SSL configuration
Sorry, I don't have certificates on hand to test it. There's no /etc/dovecot/conf.d/01-mail-stack-delivery.conf file on CentOS 7. Dovecot certificate paths are /etc/pki/dovecot/certs/dovecot.pem and /etc/pki/dovecot/private/dovecot.pem (self-signed certs are stored in /etc/pki/tls/certs), so I'm not sure where the 3rd step goes, if there's a 3rd step. The old (and possibly outdated)
howto on the CentOS wiki adds it to /etc/dovecot/dovecot.conf:
ssl_cert_file = /etc/pki/tls/certs/mail.domain.com.cert
ssl_key_file = /etc/pki/tls/private/mail.domain.com.key
14. DKIM
Forgot to mention in my previous post -- there is no /etc/mail directory by default, but I suppose it could be created, as long as the KeyFile path in the config file is correct (I generated the key in /etc/opendkim/keys and linked to it there).