The unified diff between revisions [4b23f812..] and [1601c693..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "UCC-NORELAY/master.cf.snippet"
# content [89b897aa51deece6ccb2bd4b6c92c97777e2b988]
#
# patch "UCC-NORELAY/main.cf.snippet"
# from [7cf396158df2253c9b17510fcc2c7da8712e48ce]
# to [19c60a884d53c433e58b50d5b29f189e62474cf5]
#
# patch "UCC-NORELAY/norelay-procmailrc"
# from [7979c70f9570ef32d93afb24b2e60c929e69bc8d]
# to [0a527555b5660dcdbcd0be6fc4384dd58c15ea69]
#
============================================================
--- UCC-NORELAY/master.cf.snippet 89b897aa51deece6ccb2bd4b6c92c97777e2b988
+++ UCC-NORELAY/master.cf.snippet 89b897aa51deece6ccb2bd4b6c92c97777e2b988
@@ -0,0 +1 @@
+localnorelay unix - n n - 8 localnorelay
============================================================
--- UCC-NORELAY/main.cf.snippet 7cf396158df2253c9b17510fcc2c7da8712e48ce
+++ UCC-NORELAY/main.cf.snippet 19c60a884d53c433e58b50d5b29f189e62474cf5
@@ -5,3 +5,7 @@ ucc_no_relay_command = procmail -m /etc/
# delivery command. recipient is given on the cmdline because procmail removes
# it from the environment.
ucc_no_relay_command = procmail -m /etc/postfix/norelay-procmailrc "$RECIPIENT"
+
+### In case of strangeness with the local(8) norelay hack, remove this line
+### to revert to normal behaviour - msh
+local_transport = localnorelay:$myhostname
============================================================
--- UCC-NORELAY/norelay-procmailrc 7979c70f9570ef32d93afb24b2e60c929e69bc8d
+++ UCC-NORELAY/norelay-procmailrc 0a527555b5660dcdbcd0be6fc4384dd58c15ea69
@@ -1,40 +1,93 @@
-# $SPAMPATH should be 1777 probably, and procmail.log needs
-# to be writable by all users too. locks require tweaking.
+# be careful with this file.
+# Documented behaviour that this should follow:
+#
+# - Is run with 'procmail -m /etc/postfix/norelay-procmailrc $RECIPIENT'
+# - If the recipient is in the list of acceptable domains (currently
+# uwa.edu.au, rcpt.to), then resend the mail using
+# sendmail -f $ORIGINAL_ENVELOPE. This should avoid loops.
+# - Otherwise, if $LOGNAME is not spamass (the default user), and
+# $HOME/ucc-spam is writable, then set the delivery path to there.
+# - Otherwise, set the delivery path to /var/spampit/$RECIPIENT
+# - Deliver the mail.
+
+# Logs are written to /var/spampit/logs/$LOGNAME.log
+
PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.
MAILDIR=/var/spampit
-LOGFILE=/var/spampit/procmail.log
+#VERBOSE=yes
LINEBUF=4096
SPAMPATH=/var/spampit
# within homedir
-HOMEMAIL=mail
-SPAMMAIL=spam
+SPAMMAIL=.ucc-spam
# passed as an arg because procmail will clear most env vars
RECIPIENT=$1
LOCALUSER=$LOGNAME
FALLBACK=$RECIPIENT
-ORGMAIL=$SPAMPATH/$RECIPIENT
+# needs to be distinct in case $RECIPIENT is owned by someone else.
+ORGMAIL=$SPAMPATH/$RECIPIENT--$LOCALUSER
DEFAULT=$ORGMAIL
-RESTINGPLACE=___
+# per-user logs.
+LOGFILE=/var/spampit/logs/$LOCALUSER.log
+RESTINGPLACE=__unset
+BOUNCE=__unset
+
+# failsafe.
+ORIGINAL_ENVELOPE=postmaster@ucc.gu.uwa.edu.au
+# so that we can send mail with the original envelope From,
+# to avoid mail loops.
+:0
+* ^From \/[^ ]+
+{
+ ORIGINAL_ENVELOPE=$MATCH
+}
+
+# Domains that can be forwarded to.
+# it would be nice to aggregate all of these into
+# a single regex of domains, but seems that you
+# can't put variables on the RHS.
:0
-* RESTINGPLACE ?? ___
-* ? test -d $HOME/$HOMEMAIL
+* RESTINGPLACE ?? __unset
+* RECIPIENT ?? .*@.*uwa.edu.au
{
- RESTINGPLACE=$HOME/$HOMEMAIL/spam
+ BOUNCE=$RECIPIENT
+ RESTINGPLACE=$RECIPIENT
}
:0
-* RESTINGPLACE ?? ___
+* RESTINGPLACE ?? __unset
+* RECIPIENT ?? .*@.*rcpt.to
{
- RESTINGPLACE=$SPAMPATH/$RECIPIENT
+ BOUNCE=$RECIPIENT
+ RESTINGPLACE=$RECIPIENT
}
+# A real UCC member.
+:0
+* RESTINGPLACE ?? __unset
+* ! LOCALUSER ?? spamass
+* ? test -w $HOME/$SPAMMAIL
+{
+ RESTINGPLACE=$HOME/$SPAMMAIL
+}
+
+:0
+* RESTINGPLACE ?? __unset
+{
+ RESTINGPLACE=$SPAMPATH/"$RECIPIENT"
+}
+
LOCKFILE=$RESTINGPLACE.lock
:0
+* ! BOUNCE ?? __unset
+|$SENDMAIL -f "$ORIGINAL_ENVELOPE" "$BOUNCE"
+
+:0
+* BOUNCE ?? __unset
$RESTINGPLACE