Mail: Difference between revisions

From CSCWiki
Jump to navigation Jump to search
Line 27: Line 27:
== Spamfiltering ==
== Spamfiltering ==


SpamAssassin is run on all incoming mail, but no action is taken based on the results. The results are appended to the headers of the email, so you can take action on it. By default, we do not run any Bayesian Spamfilters on user email, as they stand a chance of false-positives leading to users not receiving legitimate mails.
SpamAssassin is run on all incoming mail, but no action is taken based on the results. The results are appended to the headers of the email, so you can take action on it. We are running a shared Bayesian learner for all users' email, so there stands a chance of you not receiving legitimate mails due to false positives.

To use your own Bayesian learner instead of the site-wide one, simply add the following to <code>~/.spamassassin/user_prefs</code>:
<pre>
bayes_path ~/.spamassassin/bayes
bayes_auto_learn 1
</pre>
Alternatively, to disable Bayesian tests altogether:
<pre>
use_bayes 0
</pre>


You can configure procmail (the application that postfix calls to deliver any mail that it received to the user that it was sent to) to place a message in a special folder and/or delete it based on its spam score and/or whether it got flagged as spam or not. In order to do this, you need to configure procmail via .procmailrc in your home directory. An example such .procmailrc is below (adapted from [https://wiki2.dovecot.org/procmail here]):
You can configure procmail (the application that postfix calls to deliver any mail that it received to the user that it was sent to) to place a message in a special folder and/or delete it based on its spam score and/or whether it got flagged as spam or not. In order to do this, you need to configure procmail via .procmailrc in your home directory. An example such .procmailrc is below (adapted from [https://wiki2.dovecot.org/procmail here]):

Revision as of 19:34, 29 March 2021

Mail services are currently handled by the mail container on glomag.

Reading your mail

You can use any user agent that supports maildir locally (mutt, alpine, etc), and any client that supports IMAP either locally or remotely. We also have webmail.

Here are the details:

  • maildir
    • Location: $HOME/.maildir/
  • POP3
    • No longer supported.
  • IMAP
    • Hostname: mail.csclub.uwaterloo.ca
    • Port: 143 (IMAP), 993 (IMAPS)
  • SMTP
    • Hostname: mail.csclub.uwaterloo.ca
    • SSL encryption and authentication required
    • Port: 25, 465, or 587

Spamfiltering

SpamAssassin is run on all incoming mail, but no action is taken based on the results. The results are appended to the headers of the email, so you can take action on it. We are running a shared Bayesian learner for all users' email, so there stands a chance of you not receiving legitimate mails due to false positives.

To use your own Bayesian learner instead of the site-wide one, simply add the following to ~/.spamassassin/user_prefs:

bayes_path ~/.spamassassin/bayes
bayes_auto_learn 1

Alternatively, to disable Bayesian tests altogether:

use_bayes 0

You can configure procmail (the application that postfix calls to deliver any mail that it received to the user that it was sent to) to place a message in a special folder and/or delete it based on its spam score and/or whether it got flagged as spam or not. In order to do this, you need to configure procmail via .procmailrc in your home directory. An example such .procmailrc is below (adapted from here):

SHELL="/bin/bash"
DELIVER="/usr/lib/dovecot/deliver -d $LOGNAME"
DEFAULT="$HOME/.maildir/"
MAILDIR="$HOME/.maildir/"
LOGFILE=$MAILDIR/procmail.log
LOGABSTRACT=all
VERBOSE=off

# send spam to Trash folder
:0 w
* ^X-Spam-Status: Yes
| $DELIVER -m Trash

The folder to which the messages are sent must exist first. To create a new IMAP folder in the Roundcube web client, click on the gear icon in the lower left corner.

Technical Details

Mail Transfer (Incoming)

Postfix is our MTA and runs on mail. Incoming mail is received inbound on smtp/25 or ssmtp/465 and goes through a sequence of filters before being delivered to users.

We are using the following filters for incoming mail, to combat spam and malware:

  • zen.spamhaus.org RBL
  • Greylisting with postgrey

These filters reject truckloads of spam, preventing them from reaching your inbox. Greylisting adds a delay to mail delivery from unknown servers, but after a small number of successes they will be auto-whitelisted. If that isn't good enough, ask systems-committee@csclub.uwaterloo.ca to whitelist all mail to your address.

Mail Delivery

User mail is delivered, by default, to procmail. This is configurable by adding a comma-separated list of destinations in $HOME/.forward. See aliases(5) for more details.

Procmail, in turn, writes mail to $HOME/.maildir unless instructed otherwise. You can customize procmail by editing $HOME/.procmailrc. See procmailrc(5) for more details.

Failures

If you are out of quota or another error occurs writing to your home directory, procmail will deliver your message to /var/mail/$USER on the mail server. If that too fails, the server is probably on fire. The message will be returned to the queue where it will eventually bounce.

Forwarding

Place the following in $HOME/.forward to keep a local copy of your mail as well as forward it to some other email account. Replace ctdalek with your CSC username, but make sure the backslash stays.

\ctdalek
calumt@dalek.com

Mail Retrieval

We run Dovecot, an IMAP server. It reads messages from $HOME/.maildir, so if you have procmail deliver your mail elsewhere you will be unable to retrieve your mail using IMAP.

Mail Submission (Outgoing)

On the mail container, outgoing mail is submitted directly to Postfix via the sendmail(1) wrapper or on submission/587. Submitted mail is then queued for delivery to its destination. The other systems have no MTA and instead run sSMTP, which relays mail through the mail container immediately without any queue or daemon.