diff --git a/Dockerfile b/Dockerfile index 38f65fc..7abf78e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y --no-install-recommends \ postfix dovecot-imapd dovecot-sqlite dovecot-lmtpd \ dovecot-sieve dovecot-managesieved \ - dovecot-antispam spamassassin clamav \ + dovecot-antispam spamassassin spamc clamav \ supervisor rsyslog \ && apt-get clean diff --git a/README.md b/README.md index eeab223..75ddd8b 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ same level of functionality and still be able to host a complete mail server at little cost while running only FOSS, applying the KISS principle and being able to fine-tune some details if needed. -Architecture -============ +General architecture +==================== The mail infrastructure is based on a standard MTA-LDA : @@ -33,6 +33,21 @@ Additional Web UI : All components are monitored by supervisord. +Incoming e-mail +=============== + +Incoming e-mail is received by postfix, according to the workflow: +- ``smtpd`` receives the message; +- the domain is checked against the ``domains`` table; +- if the domain matches an active domain or the source address is allowed relay, continue; +- the mail is forwarded to Spamassassin, which appends some headers; +- the mail is fowarded to Dovecot using ``lmtp``; +- the local part and domain are checked against the ``users`` table; +- the user quota is checked; +- the mail is delivered to the local maildir. + + + TODO ==== @@ -41,8 +56,9 @@ This is more of a roadmap than a proper TODO list. Please poke me or pull request if you would like to join the effort. - [x] Import vmm configuration files and get a simple postfix/dovecot running with SQLite. - - [ ] Add support for spamassassin. + - [x] Add support for spamassassin. - [ ] Add support for clamav. + - [ ] Learn from user-defined spam or ham. - [ ] Draft a Web administration UI. - [ ] Implement basic features from the free (as in beer) poste.io. - [ ] Start using on a couple production mail servers. diff --git a/config/postfix/master.cf b/config/postfix/master.cf index 8f90691..7064655 100644 --- a/config/postfix/master.cf +++ b/config/postfix/master.cf @@ -3,6 +3,7 @@ # Exposed SMTP services smtp inet n - - - - smtpd + -o content_filter=spamassassin submission inet n - - - - smtpd -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes @@ -13,6 +14,7 @@ smtps inet n - - - - smtpd -o smtpd_client_restrictions=permit_sasl_authenticated,reject # Internal postfix services +pickup fifo n - n 60 1 pickup cleanup unix n - - - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - - 1000? 1 tlsmgr @@ -31,3 +33,7 @@ discard unix - - - - - discard lmtp unix - - - - - lmtp anvil unix - - - - 1 anvil scache unix - - - - 1 scache + +# Utility services +spamassassin unix - n n - - pipe + user=nobody argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient} diff --git a/config/supervisor/supervisord.conf b/config/supervisor/supervisord.conf index 7dc5f1f..f3cf3e3 100644 --- a/config/supervisor/supervisord.conf +++ b/config/supervisor/supervisord.conf @@ -1,6 +1,5 @@ [supervisord] nodaemon = true -loglevel=debug [program:postfix] command = /usr/lib/postfix/master -d @@ -8,5 +7,8 @@ command = /usr/lib/postfix/master -d [program:dovecot] command = /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf -F +[program:spamassassin] +command = /usr/sbin/spamd + [program:rsyslog] command = rsyslogd -n