From Beakstar Wiki
Contents |
My mail setup
This is getting complex. Since I keep like 10k email in a mailbox I needed something other than mbox format. I also wanted spamassassin to work and mailing list filters. I'm going with Cyrus. Now many processes are running:
/usr/lib/cyrus-imapd/cyrus-master -d sendmail: accepting connections /usr/bin/spamd -d -c -m5 -H /usr/sbin/spamass-milter -p /var/run/spamass-milter/spamass-milter.sock -P /var/run/spamass-milter.pid -m -r 15
So it's like this:
Sendmail is configured to "pre-filter" email with spamassasssin (spamd). This is accomplished with spamass-milter. Then the email is forwarded to a local account. A .forward file forwards it to cyrus. I did it this way (with the .forward file) so that some users can use mbox and others Cyrus.
Current sendmail.mc file
This is currently the ONLY sendmail config file I have touched.
Notes on this file:
- Semi-unconventional setup of Cyrus. There are 3 "stock" lines in this file which are to be uncommented in order to use Cyrus as your default local mailer. I didn't want it to be the default, I just wanted it to be an "optional" mailer. Here are the 3 lines, I have two of them uncommented. The lines are not all contiguous.
dnl define(`confLOCAL_MAILER', `cyrusv2')dnl define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl MAILER(cyrusv2)dnl
- These two line enable the milter to run new email through spamassassin first
INPUT_MAIL_FILTER(`spamassassin', `S=unix:/var/run/spamass-milter/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
Curiosities
- Outlook at work can send emails either through my work email account or through my home email account. I can pick which on efrom a drop down list when I compose an email. The strange thing, is that I accidentally had my home email-relay misconfigured such that it was giving "relaying-denied". Outlook sent the message through my work account instead with no indication that it did so, or that there was a problem with my home account.
Getting relaying working
- Had to add beakstar.com to /etc/mail/relay-domains
- Had to create a reverse zone for 192.168.193.0/24 (in addition to the existing 192.168.192.l0/24)
- Had to create forwards for 192.168.193 addresses (to get rid of the "may be forged" error)
Websieve
Go here: http://sewerrat.beakstar.com/cgi-bin/websieve.pl to setup automatic mail filtering/sorting.
Sendmail
Debugging
See what sendmail considers "local domains" (for things like masquerading)
sendmail -d0.4
spamass-milter
This is the "plugin" that filter email through spamassassin first. It's called from the sendmail config files (e.g. the INPUT_MAIL_FILTER section above).
Exempting outgoing email from a spam check
- added
EXTRA_FLAGS="-i 192.168.192.0/24 -i 192.168.193.0/24"
to /etc/sysconfig/spamass-milter
From the manpage:
Ignores messages if the originating IP is in the network(s) listed.
Also FYI - adding a "-r nn" makes it dump spam that gets a really high score. It defaults to 15 if you have nothing in the spamass-milter file.
Spamassassin
Remove an entry from the autowhitelist
-R, --remove-from-whitelist Remove all addresses found in mail from whitelist (AWL)
cat spam01.txt |spamassassin -D -R
Tesing Spamassassin
As spmassassin user or sa-milt:
cat spam01.txt |spamassassin -D -t
Updateing Rules
Spamassassin rules are stored by default in /var/lib/spmassassin. You can update them by running (as root) sa-update and then /etc/init.d/spamassassin reload/restart.
Cyrus
http://nakedape.cc/info/Cyrus-IMAP-HOWTO/
Regarding deliver.db
Stop Cyrus, then do the following: mv deliver.db deliver.db.bak mkdir db.bak cp -p db/ db.bak/ rm db/* Then start Cyrus. Cyrus will recreate the deliver.db file. deliver.db is used to track duplicate messages and to keep track of vacation days. Starting with a fresh deliver.db means that any vacation responders your users have set will be reset (senders may receive the vacation message again if they send to your user). There is not much harm in this.
