]> 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:

add and cleanup X-Resubmitted header
[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 LC_CTYPE=de_CH.UTF-8
21
22 #NICE='/usr/bin/nice -20'
23
24 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
25 FORMAIL="$NICE /usr/bin/formail -f"
26 EGREP="$NICE /bin/egrep"
27 SED="$NICE /bin/sed"
28 DELIVER="$NICE /usr/lib/dovecot/deliver"
29
30 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
31 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
32 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
33 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
34 #SPAMC="$SPAMASSASSIN"
35 TRAINER="$NICE $MAILFILT/bin/train"
36
37 SQLITE="$NICE /usr/bin/sqlite3"
38
39 BASE=$HOME/.maildir
40
41 #DEFAULT="|$DELIVER"
42 DEFAULT=$BASE/
43 ORGMAIL=$HOME/BOUNCED-MAIL
44
45 # maximum message size for spam checking
46 SPAMCHECK_MAX_MESSAGE_SIZE=512000
47
48 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
49 # autotrain crm114 with ham
50 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
51 # if crm114 classifies a message as spam but SA returns a score
52 # less-than-or-equal to this, retrain crm114
53 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
54 # if crm114 is unsure and SA returns a score greater than this, autotrain
55 # crm114 with spam
56 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
57 # if crm114 classifies a message as ham but SA returns a score
58 # greate than this, retrain crm114
59 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
60
61 ### constants used in rules
62 NL="
63 "
64 RE_MYDOMAIN="(.+\.)*madduck\.net"
65 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
66 RE_SPACE="[     ]"
67 RE_NOT_SPACE="[^        ]"
68 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
69 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
70 RE_LASTNAME="kraff?t"
71 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
72
73 DEJAVU_HEADER=X-Deja-Vu
74
75 NULL=/dev/null
76 DELAYED_QUEUE=$BASE/.delayed/
77 TICKLER_QUEUE=$BASE/.tickler/
78 DISCARD=$BASE/.discard/
79 #DISCARD="'|$DELIVER -m BASE.discard'"
80
81 OURDATE="`date +'%s %Y.%m.%d.%H.%M.%N %a, %d %b %Y %T %z'`"
82 :0
83 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
84 { OURDATE_TS="$MATCH" }
85 :0
86 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
87 { OURDATE_SHORT="$MATCH" }
88 :0
89 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/${RE_NOT_SPACE}+
90 { OURDATE="$MATCH" }
91
92 DELAY_NEXT_WEEKEND='next monday 54 hours ago' # fri night, 18:00 CET
93 DELAY_TONIGHT='tomorrow 00:00 6 hours ago' # tonight at 18:00 CET
94
95 ### variables from the message
96
97 ### local recipient data
98 # user+foobar@my.domain.org
99 # <  >                       $USER
100 #      <    >                $EXTENSION
101 # <         >                $LOCAL
102 #             <           >  $DOMAIN
103 # <                       >  $RECIPIENT
104 USER="${USER:-$LOGNAME}"
105 EXTENSION="${EXTENSION:-}"
106 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
107 HOSTNAME="`hostname --fqdn`"
108 DOMAIN="${DOMAIN:-$HOSTNAME}"
109 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
110 ID="$LOGNAME@$HOSTNAME"
111
112 # message-id
113 INCLUDERC=$PMDIR/get-msgid
114
115 # if $SENDER is undefined or not an email address, get it from the message
116 :0
117 * !SENDER ?? @
118 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
119 { SENDER="$MATCH" }
120
121 :0
122 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
123 { DATE="$MATCH" }
124
125 :0
126 *$ ^From:$RE_EXTRACT_HEADER_VALUE
127 { FROM="$MATCH" }
128
129 :0
130 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
131 { SUBJECT="$MATCH" }
132
133 :0
134 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
135 { ORIGINAL_TO="$MATCH" }
136 :0 E
137 { LOG="NO ORIGINAL_TO: $MSGID" }
138
139 :0
140 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
141 { TRAINED_AS="$MATCH" }
142
143 :0
144 *$ ^X-Tickle-Delivered:$RE_EXTRACT_HEADER_VALUE
145 { TICKLE_DELIVERED="$MATCH" }
146
147 :0
148 *$ ^X-Delayed:$RE_EXTRACT_HEADER_VALUE
149 { DELAYED="$MATCH" }
150
151 # fix variable values for special cases
152 INCLUDERC=$PMDIR/normalise
153
154 :0
155 * ORIGINAL_TO ?? ^\/[^@]+
156 { ORIG_LOCAL="$MATCH" }
157
158 :0
159 * ORIGINAL_TO ?? .+@\/.+
160 { ORIG_DOMAIN="$MATCH" }
161
162 ### run-time variables
163
164 # MSG_DEJAVU
165 # a procmail-style flag, which is true if unset and false if set (to !).
166 # unset by dejavu if the message has already been seen by the filter (according
167 # to the X-Been-There header).
168 MSG_DEJAVU=!
169
170 # DEST
171 # set this to a folder if the message should be delivered elsewhere than the
172 # default
173 DEST
174
175 # SKIP_SPAMCHECKS
176 # if set, cuases spamchecks to be skipped, value lists reason
177 SKIP_SPAMCHECKS
178
179 # SPAMTRAPPED
180 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
181 # spam immediately. The value identifies who unset the variable.
182 SPAMTRAPPED
183
184 # IS_SPAM
185 # if set, then the mailfilter is as sure as it gets that the message is spam.
186 # The value identifies who set the variable.
187 IS_SPAM
188
189 # SPAM_DISAGREE
190 # if set, then the various spamchecks disagree about spaminess of the mail.
191 # The value can hold additional information.
192 SPAM_DISAGREE
193
194 # SPAM_UNSURE
195 # if set, then the various spamchecks are unsure about spaminess of the mail.
196 # The value can hold additional information.
197 SPAM_UNSURE
198
199 # SPAM_UNKNOWN
200 # if set, the spamchecks were skipped. The value gives the reason for
201 # skipping.
202 SPAM_UNKNOWN
203
204 # RETRAIN
205 # if set, causes spamfilters to be retrained, according to the variable's value
206 RETRAIN
207
208 # JUSTME
209 # if set, contains reason why justme message was passed
210 JUSTME