email:install_a_full_mail_server_-_more
Differences
This shows you the differences between two versions of the page.
email:install_a_full_mail_server_-_more [2016/11/14 15:59] โ created peter | email:install_a_full_mail_server_-_more [2019/11/27 21:56] (current) โ removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | TODO | ||
- | https:// | ||
- | |||
- | |||
- | This is Google' | ||
- | The current page could have changed in the meantime. Learn more | ||
- | Full versionText-only versionView sourceTip: To quickly find your search term on this page, press Ctrl+F or โ-F (Mac) and use the find bar. | ||
- | Projects/ | ||
- | |||
- | From Bitlair | ||
- | < Projects | ||
- | Jump to: | ||
- | |||
- | Email-icon-vector.jpg | ||
- | Project Mailserver with Debian, Exim, spamassassin, | ||
- | Name Mailserver with Debian, Exim, spamassassin, | ||
- | Start 2015/ | ||
- | End | ||
- | Contact WilcoBaanHofman | ||
- | Website | ||
- | Information This page describes how we set up our mail system and how other people can set up their own full blown modern mail servers. | ||
- | Status Production | ||
- | This page will talk about how to set up a mail server, and also how to comply with Google mail / gmail' | ||
- | |||
- | You will need an SPF policy, DKIM and a valid forward/ | ||
- | |||
- | Contents | ||
- | |||
- | 1 TODO | ||
- | 2 Prerequisites | ||
- | 3 Determine your setup | ||
- | 3.1 Single mailserver | ||
- | 3.2 MTA + Encrypted mail store | ||
- | 3.3 High-availability | ||
- | 4 Install the packages | ||
- | 5 Configuring exim4 | ||
- | 5.1 Testing Exim4 | ||
- | 6 TLS | ||
- | 7 Testing STARTTLS | ||
- | 7.1 Testing TLS | ||
- | 8 SASL Authenticated relay | ||
- | 8.1 Enabling other ports than 25 | ||
- | 8.2 SASL authentication | ||
- | 8.3 Testing | ||
- | 8.4 DNS block lists | ||
- | 8.5 More information exim4 configuration | ||
- | 9 Spamassassin | ||
- | 9.1 Spamassassin configuration | ||
- | 9.2 Exim spamd integration | ||
- | 9.3 Testing spam blocking | ||
- | 9.4 More information on spamassassin | ||
- | 10 Antivirus | ||
- | 10.1 Setting up ClamAV | ||
- | 10.2 Exim clamd integration | ||
- | 10.3 Testing | ||
- | 10.4 More information on ClamAV | ||
- | 11 Setting up DKIM | ||
- | 11.1 Configuring exim for DKIM | ||
- | 11.2 Configuring DNS for DKIM | ||
- | 11.3 Testing | ||
- | 11.4 More information on DKIM | ||
- | 12 SPF | ||
- | 12.1 Adding SPF to your domain | ||
- | 12.2 Adding Sending Rewriting Scheme (SRS) | ||
- | 12.2.1 Installing srsd | ||
- | 12.2.2 Implement srsd integration into exim4 | ||
- | 12.2.3 Testing the SRS forwarding | ||
- | 12.3 Enable SPF checking | ||
- | 12.4 Testing SPF checking | ||
- | 12.5 More information on SPF and SRS | ||
- | 13 Greylisting | ||
- | 13.1 Set up exim | ||
- | 13.2 Testing | ||
- | 13.3 More information on Greylisting | ||
- | 14 DMARC | ||
- | 14.1 Set up a mailbox | ||
- | 14.2 Publish a DMARC policy | ||
- | 14.3 Doing something useful with the reports | ||
- | 14.4 More information on DMARC | ||
- | 15 LDAP integration | ||
- | 15.1 Schema | ||
- | 15.2 Exim LDAP integration | ||
- | 15.3 Testing Exim LDAP integration | ||
- | 15.4 Saslauthd LDAP integration | ||
- | 15.5 Testing saslauthd LDAP integration | ||
- | 15.6 More information on LDAP integration | ||
- | 16 LMTP delivery | ||
- | 16.1 Local delivery | ||
- | 16.2 For remote delivery with 3 week hold function via LMTP | ||
- | 16.3 Testing LMTP delivery | ||
- | 16.4 More information on LMTP | ||
- | 17 Mailman | ||
- | 17.1 Getting a certificate | ||
- | 17.2 Setting up Mailman | ||
- | 17.3 Configuring Exim for mailman | ||
- | 17.4 Configuring apache for mailman | ||
- | 17.5 Setting up mailing lists | ||
- | 17.6 Testing Mailman | ||
- | 17.7 More information about mailman | ||
- | 18 Dovecot | ||
- | 18.1 Getting a certificate | ||
- | 18.2 Setting up dovecot | ||
- | 18.3 Integrating LDAP into dovecot | ||
- | 18.4 Testing | ||
- | 18.5 ACL and Shared mailboxs (allowing delegated mailboxes) | ||
- | 19 Hardening | ||
- | 19.1 Exim4 rate limiting | ||
- | 19.2 Testing the banner delay | ||
- | 19.3 Rate limiting hosts with iptables | ||
- | 19.4 More information on hardening | ||
- | 20 Troubleshooting | ||
- | 20.1 Forgetting to add the clamav user to the exim group | ||
- | 20.2 Not using wheezy-updates or jessie-updates repository | ||
- | 20.3 Forgetting to add the exim to sasl group | ||
- | 20.4 auth-ldap and dovecot-ldap.conf files missing | ||
- | 20.5 Forgetting to install dovecot-lmtpd | ||
- | 20.6 Spamassassin hits rule URIBL_BLOCKED on every mail message | ||
- | 20.7 You keep getting 550 relay not permitted for local email addresses | ||
- | 20.8 Unable to verify the first certificate | ||
- | 20.9 TLS not available and Error while reading file message in exim4.log | ||
- | 20.10 Keep getting 421 Unexpected failure after RCPT TO | ||
- | 20.11 DKIM signatures are not added | ||
- | TODO | ||
- | |||
- | Running an external (partial) LDAP slave | ||
- | Prerequisites | ||
- | |||
- | A (virtual) machine running Debian wheezy or jessie with public IPv4 and IPv6 internet connectivity | ||
- | Possibility to set up reverse DNS for your IPv4 and IPv6 addresses | ||
- | Ability to have a CA sign your certificates (can be done for free at StartSSL). | ||
- | Determine your setup | ||
- | |||
- | What kind of setup are you going to run? | ||
- | |||
- | Single mailserver | ||
- | MTA + Encrypted mail store | ||
- | High-availability setup | ||
- | Single mailserver | ||
- | |||
- | In this case, install all packages on the same machine, do not use disk encryption, because your mail server will be unreachable after a power failure. | ||
- | |||
- | MTA + Encrypted mail store | ||
- | |||
- | This is the best scenario for small setups and requires two (virtual) machines, one MTA that handles accepting of emails and spam/virus filtering and one machine that is encrypted. This guide covers this setup. To prepare for this setup, simple install one machine without disk crypto and one with. The MTA will hold mail for up to 3 weeks if you haven' | ||
- | |||
- | The setup will look like this: | ||
- | |||
- | Encrypted-mailstore.png | ||
- | |||
- | High-availability | ||
- | |||
- | Running MTAs in high availability is easy, just duplicate the MTA setup and add two MX records to your domains. (Of course, your bayesian spam filters may train differently..). Running dovecot in high-availability is a different story.. | ||
- | |||
- | The safest way to run dovecot in high-availibility mode is to run the mail store on top of a high-performance redundant NAS. This can be a proprietary NAS or some open source HA NFS setup. You will need shared NFS storage. The best performing mailbox format is mdbox, but this is also the easiest store to corrupt the indexes of if two nodes write to it in parallel. Locking may cause performance degradation and has to work reliably on your NFS backend, otherwise the indexes get corrupted. To prevent index corruption and locking overhead, there is the director component, which will pin a user to a node as long as that node is up. The dovecot part of this setup is *not* included in this guide (yet). | ||
- | |||
- | This setup will look like this: | ||
- | |||
- | Mailserver-HA.png | ||
- | |||
- | Install the packages | ||
- | |||
- | Step 1: Install the required packages | ||
- | |||
- | ~# apt-get install exim4-daemon-heavy spamassassin clamav-daemon greylistd spf-tools-perl sasl2-bin srs pyzor razor | ||
- | If you want to run a mailing list server as well, also install mailman and apache2. | ||
- | |||
- | ~# apt-get install mailman apache2 | ||
- | If dovecot is going to run on this same host (you' | ||
- | |||
- | ~# apt-get install dovecot-imapd dovecot-ldap dovecot-lmtpd dovecot-sieve dovecot-managesieved | ||
- | |||
- | Verify that no interfering packages are installed (like postfix, sendmail, amavis) | ||
- | |||
- | ~$ dpkg -l |egrep ' | ||
- | This command should give no output, if it does and starts with ii, remove that package. | ||
- | |||
- | Configuring exim4 | ||
- | |||
- | ~# dpkg-reconfigure exim4-config | ||
- | Choose internet site, set the host name to the value you will set the reverse DNS to, specify all domains you want to receive mail for and choose split files (unless you want to replace every exim4 file name here with exim4.conf.template in this manual). | ||
- | |||
- | Testing Exim4 | ||
- | |||
- | Now try to see if simple address resolution works. This will only test against local system users. It's good to test this, even if you're going to add LDAP later. Substitute the IP and mail addresses for your own stuff. For now, you can test any local system user @ one of the domains you accepted. | ||
- | |||
- | Any line not starting with a number is something you have to type yourself to test this. | ||
- | |||
- | ~$ telnet 2a02: | ||
- | Trying 2a02: | ||
- | Connected to 2a02: | ||
- | Escape character is ' | ||
- | 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 15 Mar 2015 12:37:27 -0400 | ||
- | EHLO mail.bitlair.nl | ||
- | 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | 250-SIZE 52428800 | ||
- | 250-8BITMIME | ||
- | 250-PIPELINING | ||
- | 250-STARTTLS | ||
- | 250 HELP | ||
- | MAIL FROM: < | ||
- | 250 OK | ||
- | RCPT TO: < | ||
- | 250 Accepted | ||
- | RCPT TO: < | ||
- | 550 Unrouteable address | ||
- | QUIT | ||
- | TLS | ||
- | |||
- | Hint: StartCom signs certificates for free. Class 2 certification allows you do much more, though. In order to qualify for level 2 verification, | ||
- | |||
- | To generate the key and certificate signing request (replace mail.bitlair.nl with your Fully Qualified Domain Name): | ||
- | |||
- | ~# openssl req -sha256 -days 3650 -nodes -new -newkey rsa:4096 -keyout / | ||
- | Input your location and contact information. At the Common Name field, input your mail hostname (mail.bitlair.nl in my case). Do not enter a challenge password. | ||
- | |||
- | Copy the certificate signing request to a CA for signing. Allow the CA to sign it, then you'll receive a certificate from the CA. Place the received certificate in / | ||
- | |||
- | Put MAIN_TLS_ENABLE=yes near the top in / | ||
- | |||
- | MAIN_TLS_CERTIFICATE = / | ||
- | MAIN_TLS_PRIVATEKEY = / | ||
- | Create the ssl-cert group, allow this group to read in / | ||
- | |||
- | ~# groupadd --system ssl-cert | ||
- | ~# chgrp ssl-cert / | ||
- | ~# chmod 750 / | ||
- | ~# usermod -a -G ssl-cert Debian-exim | ||
- | Download your chain file from your CA. If you have a startcom class 1 certificate, | ||
- | |||
- | Now append its content to / | ||
- | |||
- | ~# cat / | ||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing STARTTLS | ||
- | |||
- | ~$ telnet 2a02: | ||
- | Trying 2a02: | ||
- | Connected to 2a02: | ||
- | Escape character is ' | ||
- | 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 15 Mar 2015 12:37:10 -0400 | ||
- | EHLO mail.bitlair.nl | ||
- | 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | 250-SIZE 52428800 | ||
- | 250-8BITMIME | ||
- | 250-PIPELINING | ||
- | 250-STARTTLS | ||
- | 250 HELP | ||
- | STARTTLS | ||
- | 220 TLS go ahead | ||
- | STARTTLS should be listed and give a 220 status code. | ||
- | |||
- | Testing TLS | ||
- | |||
- | Unfortunately, | ||
- | |||
- | ~$ openssl s_client -connect mail.bitlair.nl: | ||
- | |||
- | New, TLSv1/ | ||
- | Server public key is 1024 bit | ||
- | Secure Renegotiation IS supported | ||
- | Compression: | ||
- | Expansion: NONE | ||
- | SSL-Session: | ||
- | Protocol | ||
- | Cipher | ||
- | Session-ID: 82CBCEC7833853A674F6399694A03052566C494E1F6DDC8DE2CD4B3A9F8ED528 | ||
- | Session-ID-ctx: | ||
- | Master-Key: BAE67F5D50E5C1C95FBDF355C1BDE18C6251E13F5B8686977292A54657498EFECFF518290211F24F01C40E39929981C4 | ||
- | Key-Arg | ||
- | PSK identity: None | ||
- | PSK identity hint: None | ||
- | SRP username: None | ||
- | Start Time: 1426438799 | ||
- | Timeout | ||
- | Verify return code: 0 (ok) | ||
- | This should give Verify return code 0 at all times. Anything else is wrong.. see the troubleshooting section. | ||
- | |||
- | SASL Authenticated relay | ||
- | |||
- | To enable relaying of messages after authentication, | ||
- | |||
- | Enabling other ports than 25 | ||
- | |||
- | Port 25 is usually blocked by firewalls, for good reason. An alternative authenticated-only submission port exists on port 587 and a legacy TLS on connect port on 465 also exists. | ||
- | |||
- | To enable these, set the following in / | ||
- | |||
- | SMTPLISTENEROPTIONS=' | ||
- | And in / | ||
- | |||
- | tls_on_connect_ports=465 | ||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | SASL authentication | ||
- | |||
- | Set the following to / | ||
- | |||
- | START=yes | ||
- | Start saslauthd. | ||
- | |||
- | ~# service saslauthd start | ||
- | In / | ||
- | |||
- | plain_saslauthd_server: | ||
- | driver = plaintext | ||
- | public_name = PLAIN | ||
- | server_condition = ${if saslauthd{{$auth2}{$auth3}}{1}{0}} | ||
- | server_set_id = $auth2 | ||
- | server_prompts = : | ||
- | .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS | ||
- | server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}} | ||
- | .endif | ||
- | |||
- | login_saslauthd_server: | ||
- | driver = plaintext | ||
- | public_name = LOGIN | ||
- | server_prompts = " | ||
- | # don't send system passwords over unencrypted connections | ||
- | server_condition = ${if saslauthd{{$auth1}{$auth2}}{1}{0}} | ||
- | server_set_id = $auth1 | ||
- | .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS | ||
- | server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}} | ||
- | .endif | ||
- | Add the Debian-exim user to the sasl group. | ||
- | |||
- | ~# usermod -a -G sasl Debian-exim | ||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing | ||
- | |||
- | ~$ swaks -a -tls -q AUTH -s 2a02: | ||
- | Password: enter_your_password | ||
- | === Trying 2a02: | ||
- | === Connected to 2a02: | ||
- | <- 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 15 Mar 2015 16:04:35 -0400 | ||
- | -> EHLO mail.bitlair.nl | ||
- | <- 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | <- 250-SIZE 52428800 | ||
- | <- 250-8BITMIME | ||
- | <- 250-PIPELINING | ||
- | <- 250-STARTTLS | ||
- | <- 250 HELP | ||
- | -> STARTTLS | ||
- | <- 220 TLS go ahead | ||
- | === TLS started w/ cipher DHE-RSA-AES256-SHA256 | ||
- | === TLS peer subject DN="/ | ||
- | ~> EHLO mail.bitlair.nl | ||
- | <~ 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | <~ 250-SIZE 52428800 | ||
- | <~ 250-8BITMIME | ||
- | <~ 250-PIPELINING | ||
- | <~ 250-AUTH PLAIN LOGIN | ||
- | <~ 250 HELP | ||
- | ~> AUTH LOGIN | ||
- | <~ 334 VXNlcm5hbWU6 | ||
- | ~> d2lsY28= | ||
- | <~ 334 UGFzc3dvcmQ6 | ||
- | ~> YmxpZXA= | ||
- | <~ 235 Authentication succeeded | ||
- | ~> QUIT | ||
- | <~ 221 mail.bitlair.nl closing connection | ||
- | Connection closed with remote host. | ||
- | Authentication succeeded is what you want! | ||
- | |||
- | DNS block lists | ||
- | |||
- | Add CHECK_RCPT_IP_DNSBLS to the top of / | ||
- | |||
- | CHECK_RCPT_IP_DNSBLS=cbl.abuseat.org: | ||
- | Remove the whole ifdef CHECK_RCPT_IP_DNSBLS section from / | ||
- | |||
- | accept | ||
- | domains | ||
- | dnslists | ||
- | logwrite | ||
- | |||
- | deny | ||
- | message = ${sender_host_address} is listed at ${dnslist_domain}; | ||
- | !hosts = +relay_from_hosts | ||
- | !authenticated = * | ||
- | dnslists = CHECK_RCPT_IP_DNSBLS | ||
- | |||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | More information exim4 configuration | ||
- | |||
- | http:// | ||
- | http:// | ||
- | Spamassassin | ||
- | |||
- | Spamassassin configuration | ||
- | |||
- | To enable spamd from spamassassin, | ||
- | |||
- | ENABLED=1 | ||
- | And add "-u debian-spamd" | ||
- | |||
- | OPTIONS=" | ||
- | And also enable the cron rules updates by setting | ||
- | |||
- | CRON=1 | ||
- | You will probably want more terse spam reporting, because it will be in the email headers, to get this, add the following to / | ||
- | |||
- | clear_report_template | ||
- | report _YESNO_, score=_SCORE_ required=_REQD_ autolearn=_AUTOLEARN_ | ||
- | report tests=_TESTSSCORES | ||
- | While you're there, you may want to enable the bayesian classifier, and set up razor and pyzor, and fix RFC-ignorant rules. | ||
- | |||
- | # Use Bayesian classifier (default: 1) | ||
- | # | ||
- | use_bayes 1 | ||
- | |||
- | |||
- | # | ||
- | # | ||
- | bayes_auto_learn 1 | ||
- | bayes_auto_learn_threshold_nonspam -0.001 | ||
- | bayes_auto_learn_threshold_spam 8.0 | ||
- | |||
- | # Use razor and pyzor | ||
- | use_razor2 1 | ||
- | use_pyzor 1 | ||
- | |||
- | # Disable stupid RFC-incompatible spamassassin SPF_NEUTRAL check. Do not add points for SPF_NEUTRAL, | ||
- | score SPF_NEUTRAL 0 | ||
- | Now, set up razor and pyzor: | ||
- | |||
- | ~# razor-admin -home=/ | ||
- | ~# razor-admin -home=/ | ||
- | ~# razor-admin -home=/ | ||
- | ~# pyzor --homedir / | ||
- | Restart spamassassin. | ||
- | |||
- | ~# service spamassassin restart | ||
- | Exim spamd integration | ||
- | |||
- | Uncomment the following line in / | ||
- | |||
- | spamd_address = 127.0.0.1 783 | ||
- | In / | ||
- | |||
- | # warn | ||
- | # spam = Debian-exim: | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | Also replace Debian-exim with debian-spamd (case sensitive), change _report to -Status and dash/upper case the rest (See section below for result). To bounce messages, also add this directly below: | ||
- | |||
- | deny | ||
- | message = This message scored $spam_score spam points. | ||
- | spam = debian-spamd | ||
- | condition = ${if > | ||
- | You'll get something like this: | ||
- | |||
- | warn | ||
- | spam = debian-spamd: | ||
- | add_header = X-Spam-Score: | ||
- | X-Spam-Score-Int: | ||
- | X-Spam-Bar: $spam_bar\n\ | ||
- | X-Spam-Status: | ||
- | |||
- | deny | ||
- | message = This message scored $spam_score spam points. | ||
- | spam = debian-spamd | ||
- | condition = ${if > | ||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing spam blocking | ||
- | |||
- | $ telnet 127.0.0.1 25 | ||
- | Trying 127.0.0.1... | ||
- | Connected to 127.0.0.1. | ||
- | Escape character is ' | ||
- | 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 15 Mar 2015 13:53:46 -0400 | ||
- | EHLO mail.bitlair.nl | ||
- | 250-mail.bitlair.nl Hello localhost.localdomain [127.0.0.1] | ||
- | 250-SIZE 52428800 | ||
- | 250-8BITMIME | ||
- | 250-PIPELINING | ||
- | 250-STARTTLS | ||
- | 250 HELP | ||
- | MAIL FROM: < | ||
- | 250 OK | ||
- | RCPT TO: < | ||
- | 250 Accepted | ||
- | DATA | ||
- | 354 Enter message, ending with " | ||
- | Subject: test | ||
- | |||
- | XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X | ||
- | |||
- | . | ||
- | 550 This message scored 1002.6 spam points. | ||
- | You should get error 550 here. | ||
- | |||
- | More information on spamassassin | ||
- | |||
- | http:// | ||
- | https:// | ||
- | Antivirus | ||
- | |||
- | Setting up ClamAV | ||
- | |||
- | Update the antivirus database: | ||
- | |||
- | ~# freshclam | ||
- | ClamAV update process started at Sun Mar 15 13:57:01 2015 | ||
- | main.cvd is up to date (version: 55, sigs: 2424225, f-level: 60, builder: neo) | ||
- | daily.cvd is up to date (version: 20194, sigs: 1348078, f-level: 63, builder: dgoddard) | ||
- | bytecode.cvd is up to date (version: 247, sigs: 41, f-level: 63, builder: dgoddard) | ||
- | You will get a message about outdated ClamAV if you do not have the latest version from stable-updates. Make sure you have it in your sources list and preferably in the unattended-upgrades list. Also see the troubleshooting section. | ||
- | |||
- | If you get a message about freshclam.log being locked, this means the clamav database is already up to date, check the freshclam.log for any warnings, like "your version is OUTDATED" | ||
- | |||
- | Add clamav to the Debian-exim group, so that clamav-daemon can read the message to scan. | ||
- | |||
- | ~# usermod -a -G Debian-exim clamav | ||
- | In / | ||
- | |||
- | AllowSupplementaryGroups true | ||
- | Restart clamav-daemon | ||
- | |||
- | ~# service clamav-daemon restart | ||
- | Exim clamd integration | ||
- | |||
- | In / | ||
- | |||
- | av_scanner = clamd:/ | ||
- | In / | ||
- | |||
- | deny | ||
- | malware = * | ||
- | message = This message was detected as possible malware ($malware_name). | ||
- | Regenerate the exim4 config and restart exim. | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing | ||
- | |||
- | ~$ telnet 2a02: | ||
- | Trying 2a02: | ||
- | Connected to 2a02: | ||
- | Escape character is ' | ||
- | 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 15 Mar 2015 14:10:10 -0400 | ||
- | EHLO mail.bitlair.nl | ||
- | 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | 250-SIZE 52428800 | ||
- | 250-8BITMIME | ||
- | 250-PIPELINING | ||
- | 250-STARTTLS | ||
- | 250 HELP | ||
- | MAIL FROM: < | ||
- | 250 OK | ||
- | RCPT TO: < | ||
- | 250 Accepted | ||
- | DATA | ||
- | 354 Enter message, ending with " | ||
- | Subject: test | ||
- | |||
- | X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* | ||
- | . | ||
- | 550 This message was detected as possible malware (Eicar-Test-Signature). | ||
- | You should get error 550 here. This is good. | ||
- | |||
- | More information on ClamAV | ||
- | |||
- | http:// | ||
- | http:// | ||
- | http:// | ||
- | Setting up DKIM | ||
- | |||
- | Contrary to SPF and DMARC, DKIM is actually a good idea. This does not break the internet, I advise everyone to implement DKIM. | ||
- | |||
- | Configuring exim for DKIM | ||
- | |||
- | The first step to getting DKIM working, is generating an RSA key for DKIM. You will be tempted to use a large key here, but given that you have to add the public key to DNS, do not use more than 1024-bit keys. If you want to use stronger cryptography for this in the future, please consider contributing to the support of ECC crypto in DKIM. | ||
- | |||
- | ~# mkdir -m 0750 / | ||
- | ~# chown root: | ||
- | To generate the RSA key pair (repeat per domain): | ||
- | |||
- | ~# openssl genrsa -out / | ||
- | ~# openssl rsa -in / | ||
- | Add the following to the top of / | ||
- | |||
- | DKIM_DOMAIN = ${domain: | ||
- | DKIM_SELECTOR = exim | ||
- | DKIM_FILE = / | ||
- | DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}} | ||
- | DKIM_CANON = relaxed | ||
- | DKIM_STRICT = true | ||
- | Configuring DNS for DKIM | ||
- | |||
- | Update your DNS zones to have the following records: | ||
- | |||
- | exim._domainkey | ||
- | _domainkey | ||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing | ||
- | |||
- | Send an email to yourself from your MTA, you should see DKIM headers added to your message, to verify if it really checks out, send an email to check-auth@verifier.port25.com from your MTA. | ||
- | |||
- | It should respond with something like: | ||
- | |||
- | DKIM check: | ||
- | More information on DKIM | ||
- | |||
- | http:// | ||
- | http:// | ||
- | http:// | ||
- | https:// | ||
- | http:// | ||
- | SPF | ||
- | |||
- | Please note, before you add SPF: SPF is very broken. It assumes that people do not forward e-mail. It breaks .forward files, procmail forwards, etc. There is a remedy, called Sender Rewriting Scheme, but people are generally not aware of this. If you want to forward to gmail.com, which is known broken, because it mandates SPF records. | ||
- | |||
- | Adding SPF to your domain | ||
- | |||
- | You can set limits on who can send on behalf of your domain using DNS. However, extremely few mail forwards have implemented SRS. As stated on wikipedia: " | ||
- | |||
- | Unfortunately, | ||
- | |||
- | To have an SPF policy, I advise to not use any fails on your domain, but configure a record like: | ||
- | |||
- | @ IN TXT " | ||
- | This will ensure that hosts under your domain can pass SPF, as can your mailservers, | ||
- | |||
- | Adding Sending Rewriting Scheme (SRS) | ||
- | |||
- | Be careful with mail forwards, make sure your spam rules are set strictly enough, because your mail server reputation with gmail depends on forwarding mostly non-spam. If you want to do mail forwards to gmail, you need to implement SRS, because gmail on IPv6 is a known broken SPF mail system. | ||
- | |||
- | Installing srsd | ||
- | |||
- | Create / | ||
- | |||
- | #! /bin/sh | ||
- | |||
- | ### BEGIN INIT INFO | ||
- | # Provides: | ||
- | # Required-Start: | ||
- | # Required-Stop: | ||
- | # Should-Start: | ||
- | # Default-Start: | ||
- | # Default-Stop: | ||
- | # Short-Description: | ||
- | # Description: | ||
- | ### END INIT INFO | ||
- | |||
- | set -e | ||
- | |||
- | # / | ||
- | |||
- | DAEMON=/ | ||
- | USER=Debian-exim | ||
- | SECRETFILE=/ | ||
- | PIDFILE=/ | ||
- | SOCKETFILE=/ | ||
- | SRSD_OPTS=" | ||
- | |||
- | test -x $DAEMON || exit 0 | ||
- | |||
- | . / | ||
- | |||
- | srsd_start() { | ||
- | if start-stop-daemon --start --quiet --background \ | ||
- | --chuid $USER \ | ||
- | --pidfile $PIDFILE --make-pidfile \ | ||
- | --exec $DAEMON \ | ||
- | -- $SRSD_OPTS | ||
- | then | ||
- | rc=0 | ||
- | sleep 1 | ||
- | if ! kill -0 $(cat $PIDFILE) >/ | ||
- | log_failure_msg "srsd daemon failed to start" | ||
- | rc=1 | ||
- | fi | ||
- | else | ||
- | rc=1 | ||
- | fi | ||
- | if [ $rc -eq 0 ]; then | ||
- | log_end_msg 0 | ||
- | else | ||
- | log_end_msg 1 | ||
- | rm -f $PIDFILE | ||
- | fi | ||
- | } # srsd_start | ||
- | |||
- | |||
- | case " | ||
- | start) | ||
- | log_daemon_msg " | ||
- | if [ -s $PIDFILE ] && kill -0 $(cat $PIDFILE) >/ | ||
- | log_progress_msg " | ||
- | log_end_msg 0 | ||
- | exit 0 | ||
- | fi | ||
- | srsd_start | ||
- | ;; | ||
- | stop) | ||
- | log_daemon_msg " | ||
- | start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | ||
- | log_end_msg $? | ||
- | rm -f $PIDFILE | ||
- | rm -f $SOCKETFILE | ||
- | ;; | ||
- | |||
- | restart) | ||
- | set +e | ||
- | log_daemon_msg " | ||
- | if [ -s $PIDFILE ] && kill -0 $(cat $PIDFILE) >/ | ||
- | start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE || true | ||
- | sleep 1 | ||
- | else | ||
- | log_warning_msg "srsd daemon not running, attempting to start." | ||
- | rm -f $PIDFILE | ||
- | fi | ||
- | srsd_start | ||
- | ;; | ||
- | |||
- | status) | ||
- | status_of_proc -p $PIDFILE " | ||
- | exit $? # notreached due to set -e | ||
- | ;; | ||
- | *) | ||
- | echo " | ||
- | exit 1 | ||
- | esac | ||
- | |||
- | exit 0 | ||
- | Now make it executable and run at boot time. | ||
- | |||
- | ~# chmod 755 / | ||
- | ~# update-rc.d srsd defaults | ||
- | Generate a new random secret: | ||
- | |||
- | ~# touch / | ||
- | ~# chown Debian-exim / | ||
- | ~# chmod 600 / | ||
- | ~# openssl rand -base64 12 > / | ||
- | Start srsd: | ||
- | |||
- | ~# service srsd start | ||
- | Implement srsd integration into exim4 | ||
- | |||
- | Create a file in / | ||
- | |||
- | srs_bounce: | ||
- | debug_print = "R: srs_bounce for $local_part@$domain" | ||
- | driver = redirect | ||
- | allow_fail | ||
- | allow_defer | ||
- | domains = spf-must-die.org | ||
- | local_part_prefix = srs0+ : srs0- : srs0= : srs1+ : srs1- : srs1= | ||
- | caseful_local_part | ||
- | address_data = ${readsocket{/ | ||
- | data = ${if match{$address_data}{^ERROR}{: | ||
- | |||
- | |||
- | srs_forward: | ||
- | debug_print = "R: srs_forward for $local_part@$domain" | ||
- | no_verify | ||
- | senders = ! : ! *@+local_domains | ||
- | address_data = ${readsocket{/ | ||
- | {FORWARD $sender_address_local_part@$sender_address_domain spf-must-die.org\n}\ | ||
- | {5s}{\n}{: | ||
- | errors_to = ${quote_local_part: | ||
- | headers_add = " | ||
- | driver = redirect | ||
- | repeat_use = false | ||
- | allow_defer | ||
- | data = ${quote_local_part: | ||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing the SRS forwarding | ||
- | |||
- | Create an alias in / | ||
- | |||
- | user: your@email.address | ||
- | run newaliases to regenerate the hash table | ||
- | |||
- | ~# newaliases | ||
- | Now try to send email to user@your-mail-server. | ||
- | |||
- | You should get it in your mailbox.. look at the message source, you will see the following headers if DKIM and SRS are working (note the d=rewriting domain): | ||
- | |||
- | Return-Path: | ||
- | DKIM-Signature: | ||
- | h=Content-Type: | ||
- | b=eC+zN8okGJYoNUgllB9TUb9XDmHVIWYwFiIC+m2gcji5zlM+LIDYEz0Z6tAdZt1vUhugefB7DCLos6aiKwP/ | ||
- | X-SRS: Sender address rewritten from < | ||
- | Enable SPF checking | ||
- | |||
- | Enabling SPF checking will break mail forwarding to your domain without SRS on domains that have a fail configured. This will likely block much legitimate e-mail, but if you want to forward to the big players, it's nearly mandatory to do.. | ||
- | |||
- | To enable inbound SPF checking, add the following to the top of / | ||
- | |||
- | CHECK_RCPT_SPF=yes | ||
- | Be careful if you have servers relaying e-mail for you (for instance because your mail server is IPv6 only and want to receive e-mail on IPv4 or as a fallback mailserver). You need to add all addresses of those servers to / | ||
- | |||
- | Testing SPF checking | ||
- | |||
- | ~$ telnet 2a02: | ||
- | Trying 2a02: | ||
- | Connected to 2a02: | ||
- | Escape character is ' | ||
- | 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 29 Mar 2015 14:37:47 +0200 | ||
- | EHLO mail.bitlair.nl | ||
- | 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | 250-SIZE 52428800 | ||
- | 250-8BITMIME | ||
- | 250-PIPELINING | ||
- | 250-STARTTLS | ||
- | 250 HELP | ||
- | MAIL FROM: < | ||
- | 250 OK | ||
- | RCPT TO: < | ||
- | 550-[SPF] 2001: | ||
- | 550 Please see http:// | ||
- | You should see a 550 reject here when there is an SPF FAIL. | ||
- | |||
- | More information on SPF and SRS | ||
- | |||
- | https:// | ||
- | https:// | ||
- | http:// | ||
- | Greylisting | ||
- | |||
- | Greylisting is bouncing all email from new senders with a temporary failure code. Implementing this helps a good deal against spammers, at the cost of having to wait for an email from a new sender. | ||
- | |||
- | Set up exim | ||
- | |||
- | To set up configuration, | ||
- | |||
- | ~# greylistd-setup-exim4 add | ||
- | ~# service greylistd restart | ||
- | Now, if you want to skip greylisting on dnswl listed hosts, which I recommend: add the following line to the defer and deny sections about greylisting in / | ||
- | |||
- | !dnslists = list.dnswl.org | ||
- | This will override your local greylistd blacklist and override greylisting for known good senders. | ||
- | |||
- | And regenerate the configuration and restart exim4 | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing | ||
- | |||
- | ~$ telnet 2a02: | ||
- | Trying 2a02: | ||
- | Connected to 2a02: | ||
- | Escape character is ' | ||
- | 220 mail.bitlair.nl ESMTP Exim 4.80 Sun, 15 Mar 2015 15:27:34 -0400 | ||
- | EHLO mail.bitlair.nl | ||
- | 250-mail.bitlair.nl Hello mail.bitlair.nl [2a02: | ||
- | 250-SIZE 52428800 | ||
- | 250-8BITMIME | ||
- | 250-PIPELINING | ||
- | 250-STARTTLS | ||
- | 250 HELP | ||
- | MAIL FROM: < | ||
- | 250 OK | ||
- | RCPT TO: < | ||
- | 451-2a02: | ||
- | 451 < | ||
- | 451 is the temporary failure error, this is the desired behaviour. | ||
- | |||
- | More information on Greylisting | ||
- | |||
- | http:// | ||
- | DMARC | ||
- | |||
- | Be careful with DMARC, as DMARC with p=reject breaks your outbound e-mail even further than SPF. With p=reject, you will no longer be able to use mailing lists or mail forwarders, even those with SRS enabled. DMARC checks the ' | ||
- | |||
- | Enable this if the risk of impersonation/ | ||
- | |||
- | It does have useful features, like reporting, so setting a p=none can add at least some value to your mail setup. | ||
- | |||
- | Set up a mailbox | ||
- | |||
- | Create a user in whatever system you're using. If you're not using LDAP or MySQL or something, this should do: | ||
- | |||
- | ~# useradd dmarc | ||
- | ~# passwd dmarc | ||
- | Enter new UNIX password: | ||
- | Retype new UNIX password: | ||
- | passwd: password updated successfully | ||
- | When running a remote mailstore without LDAP/MySQL backend, this procedure has to be repeated on the mail store. | ||
- | |||
- | Publish a DMARC policy | ||
- | |||
- | You can add the following DMARC policy to your domain. p=none is important! | ||
- | |||
- | _dmarc IN TXT " | ||
- | |||
- | Doing something useful with the reports | ||
- | |||
- | This section is TODO. I haven' | ||
- | |||
- | More information on DMARC | ||
- | |||
- | http:// | ||
- | http:// | ||
- | LDAP integration | ||
- | |||
- | This assumes you already have an LDAP running. To set one up, please see the spacefed guide. | ||
- | |||
- | Schema | ||
- | |||
- | Load the qmail LDAP schema: | ||
- | |||
- | ~# ldapadd -H ldapi:/// -Y EXTERNAL << EOF | ||
- | dn: cn=qmail, | ||
- | objectClass: | ||
- | cn: {4}qmail | ||
- | olcAttributeTypes: | ||
- | the user on the mailsystem' | ||
- | | ||
- | olcAttributeTypes: | ||
- | the user on the mailsystem' | ||
- | | ||
- | olcAttributeTypes: | ||
- | ' | ||
- | TR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} SIN | ||
- | | ||
- | olcAttributeTypes: | ||
- | ESC ' | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | ount of space the user can use until all further messages get bounced.' | ||
- | X 1.3.6.1.4.1.1466.115.121.1.44 SINGLE-VALUE ) | ||
- | olcAttributeTypes: | ||
- | h qmail server the messagestore of this user is located.' | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | DESC ' | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | SC ' | ||
- | BSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) | ||
- | olcAttributeTypes: | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | lti field entries of: nolocal, noforward, noprogram, reply' EQUALITY caseIgno | ||
- | | ||
- | olcAttributeTypes: | ||
- | A reply text for every incoming message' | ||
- | | ||
- | ) | ||
- | olcAttributeTypes: | ||
- | The status of a user account: active, noaccess, disabled, deleted' | ||
- | | ||
- | olcAttributeTypes: | ||
- | SC 'The earliest date when a mailMessageStore will be purged' | ||
- | | ||
- | olcAttributeTypes: | ||
- | The size of space the user can have until further messages get bounced.' | ||
- | LITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) | ||
- | olcAttributeTypes: | ||
- | ' | ||
- | ' | ||
- | olcAttributeTypes: | ||
- | e maximum size of a single messages the user accepts.' | ||
- | | ||
- | olcAttributeTypes: | ||
- | | ||
- | AX 1.3.6.1.4.1.1466.115.121.1.12 ) | ||
- | olcAttributeTypes: | ||
- | oup member specified as normal rf822 email address.' | ||
- | tch SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{ | ||
- | 256} ) | ||
- | olcAttributeTypes: | ||
- | oup member specified as ldap search filter.' | ||
- | TR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{512} ) | ||
- | olcAttributeTypes: | ||
- | ender to Group has to answer confirmation email.' | ||
- | X 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE ) | ||
- | olcAttributeTypes: | ||
- | der to Group must be group member itself.' | ||
- | | ||
- | olcAttributeTypes: | ||
- | t that will be sent with sender confirmation email.' | ||
- | SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{4096} | ||
- | | ||
- | olcAttributeTypes: | ||
- | up moderator specified as Distinguished name.' EQUALITY distinguishedNameMatc | ||
- | h SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 ) | ||
- | olcAttributeTypes: | ||
- | ' | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | ext that will be sent with request for moderation email.' | ||
- | Match SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{4 | ||
- | 096} SINGLE-VALUE ) | ||
- | olcAttributeTypes: | ||
- | ed sender specified as distinguished name.' EQUALITY distinguishedNameMatch S | ||
- | YNTAX 1.3.6.1.4.1.1466.115.121.1.12 ) | ||
- | olcAttributeTypes: | ||
- | | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | | ||
- | UBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{512} | ||
- | ) | ||
- | olcAttributeTypes: | ||
- | | ||
- | olcAttributeTypes: | ||
- | EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6 | ||
- | | ||
- | olcAttributeTypes: | ||
- | | ||
- | | ||
- | olcAttributeTypes: | ||
- | | ||
- | olcAttributeTypes: | ||
- | | ||
- | olcAttributeTypes: | ||
- | ESC '' | ||
- | 1.3.6.1.4.1.1466.115.121.1.26{256} SINGLE-VALUE ) | ||
- | olcAttributeTypes: | ||
- | '' | ||
- | olcAttributeTypes: | ||
- | C '' | ||
- | ) | ||
- | olcAttributeTypes: | ||
- | ' | ||
- | olcAttributeTypes: | ||
- | '' | ||
- | | ||
- | olcObjectClasses: | ||
- | DAP User' SUP top AUXILIARY MUST mail MAY ( uid $ mailMessageStore $ homeDire | ||
- | ctory $ userPassword $ mailAlternateAddress $ qmailUID $ qmailGID $ mailHost | ||
- | $ mailForwardingAddress $ deliveryProgramPath $ qmailDotMode $ deliveryMode $ | ||
- | mailReplyText $ accountStatus $ qmailAccountPurge $ mailQuotaSize $ mailQuot | ||
- | | ||
- | olcObjectClasses: | ||
- | LDAP Group' SUP top AUXILIARY MUST ( mail $ mailAlternateAddress $ mailMessag | ||
- | | ||
- | | ||
- | er $ rfc822sender $ filtersender ) ) | ||
- | olcObjectClasses: | ||
- | LDAP Subtree Admin' SUP top AUXILIARY MUST ( qlaDnManager $ qlaDomainList $ q | ||
- | | ||
- | | ||
- | EOF | ||
- | Exim LDAP integration | ||
- | |||
- | Add the following two routers: | ||
- | |||
- | / | ||
- | |||
- | ldap_aliases: | ||
- | driver = redirect | ||
- | allow_fail | ||
- | allow_defer | ||
- | data = ${lookup ldapm{ \ | ||
- | user=cn=exim, | ||
- | pass=That would be dumb \ | ||
- | ldaps:// | ||
- | (&\ | ||
- | (objectclass=qmailUser)\ | ||
- | (|\ | ||
- | (mail=${quote_ldap: | ||
- | (mailAlternateAddress=${quote_ldap: | ||
- | )\ | ||
- | )} {$value} fail } | ||
- | file_transport = address_file | ||
- | pipe_transport = address_pipe | ||
- | |||
- | / | ||
- | |||
- | ldap_users: | ||
- | driver = redirect | ||
- | allow_fail | ||
- | allow_defer | ||
- | data = ${lookup ldapm{ \ | ||
- | user=cn=exim, | ||
- | pass=Still not that dumb \ | ||
- | ldaps:// | ||
- | (&\ | ||
- | | ||
- | (|\ | ||
- | | ||
- | | ||
- | )\ | ||
- | )} {$value} fail } | ||
- | file_transport = address_file | ||
- | pipe_transport = address_pipe | ||
- | |||
- | |||
- | / | ||
- | |||
- | ldap_accept: | ||
- | driver = accept | ||
- | condition = ${lookup ldapm{ \ | ||
- | user=cn=exim, | ||
- | pass=!!Not this stupid!! \ | ||
- | ldaps:// | ||
- | (&\ | ||
- | | ||
- | (|\ | ||
- | | ||
- | )\ | ||
- | )} {$value} fail } | ||
- | transport = lmtp | ||
- | If you want wildcard domain matching for your domain add the following (Note: to use wildcards in LDAP set the attribute mail or mailAlternateAddress to @domain.tld): | ||
- | |||
- | / | ||
- | |||
- | ldap_wildcard_aliases: | ||
- | driver = redirect | ||
- | allow_fail | ||
- | allow_defer | ||
- | data = ${lookup ldapm{ \ | ||
- | user=cn=exim, | ||
- | pass=!!Not this stupid!! \ | ||
- | ldaps:// | ||
- | (&\ | ||
- | (objectclass=qmailUser)\ | ||
- | (|\ | ||
- | (mail=@${quote_ldap: | ||
- | (mailAlternateAddress=@${quote_ldap: | ||
- | )\ | ||
- | )} {$value} fail } | ||
- | file_transport = address_file | ||
- | pipe_transport = address_pipe | ||
- | / | ||
- | |||
- | ldap_wildcard_users: | ||
- | driver = redirect | ||
- | allow_fail | ||
- | allow_defer | ||
- | data = ${lookup ldapm{ \ | ||
- | user=cn=exim, | ||
- | pass=!!Not this stupid!! \ | ||
- | ldaps:// | ||
- | (&\ | ||
- | | ||
- | (|\ | ||
- | | ||
- | | ||
- | )\ | ||
- | )} {$value} fail } | ||
- | file_transport = address_file | ||
- | pipe_transport = address_pipe | ||
- | Testing Exim LDAP integration | ||
- | |||
- | To run a lookup: | ||
- | |||
- | ~# exim -bt -d+lookup wilco@bitlair.nl | ||
- | To assemble to proper query: | ||
- | |||
- | ~# exim -be | ||
- | > ${lookup ldapm{ user=bla pass=bla ldaps:// | ||
- | wilco@bitlair.nl | ||
- | Should give you back your email address. | ||
- | |||
- | Saslauthd LDAP integration | ||
- | |||
- | Change the mechanisms to ldap in / | ||
- | |||
- | MECHANISMS=" | ||
- | Write up a configuration file like this in / | ||
- | |||
- | ldap_bind_dn: | ||
- | ldap_bind_pw: | ||
- | ldap_servers: | ||
- | ldap_search_base: | ||
- | ldap_filter: | ||
- | Restart saslauthd. | ||
- | |||
- | ~# service saslauthd restart | ||
- | Testing saslauthd LDAP integration | ||
- | |||
- | ~# testsaslauthd -u johndoe -p secret | ||
- | Should give back something like: | ||
- | |||
- | 0: OK " | ||
- | Next up is testing SASL exim, see the SASL integration section for exim, above here. | ||
- | |||
- | More information on LDAP integration | ||
- | |||
- | https:// | ||
- | http:// | ||
- | http:// | ||
- | LMTP delivery | ||
- | |||
- | If you want to deliver your e-mail via LMTP, just set dc_localdelivery=' | ||
- | |||
- | Local delivery | ||
- | |||
- | For local delivery to dovecot, add this section in / | ||
- | |||
- | lmtp: | ||
- | driver = lmtp | ||
- | socket = / | ||
- | #maximum number of deliveries per batch, default 1 | ||
- | batch_max = 200 | ||
- | For remote delivery with 3 week hold function via LMTP | ||
- | |||
- | Setting up remote delivery via LMTP makes sense, because you can have your mail store encrypted and still receive new emails, because the MTA will keep accepting mails. To set this up, update exim's retry policy for ::1, so that the MTA will hold on to temporarily failed e-mail deliveries for 3 weeks and will retry every 5 minutes. | ||
- | |||
- | Add the following in / | ||
- | |||
- | ::::1 * | ||
- | In transport/ | ||
- | |||
- | lmtp: | ||
- | driver = smtp | ||
- | protocol = lmtp | ||
- | port = 24 | ||
- | hosts = ::::1 | ||
- | allow_localhost | ||
- | return_path_add | ||
- | This will deliver to localhost on port 24. If you want to use a mail store with full disk crypto seperate from your Mail Transfer Agent, configure a secure tunnel from local port 24 to the LDA. That's because LMTP with crypto is not supported properly by dovecot.. and exim4 does not support delivery to TLS-on-connect secure tunnels.. so.. we will configure a pair of stunnels. | ||
- | |||
- | |||
- | Regenerate the configuration and restart exim: | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Dovecot doesn' | ||
- | |||
- | The easiest way to set up a CA (use a descriptive name as common name, e.g. My LMTP client CA): | ||
- | |||
- | ~$ mkdir CA | ||
- | ~$ cd CA | ||
- | ~$ / | ||
- | ~$ / | ||
- | ~$ / | ||
- | This will result in a newcert.pem and newkey.pem which need to be transferred to the MTA in / | ||
- | |||
- | |||
- | On the MTA, create a / | ||
- | |||
- | setuid = stunnel4 | ||
- | setgid = stunnel4 | ||
- | pid = / | ||
- | debug = 7 | ||
- | output = / | ||
- | verify = 2 | ||
- | CAfile = / | ||
- | cert = / | ||
- | key = / | ||
- | |||
- | |||
- | options = SINGLE_ECDH_USE | ||
- | options = SINGLE_DH_USE | ||
- | |||
- | [lmtp] | ||
- | client = yes | ||
- | accept = ::1:24 | ||
- | connect = imap.bitlair.nl: | ||
- | |||
- | ; vim: | ||
- | The other end (in this case dovecot), should have a similar stunnel4 setup. Note that the IMAP certificate is generated in the dovecot section (further down). | ||
- | |||
- | Create a / | ||
- | |||
- | setuid = stunnel4 | ||
- | setgid = stunnel4 | ||
- | pid = / | ||
- | debug = 7 | ||
- | output = / | ||
- | |||
- | cert = / | ||
- | key = / | ||
- | CAfile = / | ||
- | verify = 2 | ||
- | |||
- | options = SINGLE_ECDH_USE | ||
- | options = SINGLE_DH_USE | ||
- | |||
- | [lmtp] | ||
- | accept | ||
- | connect = / | ||
- | |||
- | ; vim: | ||
- | Now on both the MTA and the mail store, start the stunnel services. | ||
- | |||
- | ~# service stunnel4 start | ||
- | Testing LMTP delivery | ||
- | |||
- | To test if LMTP works, you need to have dovecot set up already. Send yourself an e-mail, see if it arrives. | ||
- | |||
- | More information on LMTP | ||
- | |||
- | http:// | ||
- | http:// | ||
- | https:// | ||
- | Mailman | ||
- | |||
- | Mailman is a mailing list server. Setting this up will enable you to run both public and private, archived mailing lists, compatible with DKIM and SPF. Note that DMARC policies interfere with mailing lists, so either reject mail from DMARC p=reject domains or Munge the from address in the mails.. | ||
- | |||
- | You will need a mailing list subdomain, for example list.bitlair.nl. This way, Exim will route messages through a pipe if it's destined for a mailing list. | ||
- | |||
- | Getting a certificate | ||
- | |||
- | Generate a certificate for list.your.domain and get it signed at a CA. | ||
- | |||
- | ~# openssl req -sha256 -days 3650 -nodes -new -newkey rsa:4096 -keyout / | ||
- | Input your location and contact information. At the CN field, input your mail hostname (list.bitlair.nl in my case). Do not enter a challenge password. | ||
- | |||
- | Submit the -csr.pem file to a CA, store the certificate you get signed from the CA in / | ||
- | |||
- | Setting up Mailman | ||
- | |||
- | First thing is to create a mailman mailing list. | ||
- | |||
- | ~# newlist mailman | ||
- | Enter the email of the person running the list: your@email.address | ||
- | Initial mailman password: | ||
- | Set the URL and mailing list domain in / | ||
- | |||
- | # | ||
- | # Default domain for email addresses of newly created MLs | ||
- | DEFAULT_EMAIL_HOST = ' | ||
- | # | ||
- | # Default host for web interface of newly created MLs | ||
- | DEFAULT_URL_HOST | ||
- | Add the following lines near the end in / | ||
- | |||
- | # Max recipients for each message | ||
- | SMTP_MAX_RCPTS = 1000 | ||
- | # Max messages sent in each SMTP connection | ||
- | SMTP_MAX_SESSIONS_PER_CONNECTION = 1 | ||
- | Configuring Exim for mailman | ||
- | |||
- | Unfortunately, | ||
- | |||
- | Configure the mailman exim settings in / | ||
- | |||
- | # Mailman macro definitions | ||
- | |||
- | # Home dir for the Mailman installation | ||
- | MM_HOME=/ | ||
- | |||
- | # User and group for Mailman | ||
- | MM_UID=list | ||
- | MM_GID=list | ||
- | |||
- | # | ||
- | # Domains that your lists are in - colon separated list | ||
- | # you may wish to add these into local_domains as well | ||
- | domainlist mm_domains=list.bitlair.nl | ||
- | |||
- | # The path of the Mailman mail wrapper script | ||
- | MM_WRAP=MM_HOME/ | ||
- | # | ||
- | # The path of the list config file (used as a required file when | ||
- | # verifying list addresses) | ||
- | MM_LISTCHK=MM_HOME/ | ||
- | Configure the mailman router in / | ||
- | |||
- | mailman_router: | ||
- | driver = accept | ||
- | domains = +mm_domains | ||
- | require_files = MM_LISTCHK | ||
- | local_part_suffix_optional | ||
- | local_part_suffix = -admin : \ | ||
- | -bounces | ||
- | -confirm | ||
- | -join : -leave | ||
- | -owner | ||
- | -subscribe : -unsubscribe | ||
- | transport = mailman_transport | ||
- | Configure the mailman transport in / | ||
- | |||
- | mailman_transport: | ||
- | driver | ||
- | command = MM_WRAP \ | ||
- | '${if def: | ||
- | {${sg{$local_part_suffix}{-(\\w+)(\\+.*)? | ||
- | {post}}' | ||
- | $local_part | ||
- | current_directory = MM_HOME | ||
- | home_directory | ||
- | user = MM_UID | ||
- | group = MM_GID | ||
- | Configure exim to accept mail for list.yourdomain.tld in / | ||
- | |||
- | dc_other_hostnames=' | ||
- | Configuring apache for mailman | ||
- | |||
- | Create a site configuration in / | ||
- | |||
- | < | ||
- | ServerName list.bitlair.nl | ||
- | ServerAdmin your@email.address | ||
- | DocumentRoot /var/www/ | ||
- | SSLEngine on | ||
- | SSLCertificateFile | ||
- | SSLCertificateKeyFile / | ||
- | SSLCertificateChainFile / | ||
- | SSLProtocol all -SSLv2 -SSLv3 | ||
- | SSLHonorCipherOrder on | ||
- | SSLCipherSuite " | ||
- | EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 \ | ||
- | EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS" | ||
- | | ||
- | < | ||
- | Options Indexes FollowSymLinks MultiViews | ||
- | AllowOverride None | ||
- | Order allow,deny | ||
- | allow from all | ||
- | # This directive allows us to have apache2' | ||
- | # in / | ||
- | RedirectMatch ^/$ / | ||
- | </ | ||
- | |||
- | ScriptAlias /cgi-bin/ / | ||
- | < | ||
- | AllowOverride None | ||
- | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | ||
- | Order allow,deny | ||
- | Allow from all | ||
- | </ | ||
- | Alias /pipermail / | ||
- | Alias / | ||
- | < | ||
- | DirectoryIndex index.html | ||
- | </ | ||
- | </ | ||
- | Of course, replace list.bitlair.nl with your own list subdomain. | ||
- | |||
- | Give permission to the web user to modify list data by adding www-data to the group list. | ||
- | |||
- | ~# usermod -a -G list www-data | ||
- | Enable the site and ssl module | ||
- | |||
- | ~# a2enmod ssl | ||
- | ~# a2ensite list.bitlair.nl | ||
- | Reload apache' | ||
- | |||
- | ~# apache2ctl graceful | ||
- | Setting up mailing lists | ||
- | |||
- | TODO, guided tour: | ||
- | |||
- | Set DMARC-policies! | ||
- | Testing Mailman | ||
- | |||
- | Browse to your list url, e.g. https:// | ||
- | |||
- | To verify your SSL-setup on your URL: | ||
- | |||
- | ~# openssl s_client -connect list.bitlair.nl: | ||
- | ... > | ||
- | Verify return code: 0 (ok) | ||
- | --- | ||
- | |||
- | Should give you the Verify return code 0 (ok) again, any other status code means there is something wrong with your certificate. | ||
- | |||
- | More information about mailman | ||
- | |||
- | http:// | ||
- | http:// | ||
- | https:// | ||
- | https:// | ||
- | Dovecot | ||
- | |||
- | Getting a certificate | ||
- | |||
- | Generate a certificate for imap.your.domain and get it signed at a CA. | ||
- | |||
- | ~# openssl req -sha256 -days 3650 -nodes -new -newkey rsa:4096 -keyout / | ||
- | Input your location and contact information. At the CN field, input your mail hostname (imap.bitlair.nl in my case). Do not enter a challenge password. | ||
- | |||
- | Submit the -csr.pem file to a CA, store the certificate you get signed from the CA in / | ||
- | |||
- | Setting up dovecot | ||
- | |||
- | Configuring dovecot should be pretty straightforward. The first step is to disable plain IMAP. | ||
- | |||
- | In / | ||
- | |||
- | inet_listener imap { | ||
- | port = 0 | ||
- | } | ||
- | inet_listener imaps { | ||
- | port = 993 | ||
- | ssl = yes | ||
- | } | ||
- | In / | ||
- | |||
- | ssl = required | ||
- | ssl_cert = </ | ||
- | ssl_key = </ | ||
- | ssl_protocols = !SSLv2 !SSLv3 | ||
- | Set the mail location where you want your mail delivered in / | ||
- | |||
- | mail_location = mdbox:/ | ||
- | If you want mailbox sharing between users, dovecot needs to setuid all mailboxes with the same user, so set this in / | ||
- | |||
- | mail_uid = vmail | ||
- | mail_gid = vmail | ||
- | Enable the lmtp service in / | ||
- | |||
- | service lmtp { | ||
- | user = vmail | ||
- | unix_listener lmtp { | ||
- | } | ||
- | } | ||
- | Set the auth_username_format to %n in / | ||
- | |||
- | auth_username_format = %Ln | ||
- | Set the autocreate setting properly for the Local Delivery Agent in / | ||
- | |||
- | lda_mailbox_autocreate = yes | ||
- | Create the vmail user and create the mail store | ||
- | |||
- | ~# useradd --system vmail | ||
- | ~# mkdir -m 0700 /srv/mail | ||
- | ~# chown vmail: /srv/mail | ||
- | To set up sieve filters, uncomment the listen section in / | ||
- | |||
- | service managesieve-login { | ||
- | inet_listener sieve { | ||
- | port = 4190 | ||
- | } | ||
- | } | ||
- | |||
- | Now we are going to change a few things in order to get sieve working properly. | ||
- | |||
- | First open and comment out the following in "/ | ||
- | |||
- | |||
- | # sieve = ~/ | ||
- | # sieve_dir = ~/sieve | ||
- | |||
- | the reason we need to comment out the above entries is because a users home directory for mail is "/ | ||
- | |||
- | |||
- | Now in the same file "/ | ||
- | |||
- | |||
- | |||
- | sieve = / | ||
- | sieve_global_path = / | ||
- | sieve_dir = / | ||
- | sieve_global_dir = / | ||
- | |||
- | |||
- | We need to create the default directories next which will give us global rules for all users. | ||
- | |||
- | |||
- | mkdir -p / | ||
- | chown vmail:vmail -R / | ||
- | |||
- | Now we have the directories for global rules for all users. | ||
- | |||
- | Now we are going to restart dovecot using the following command to update the configuration of dovecot: | ||
- | |||
- | |||
- | |||
- | ## service dovecot restart | ||
- | |||
- | |||
- | In order to test this lets add a test global rule by editing "/ | ||
- | |||
- | |||
- | require [" | ||
- | # rule:[SPAM] | ||
- | if header :contains " | ||
- | fileinto " | ||
- | } | ||
- | # rule: | ||
- | elsif header :matches " | ||
- | fileinto " | ||
- | } | ||
- | |||
- | |||
- | now to test it send yourself a mail with money in the subject and see if it gets filed into Junk. If it does not work try sending it from an external mailserver and see if it works then. | ||
- | |||
- | Now if you want to add a rule that applies only to a single user then make add the same rule to the file "/ | ||
- | |||
- | that's everything you need to know about sieve if an error occurs / | ||
- | |||
- | If you are not using LDAP then the following applies to you: | ||
- | |||
- | And also, if you're not going to use LDAP, set the following overrides in / | ||
- | |||
- | userdb { | ||
- | # < | ||
- | driver = passwd | ||
- | # [blocking=no] | ||
- | #args = | ||
- | |||
- | # Override fields from passwd | ||
- | override_fields = uid=vmail gid=vmail | ||
- | } | ||
- | |||
- | Now you're basically done. If you want LDAP integration, | ||
- | |||
- | ~# service dovecot restart | ||
- | Integrating LDAP into dovecot | ||
- | |||
- | Make sure dovecot-ldap is installed. Change / | ||
- | |||
- | Open / | ||
- | |||
- | userdb { | ||
- | driver = ldap | ||
- | args = / | ||
- | |||
- | # Default fields can be used to specify defaults that LDAP may override | ||
- | # | ||
- | |||
- | # Override fields that are always set to this value, regardless of what LDAP returns | ||
- | override_fields = uid=vmail gid=vmail | ||
- | } | ||
- | |||
- | Now open / | ||
- | |||
- | You should be done now. | ||
- | |||
- | ~# service dovecot restart | ||
- | Testing | ||
- | |||
- | Testing logins: | ||
- | |||
- | ~$ openssl s_client -connect localhost: | ||
- | * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready. | ||
- | 1 LOGIN username password | ||
- | 1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE] Logged in | ||
- | 2 LOGOUT | ||
- | * BYE Logging out | ||
- | 2 OK Logout completed. | ||
- | Testing your TLS configuration: | ||
- | |||
- | ~$ openssl s_client -connect localhost: | ||
- | |||
- | ... ->snip certificate stuff<- ... | ||
- | Verify return code: 0 (ok) | ||
- | --- | ||
- | * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready. | ||
- | You should see return code: 0 (ok), any other return code is bad. | ||
- | |||
- | ACL and Shared mailboxs (allowing delegated mailboxes) | ||
- | |||
- | To allow users to share mailboxes with each other add the following configuration changes. | ||
- | |||
- | Open / | ||
- | |||
- | namespace inbox { | ||
- | type = private | ||
- | separator = / | ||
- | #prefix = | ||
- | #location = | ||
- | inbox = yes | ||
- | #hidden = no | ||
- | #list = yes | ||
- | # | ||
- | } | ||
- | Make sure that following option is set in the / | ||
- | |||
- | protocol imap { | ||
- | |||
- | # Space separated list of plugins to load for all services. Plugins specific to | ||
- | # IMAP, LDA, etc. are added to this list in their own .conf files. | ||
- | mail_plugins = acl | ||
- | |||
- | } | ||
- | And add the following to the end of the same file (/ | ||
- | |||
- | namespace { | ||
- | type = shared | ||
- | separator = / | ||
- | prefix = shared/%%n/ | ||
- | location = mdbox:/ | ||
- | subscriptions = yes | ||
- | list = children | ||
- | } | ||
- | |||
- | In the file / | ||
- | |||
- | protocol imap { | ||
- | # Space separated list of plugins to load (default is global mail_plugins). | ||
- | mail_plugins = $mail_plugins imap_acl | ||
- | |||
- | # Maximum number of IMAP connections allowed for a user from each IP address. | ||
- | # NOTE: The username is compared case-sensitively. | ||
- | # | ||
- | } | ||
- | And finally add the following to the / | ||
- | |||
- | plugin { | ||
- | #acl = vfile:/ | ||
- | acl = vfile | ||
- | # | ||
- | } | ||
- | |||
- | # To let users LIST mailboxes shared by other users, Dovecot needs a | ||
- | # shared mailbox dictionary. For example: | ||
- | plugin { | ||
- | # | ||
- | acl_shared_dict = file:/ | ||
- | } | ||
- | Hardening | ||
- | |||
- | Exim4 rate limiting | ||
- | |||
- | First, we need to make sure only 1 message is sent per connection, we also want to limit the number of simultaneous connections. For most small mail providers, allowing 20 simulataneous connections should be plenty. | ||
- | |||
- | Create a file in / | ||
- | |||
- | smtp_accept_max_per_connection = 1 | ||
- | smtp_accept_max_per_host = 1 | ||
- | smtp_accept_max = 20 | ||
- | acl_smtp_connect = acl_check_connect | ||
- | And create the ACL file / | ||
- | |||
- | acl_check_connect: | ||
- | accept | ||
- | delay = 3s | ||
- | And regenerate the configuration and restart exim4 | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Testing the banner delay | ||
- | |||
- | ~$ telnet ::1 25 | ||
- | Trying ::1... | ||
- | Connected to ::1. | ||
- | Escape character is ' | ||
- | EHLO boe | ||
- | 554 SMTP synchronization error | ||
- | Connection closed by foreign host. | ||
- | The SMTP banner should only appear after 3 seconds of not giving any inputs. | ||
- | |||
- | |||
- | Rate limiting hosts with iptables | ||
- | |||
- | Make sure you input something like this into your firewall. The mask here implies throttling new connections for entire /64s: | ||
- | |||
- | ip6tables -A INPUT -p tcp --dport 25 -m state --state NEW -m recent --set --name smtpthrottle --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 25 -m state --state NEW -m recent --update --name smtpthrottle --seconds 60 --hitcount 6 --mask ffff: | ||
- | For legacy IP: | ||
- | |||
- | iptables -A INPUT -p tcp --dport 25 -m state --state NEW -m recent --set --name smtpthrottle | ||
- | iptables -A INPUT -p tcp --dport 25 -m state --state NEW -m recent --update --name smtpthrottle --seconds 60 --hitcount 6 -j DROP | ||
- | This makes sure that nobody can connect more than 6 times per minute to your SMTP server. I also have a port scan wrapper which auto-blacklists bad people, so my firewall looks like this in my executable / | ||
- | |||
- | #!/bin/bash | ||
- | (ip6tables -F | ||
- | ip6tables -X | ||
- | ipset flush local6 | ||
- | ipset destroy local6 | ||
- | )&>/ | ||
- | |||
- | |||
- | ipset create local6 hash:net hashsize 1024 family inet6 | ||
- | ipset add local6 2001: | ||
- | ipset add local6 fe80::/16 | ||
- | ipset add local6 ::1/128 | ||
- | |||
- | ip6tables -A INPUT -m state --state ESTABLISHED, | ||
- | ip6tables -A INPUT -m set --match-set local6 src -j ACCEPT | ||
- | ip6tables -A INPUT -p tcp -m state --state NEW -m recent --rcheck --name badpeople --seconds 3600 --hitcount 5 --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 25 -m state --state NEW -m recent --set --name smtpthrottle --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 25 -m state --state NEW -m recent --update --name smtpthrottle --seconds 60 --hitcount 6 --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name sshthrottle --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --name sshthrottle --seconds 3600 --hitcount 5 --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 22 -j ACCEPT | ||
- | ip6tables -A INPUT -p tcp --dport 25 -j ACCEPT | ||
- | ip6tables -A INPUT -p icmpv6 \! --icmpv6-type redirect -j ACCEPT | ||
- | ip6tables -A INPUT -p tcp --dport 1:21 -m state --state NEW -m recent --set --name badpeople --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 1:21 -m state --state NEW -m recent --update --name badpeople --seconds 3600 --hitcount 5 --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 26:1023 -m state --state NEW -m recent --set --name badpeople --mask ffff: | ||
- | ip6tables -A INPUT -p tcp --dport 26:1023 -m state --state NEW -m recent --update --name badpeople --seconds 3600 --hitcount 5 --mask ffff: | ||
- | ip6tables -A INPUT -j DROP | ||
- | More information on hardening | ||
- | |||
- | http:// | ||
- | http:// | ||
- | Troubleshooting | ||
- | |||
- | In general, look at the log files / | ||
- | |||
- | Most issues are caused by forgetting to regenerate the configuration, | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Forgetting to add the clamav user to the exim group | ||
- | |||
- | 2015-03-15 14:13:46 1YXD2f-0000D2-BL malware acl condition: clamd: ClamAV | ||
- | | ||
- | Can be fixed with: | ||
- | |||
- | ~# usermod -a -G Debian-exim clamav | ||
- | Not using wheezy-updates or jessie-updates repository | ||
- | |||
- | WARNING: Your ClamAV installation is OUTDATED! | ||
- | WARNING: Local version: 0.98.5 Recommended version: 0.98.6 | ||
- | DON'T PANIC! Read http:// | ||
- | Can be fixed by adding the -updates repository to / | ||
- | |||
- | deb http:// | ||
- | For Debian jessie: | ||
- | |||
- | deb http:// | ||
- | Forgetting to add the exim to sasl group | ||
- | |||
- | You'll see something like this in the mainlog: | ||
- | |||
- | 2015-03-15 16:01:54 plain_saslauthd_server authenticator failed for (mail.bitlair.nl) [2a02: | ||
- | 435 Unable to authenticate at present (set_id=wilco): | ||
- | And swaks will tell you: | ||
- | |||
- | <~* 435 Unable to authenticate at present | ||
- | Running the following will fix it: | ||
- | |||
- | ~# usermod -a -G sasl Debian-exim | ||
- | ~# service exim4 restart | ||
- | auth-ldap and dovecot-ldap.conf files missing | ||
- | |||
- | You cannot find the auth-ldap files in the / | ||
- | |||
- | Can be fixed with: | ||
- | |||
- | ~# apt-get install dovecot-ldap | ||
- | Forgetting to install dovecot-lmtpd | ||
- | |||
- | You've enabled the lmtp service, but when starting dovecot, the UNIX socket / | ||
- | |||
- | Exim will give messages like: | ||
- | |||
- | 2015-03-31 09:43:57 1Ycqq4-0004Q8-NP == wilco@bitlair.nl < | ||
- | Failed to connect to socket / | ||
- | Can be fixed with: | ||
- | |||
- | ~# apt-get install dovecot-lmtpd | ||
- | Spamassassin hits rule URIBL_BLOCKED on every mail message | ||
- | |||
- | You keep getting spamassassin URIBL_BLOCKED on every message.. this is likely caused by using large caching DNS servers. | ||
- | |||
- | Set up your own DNS server on your box to fix it. | ||
- | |||
- | ~# apt-get install bind9 | ||
- | Test it with: | ||
- | |||
- | ~$ host www.google.nl ::1 | ||
- | If it works, change your resolv.conf | ||
- | |||
- | ~# echo nameserver ::1 > / | ||
- | You keep getting 550 relay not permitted for local email addresses | ||
- | |||
- | You most likely forgot to include your domain as a local domain. | ||
- | |||
- | You can change this in / | ||
- | |||
- | After adding your domains to this file, run | ||
- | |||
- | ~# update-exim4.conf | ||
- | ~# service exim4 restart | ||
- | Unable to verify the first certificate | ||
- | |||
- | Verify return code: 21 (unable to verify the first certificate) | ||
- | This means you forgot to append the chain file to the certificate. See the TLS section on appending the certificate chain and check the certificate chain you see in the s_client output. | ||
- | |||
- | Verify that there are two certificates in / | ||
- | |||
- | TLS not available and Error while reading file message in exim4.log | ||
- | |||
- | You will get output from s_client like: | ||
- | |||
- | 139736697235088: | ||
- | Or "TLS is currently unavailable" | ||
- | |||
- | You'll see this message in the log: | ||
- | |||
- | 2015-04-12 18:31:50 TLS error on connection from localhost (openssl.client.net) [127.0.0.1] (cert/key setup: cert=/ | ||
- | This can be fixed by setting the access rights appropriately (see the TLS section). Don't forget to restart exim4! The problem may also be caused by not restarting exim4 adding Debian-exim to the ssl-cert group. It may also be caused by the certificates being missing or a typo in the location in the configuration file. After editing, regenerate the configuration file! | ||
- | |||
- | Keep getting 421 Unexpected failure after RCPT TO | ||
- | |||
- | Check your exim4 mainlog, it may say something like "no host name found for IP address xxxx: | ||
- | |||
- | |||
- | DKIM signatures are not added | ||
- | |||
- | Add some debugging output to your mainlog by setting this debug_print in / | ||
- | |||
- | remote_smtp: | ||
- | debug_print = "T: remote_smtp for $local_part@$domain, | ||
- | Now, stop exim4: | ||
- | |||
- | ~# service exim4 stop | ||
- | Now, start exim4 in transport debugging mode in a new terminal: | ||
- | |||
- | ~# exim -bd -d+transport | ||
- | Now you can send yourself another email and you should see messages about which DKIM domain and key it is going to use in the debugging output | ||
- | |||
- | Retrieved from " | ||
- | Category: | ||
- | Projects | ||
- | Navigation menu | ||
- | |||
- | Personal tools | ||
- | |||
- | Create account | ||
- | Log in | ||
- | Namespaces | ||
- | |||
- | Page | ||
- | Discussion | ||
- | Variants | ||
- | |||
- | Views | ||
- | |||
- | Read | ||
- | View form | ||
- | View source | ||
- | View history | ||
- | More | ||
- | |||
- | Search | ||
- | |||
- | |||
- | Recent changes | ||
- | Navigation | ||
- | |||
- | Main page | ||
- | Evenementen | ||
- | > Nieuw Evenement | ||
- | Projecten | ||
- | > Nieuw Project | ||
- | Deelnemer Worden | ||
- | Contact | ||
- | Space | ||
- | |||
- | Gereedschap | ||
- | Muzieksysteem | ||
- | Statistieken | ||
- | Services | ||
- | Tools | ||
- | |||
- | What links here | ||
- | Related changes | ||
- | Special pages | ||
- | Printable version | ||
- | Permanent link | ||
- | Page information | ||
- | Browse properties | ||
- | This page was last modified on 25 June 2016, at 22:40. | ||
- | Privacy policy | ||
- | About Bitlair | ||
- | Disclaimers | ||
- | Powered by MediaWikiPowered by Semantic MediaWiki |
email/install_a_full_mail_server_-_more.1479139193.txt.gz ยท Last modified: 2020/07/15 09:30 (external edit)