Difference between revisions of "Mail Server"
(→Postfix) |
|||
Line 83: | Line 83: | ||
<pre> | <pre> | ||
sudo postsuper -d ALL | sudo postsuper -d ALL | ||
+ | </pre> | ||
+ | |||
+ | === Testing postfix header_checks === | ||
+ | <pre> | ||
+ | postmap -q - regexp:/etc/postfix/header_checks < /tmp/testmessage | ||
</pre> | </pre> | ||
Revision as of 08:44, 17 January 2008
Contents
General
See https://help.ubuntu.com/community/MailServer for an introduction to MTA/Spamassassin
- MTA
- Mail Transport Agent (generally SMTP)
- MDA
- Mail Delivery Agent
- MUA
- Mail User Agent (generally POP3 or IMAP)
Briefly, the workflow for mail delivery is:
[Internet] -> postfix (MTA) -> SpamAssassin -> postfix (MTA) -> procmail (MDA) -> $HOME/Maildir
and for mail viewing:
$HOME/Maildir -> Courier (IMAP MUA) -> Thunderbird/Outlook
or
$HOME/Maildir -> Mutt/Pine
Postfix
Configuring SpamAssassin as a content filter
Add to /etc/postfix/master.cf:
spamassassin unix - n n - - pipe user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
Again in /etc/postfix/master.cf, change the smtp content filters to:
smtp inet n - - - - smtpd -o content_filter=spamassassin
Configuring postfix delivery method
The following config should be placed within /etc/postfix/main.cf
To use postfix's builtin MDA with mbox format (/var/spool/mail/$USER)
# Use mbox mailboxes (the default) home_mailbox = mbox
Ensure no mailbox_command is specified
To use postfix's builtin MDA with Maildir formar ($HOME/Maildir/*)
# Use Maildir style mailboxes home_mailbox = Maildir/
Ensure no mailbox_command is specified
To use procmail as external MDA
# Use procmail mailbox_command = /usr/bin/procmail
Ensure no home_mailbox is specified
=== Configuring mail for an unknown destination to route to a specific user:
# Redirect unknown users to andrew luser_relay = andrew local_recipient_maps =
Hardening postfix
Add the following to /etc/postfix/main.cf:
## Restrictions # Require a valid handshake, with the sender announcing its name smtpd_helo_required = yes # Require the sending server to have an A or MX record in DNS #smtpd_sender_restrictions = hash:/etc/postfix/sender_access,reject_unknown_sender_domain smtpd_sender_restrictions = reject_unknown_sender_domain # Require the recipient to be a configured destination, unless from mynetworks (NB. This is default, anyway) smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
Emptying deferred queue
To attempt redelivery:
sudo postfix flush
To simply delete all deferred mails:
sudo postsuper -d ALL
Testing postfix header_checks
postmap -q - regexp:/etc/postfix/header_checks < /tmp/testmessage
SpamAssassin
Pyzor
Meaning of output like:
82.94.255.100:24441 (200, 'OK') 1206 0
- 82.94.255.100
- 24441
- Pyzor server
- (200, 'OK')
- HTTP response from server
- 1206
- Number of spam matches for tested message
- 0
- Number of whitelist (definite non-spam) matches for tested message
Pyzor will return 0 (identifying the message as spam) only if number of spam matches > 0 and number of whitelist matches = 0.
Roundcube
Fixing blank screen on IMAPS login with "Call to undefined function mcrypt_module_open" error in /var/log/roundcube/errors
- Install php-mcrypt