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

reuse BIN_DATE variable and slight reorg
[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=2.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/.tickler/
79 DISCARD=$BASE/.discard/
80 #DISCARD="'|$DELIVER -m BASE.discard'"
81
82 DELAY_NEXT_WEEKEND='next sunday 30 hours ago' # fri night, 18:00
83 DELAY_TONIGHT='tomorrow 00:00 6 hours ago' # tonight at 18:00
84
85 OURDATE="`$BIN_DATE +'%s %Y.%m.%d.%H.%M.%N %a, %d %b %Y %T %z'`"
86 :0
87 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
88 { OURDATE_TS="$MATCH" }
89 :0
90 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
91 { OURDATE_SHORT="$MATCH" }
92 :0
93 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/${RE_NOT_SPACE}+
94 { OURDATE="$MATCH" }
95
96 ### variables from the message
97
98 ### local recipient data
99 # user+foobar@my.domain.org
100 # <  >                       $USER
101 #      <    >                $EXTENSION
102 # <         >                $LOCAL
103 #             <           >  $DOMAIN
104 # <                       >  $RECIPIENT
105 USER="${USER:-$LOGNAME}"
106 EXTENSION="${EXTENSION:-}"
107 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
108 HOSTNAME="`hostname --fqdn`"
109 DOMAIN="${DOMAIN:-$HOSTNAME}"
110 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
111 ID="$LOGNAME@$HOSTNAME"
112
113 # message-id
114 INCLUDERC=$PMDIR/get-msgid
115
116 # if $SENDER is undefined or not an email address, get it from the message
117 :0
118 * !SENDER ?? @
119 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
120 { SENDER="$MATCH" }
121
122 :0
123 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
124 { DATE="$MATCH" }
125
126 :0
127 *$ ^From:$RE_EXTRACT_HEADER_VALUE
128 { FROM="$MATCH" }
129
130 :0
131 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
132 { SUBJECT="$MATCH" }
133
134 :0
135 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
136 { ORIGINAL_TO="$MATCH" }
137 :0 E
138 { LOG="NO ORIGINAL_TO: $MSGID" }
139
140 :0
141 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
142 { TRAINED_AS="$MATCH" }
143
144 :0
145 *$ ^X-Tickle-Delivered:$RE_EXTRACT_HEADER_VALUE
146 { TICKLE_DELIVERED="$MATCH" }
147
148 :0
149 *$ ^X-Delayed:$RE_EXTRACT_HEADER_VALUE
150 { DELAYED="$MATCH" }
151
152 # fix variable values for special cases
153 INCLUDERC=$PMDIR/normalise
154
155 :0
156 * ORIGINAL_TO ?? ^\/[^@]+
157 { ORIG_LOCAL="$MATCH" }
158
159 :0
160 * ORIGINAL_TO ?? .+@\/.+
161 { ORIG_DOMAIN="$MATCH" }
162
163 ### run-time variables
164
165 # MSG_DEJAVU
166 # a procmail-style flag, which is true if unset and false if set (to !).
167 # unset by dejavu if the message has already been seen by the filter (according
168 # to the X-Been-There header).
169 MSG_DEJAVU=!
170
171 # DEST
172 # set this to a folder if the message should be delivered elsewhere than the
173 # default
174 DEST
175
176 # SKIP_SPAMCHECKS
177 # if set, cuases spamchecks to be skipped, value lists reason
178 SKIP_SPAMCHECKS
179
180 # SPAMTRAPPED
181 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
182 # spam immediately. The value identifies who unset the variable.
183 SPAMTRAPPED
184
185 # IS_SPAM
186 # if set, then the mailfilter is as sure as it gets that the message is spam.
187 # The value identifies who set the variable.
188 IS_SPAM
189
190 # SPAM_DISAGREE
191 # if set, then the various spamchecks disagree about spaminess of the mail.
192 # The value can hold additional information.
193 SPAM_DISAGREE
194
195 # SPAM_UNSURE
196 # if set, then the various spamchecks are unsure about spaminess of the mail.
197 # The value can hold additional information.
198 SPAM_UNSURE
199
200 # SPAM_UNKNOWN
201 # if set, the spamchecks were skipped. The value gives the reason for
202 # skipping.
203 SPAM_UNKNOWN
204
205 # RETRAIN
206 # if set, causes spamfilters to be retrained, according to the variable's value
207 RETRAIN
208
209 # JUSTME
210 # if set, contains reason why justme message was passed
211 JUSTME