]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/defines

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

remove 127 from trusted_networks, it is now implicit
[etc/mailfilter.git] / procmail / defines
1 ### basic settings
2
3 SHELL=/bin/sh
4 PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
5
6 COMSAT=no
7
8 LINEBUF=16384
9 UMASK=0077
10
11 PMVAR=$HOME/.var/procmail
12 MAILFILT=$HOME/.etc/mailfilter
13 PMRULES=$PMDIR/rules
14 CONF=$MAILFILT/config
15 REPLIES=$MAILFILT/autoreplies
16
17 LOGFILE=${LOGFILE:-$PMVAR/log}
18 LOGABSTRACT=no
19
20 NICE='/usr/bin/nice -20'
21
22 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
23 FORMAIL="$NICE /usr/bin/formail -f"
24 EGREP="$NICE /bin/egrep"
25 SED="$NICE /bin/sed"
26
27 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
28 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
29 SPAMASSASSIN="$NICE /usr/bin/spamassassin -p $SA_PREFS"
30 #SPAMC="$NICE /usr/bin/spamc -lxu $ID"
31 SPAMC="$SPAMASSASSIN"
32 TRAINER="$MAILFILT/bin/train"
33
34 OURDATE=`date -R`
35 OURDATE_SHORT=`date +%Y.%m.%d.%H.%m.%N`
36
37 INBOX=$HOME/.maildir
38
39 DEFAULT=$INBOX/
40 ORGMAIL=$HOME/BOUNCED-MAIL
41
42 # maximum message size for spam checking
43 SPAMCHECK_MAX_MESSAGE_SIZE=2500000
44
45 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
46 # autotrain crm114 with ham
47 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
48 # if crm114 classifies a message as spam but SA returns a score
49 # less-than-or-equal to this, retrain crm114
50 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
51 # if crm114 is unsure and SA returns a score greater than this, autotrain
52 # crm114 with spam
53 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
54 # if crm114 classifies a message as ham but SA returns a score
55 # greate than this, retrain crm114
56 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
57
58 ### constants used in rules
59 NL="
60 "
61 RE_MYDOMAIN="(.+\.)?madduck\.net"
62 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
63 RE_SPACE_NEWLINE="(^|[  ])"
64 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
65 RE_LASTNAME="kraff?t"
66 RE_EXTRACT_HEADER_VALUE="[      ]*\/[^  ].*"
67
68 NULL=/dev/null
69 DISCARD=$INBOX/.discard/
70
71 ### variables from the message
72
73 ### local recipient data
74 # user+foobar@my.domain.org
75 # <  >                       $USER
76 #      <    >                $EXTENSION
77 # <         >                $LOCAL
78 #             <           >  $DOMAIN
79 # <                       >  $RECIPIENT
80 USER="${USER:-$LOGNAME}"
81 EXTENSION="${EXTENSION:-}"
82 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
83 HOSTNAME="`hostname --fqdn`"
84 DOMAIN="${DOMAIN:-$HOSTNAME}"
85 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
86 ID="$LOGNAME@$HOSTNAME"
87
88 # message-id
89 INCLUDERC=$PMDIR/get-msgid
90
91 # if $SENDER is undefined or not an email address, get it from the message
92 :0
93 * !SENDER ?? @
94 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
95 { SENDER="$MATCH" }
96
97 :0
98 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
99 { DATE="$MATCH" }
100
101 :0
102 *$ ^From:$RE_EXTRACT_HEADER_VALUE
103 { FROM="$MATCH" }
104
105 :0
106 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
107 { SUBJECT="$MATCH" }
108
109 # TODO: can be removed as soon as albatross is out of the loop
110 :0 fw
111 * ^X-Original-To-Saved: \/.*
112 |$FORMAIL -R X-Original-To-Saved X-Original-To
113
114 :0
115 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
116 { ORIGINAL_TO="$MATCH" }
117 :0 E
118 { LOG="NO ORIGINAL_TO: $MSGID" }
119
120 # fix variable values for special cases
121 INCLUDERC=$PMDIR/normalise
122
123 :0
124 * ORIGINAL_TO ?? ^\/[^@]+
125 { ORIG_LOCAL="$MATCH" }
126
127 :0
128 * ORIGINAL_TO ?? .+@\/.+
129 { ORIG_DOMAIN="$MATCH" }
130
131 ### run-time variables
132
133 # OLD_MESSAGE
134 # a procmail-style flag, which is true if unset and false if set (to !).
135 # unset by marknew if the message has already been seen by the filter (according
136 # to the X-Been-There header).
137 OLD_MESSAGE=!
138
139 # SKIP_SPAMCHECKS
140 # if set, cuases spamchecks to be skipped, value lists reason
141 SKIP_SPAMCHECKS
142
143 # SPAMTRAPPED
144 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
145 # spam immediately. The value identifies who unset the variable.
146 SPAMTRAPPED
147
148 # IS_SPAM
149 # if set, then the mailfilter is as sure as it gets that the message is spam.
150 # The value identifies who set the variable.
151 IS_SPAM
152
153 # SPAM_DISAGREE
154 # if set, then the various spamchecks disagree about spaminess of the mail.
155 # The value can hold additional information.
156 SPAM_DISAGREE
157
158 # SPAM_UNSURE
159 # if set, then the various spamchecks are unsure about spaminess of the mail.
160 # The value can hold additional information.
161 SPAM_UNSURE
162
163 # SPAM_UNKNOWN
164 # if set, the spamchecks were skipped. The value gives the reason for
165 # skipping.
166 SPAM_UNKNOWN
167
168 # RETRAIN
169 # if set, causes spamfilters to be retrained, according to the variable's value
170 RETRAIN