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

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