Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / sendmail-8.14 / cf / cf / knecht.mc
1 divert(-1)
2 #
3 # Copyright (c) 1998-2001, 2004, 2005 Sendmail, Inc. and its suppliers.
4 #       All rights reserved.
5 # Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6 # Copyright (c) 1988, 1993
7 #       The Regents of the University of California.  All rights reserved.
8 #
9 # By using this file, you agree to the terms and conditions set
10 # forth in the LICENSE file which can be found at the top level of
11 # the sendmail distribution.
12 #
13 #
14
15 #
16 #  This is specific to Eric's home machine.
17 #
18 #       Run daemon with -bd -q5m
19 #
20
21 divert(0)
22 VERSIONID(`$Id: knecht.mc,v 8.62 2006/09/27 19:48:59 eric Exp $')
23 OSTYPE(bsd4.4)
24 DOMAIN(generic)
25
26 define(`ALIAS_FILE', ``/etc/mail/aliases, /etc/mail/lists/sendmail.org/aliases, /var/listmanager/aliases'')
27 define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward+$h:$z/.forward')
28 define(`confDEF_USER_ID', `mailnull')
29 define(`confHOST_STATUS_DIRECTORY', `.hoststat')
30 define(`confTO_ICONNECT', `10s')
31 define(`confTO_QUEUEWARN', `8h')
32 define(`confMIN_QUEUE_AGE', `27m')
33 define(`confTRUSTED_USER', `smtrust')
34 define(`confTRUSTED_USERS', ``www listmgr'')
35 define(`confPRIVACY_FLAGS', ``authwarnings,noexpn,novrfy'')
36
37 define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')
38 define(`confCACERT_PATH', `CERT_DIR')
39 define(`confCACERT', `CERT_DIR/CAcert.pem')
40 define(`confSERVER_CERT', `CERT_DIR/MYcert.pem')
41 define(`confSERVER_KEY', `CERT_DIR/MYkey.pem')
42 define(`confCLIENT_CERT', `CERT_DIR/MYcert.pem')
43 define(`confCLIENT_KEY', `CERT_DIR/MYkey.pem')
44
45 define(`CYRUS_MAILER_PATH', `/usr/local/cyrus/bin/deliver')
46 define(`CYRUS_MAILER_FLAGS', `fAh5@/:|')
47
48 FEATURE(`access_db')
49 FEATURE(`blacklist_recipients')
50 FEATURE(`local_lmtp')
51 FEATURE(`virtusertable')
52 FEATURE(`mailertable')
53
54 FEATURE(`nocanonify', `canonify_hosts')
55 CANONIFY_DOMAIN(`sendmail.org')
56 CANONIFY_DOMAIN_FILE(`/etc/mail/canonify-domains')
57
58 dnl #  at most 10 queue runners
59 define(`confMAX_QUEUE_CHILDREN', `20')
60
61 define(`confMAX_RUNNERS_PER_QUEUE', `5')
62
63 dnl #  run at most 10 concurrent processes for initial submission
64 define(`confFAST_SPLIT', `10')
65
66 dnl #  10 runners, split into at most 15 recipients per envelope
67 QUEUE_GROUP(`mqueue', `P=/var/spool/mqueue, R=5, r=15, F=f')
68
69 dnl # enable spam assassin
70 INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')
71
72 dnl # enable DomainKeys and DKIM
73 INPUT_MAIL_FILTER(`dkim-filter', `S=unix:/var/run/smtrust/dkim.sock, F=T, T=R:2m')
74 dnl INPUT_MAIL_FILTER(`dk-filter', `S=unix:/var/run/smtrust/dk.sock, F=T, T=R:2m')
75
76 define(`confMILTER_MACROS_CONNECT', `j, {daemon_name}')
77 define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}')
78
79 dnl # enable some DNSBLs
80 dnl FEATURE(`dnsbl', `dnsbl.sorbs.net', `"550 Mail from " $`'&{client_addr} " refused - see http://www.dnsbl.sorbs.net/"')
81 FEATURE(`dnsbl', `sbl-xbl.spamhaus.org', `"550 Mail from " $`'&{client_addr} " refused - see http://www.spamhaus.org/sbl/"')
82 FEATURE(`dnsbl', `list.dsbl.org', `"550 Mail from " $`'&{client_addr} " refused - see http://dsbl.org/"')
83 FEATURE(`dnsbl', `bl.spamcop.net', `"450 Mail from " $`'&{client_addr} " refused - see http://spamcop.net/bl.shtml"')
84
85
86 MAILER(`local')
87 MAILER(`smtp')
88 MAILER(`cyrus')
89
90 LOCAL_RULE_0
91 Rcyrus.$+ + $+ < @ $=w . >      $#cyrus $@ $2 $: $1
92 Rcyrus.$+ < @ $=w . >           $#cyrus $: $1
93
94 LOCAL_CONFIG
95 #
96 #  Regular expression to reject:
97 #    * numeric-only localparts from aol.com and msn.com
98 #    * localparts starting with a digit from juno.com
99 #
100 Kcheckaddress regex -a@MATCH
101    ^([0-9]+<@(aol|msn)\.com|[0-9][^<]*<@juno\.com)\.?>
102
103 ######################################################################
104 #
105 #  Names that won't be allowed in a To: line (local-part and domains)
106 #
107 C{RejectToLocalparts}   friend you
108 C{RejectToDomains}      public.com
109
110 LOCAL_RULESETS
111 HTo: $>CheckTo
112
113 SCheckTo
114 R$={RejectToLocalparts}@$*      $#error $: "553 Header error"
115 R$*@$={RejectToDomains}         $#error $: "553 Header error"
116
117 ######################################################################
118 HMessage-Id: $>CheckMessageId
119
120 SCheckMessageId
121 # Record the presence of the header
122 R$*                     $: $(storage {MessageIdCheck} $@ OK $) $1
123
124 # validate syntax
125 R< $+ @ $+ >                    $@ OK
126 R$*                             $#error $: "554 Header error"
127
128
129 ######################################################################
130 HReceived: $>CheckReceived
131
132 SCheckReceived
133 # Record the presence of any Received header
134 R$*                     $: $(storage {ReceivedCheck} $@ OK $) $1
135
136 # check syntax
137 R$* ......................................................... $*
138                                 $#error $: "554 Header error"
139
140 ######################################################################
141 #
142 #  Reject advertising subjects
143 #
144
145 Kadvsubj regex -b -a@MATCH ±?°í
146 HSubject: $>+CheckSubject
147 SCheckSubject
148 R$*                     $: $(advsubj $&{currHeader} $: OK $)
149 ROK                     $@ OK
150 R$*                     $#error $@ 5.7.0 $: 550 5.7.0 spam rejected.
151
152 ######################################################################
153 #
154 # Reject certain senders
155 #       Regex match to catch things in quotes
156 #
157 HFrom: $>+CheckFrom
158 KCheckFrom regex -a@MATCH
159         [^a-z]?(Net-Pa)[^a-z]
160
161 SCheckFrom
162 R$*                             $: $( CheckFrom $1 $)
163 R@MATCH                         $#error $: "553 Header error"
164
165 LOCAL_RULESETS
166 SLocal_check_mail
167 # check address against various regex checks
168 R$*                             $: $>Parse0 $>3 $1
169 R$+                             $: $(checkaddress $1 $)
170 R@MATCH                         $#error $: "553 Header error"
171
172 #
173 #  Following code from Anthony Howe <achowe@snert.com>.  The check
174 #  for the Outlook Express marker may hit some legal messages, but
175 #  the Content-Disposition is clearly illegal.
176 #
177
178 #########################################################################
179 #
180 # w32.sircam.worm@mm
181 #
182 # There are serveral patterns that appear common ONLY to SirCam worm and
183 # not to Outlook Express, which claims to have sent the worm.  There are
184 # four headers that always appear together and in this order:
185 #
186 #  X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
187 #  X-Mailer: Microsoft Outlook Express 5.50.4133.2400
188 #  Content-Type: multipart/mixed; boundary="----27AA9124_Outlook_Express_message_boundary"
189 #  Content-Disposition: Multipart message
190 #
191 # Empirical study of the worm message headers vs. true Outlook Express
192 # (5.50.4133.2400 & 5.50.4522.1200) messages with multipart/mixed attachments
193 # shows Outlook Express does:
194 #
195 #  a) NOT supply a Content-Disposition header for multipart/mixed messages.
196 #  b) NOT specify the header X-MimeOLE header name in all-caps
197 #  c) NOT specify boundary tag with the expression "_Outlook_Express_message_boundary"
198 #
199 # The solution below catches any one of this three issues. This is not an ideal
200 # solution, but a temporary measure. A correct solution would be to check for
201 # the presence of ALL three header attributes. Also the solution is incomplete
202 # since Outlook Express 5.0 and 4.0 were not compared.
203 #
204 # NOTE regex keys are first dequoted and spaces removed before matching.
205 # This caused me no end of grief.
206 #
207 #########################################################################
208
209 LOCAL_RULESETS
210
211 KSirCamWormMarker regex -f -aSUSPECT multipart/mixed;boundary=----.+_Outlook_Express_message_boundary
212 HContent-Type:          $>CheckContentType
213
214 ######################################################################
215 SCheckContentType
216 R$+                     $: $(SirCamWormMarker $1 $)
217 RSUSPECT                $#error $: "553 Possible virus, see http://www.symantec.com/avcenter/venc/data/w32.sircam.worm@mm.html"
218
219 HContent-Disposition:   $>CheckContentDisposition
220
221 ######################################################################
222 SCheckContentDisposition
223 R$-                     $@ OK
224 R$- ; $+                $@ OK
225 R$*                     $#error $: "553 Illegal Content-Disposition"
226
227
228 #
229 #  Sobig.F
230 #
231
232 LOCAL_CONFIG
233 Kstorage macro
234
235 LOCAL_RULESETS
236 ######################################################################
237 ### check for the existance of the X-MailScanner Header
238 HX-MailScanner:         $>+CheckXMSc
239 D{SobigFPat}Found to be clean
240 D{SobigFMsg}This message may contain the Sobig.F virus.
241
242 SCheckXMSc
243 ### if it exists, and the defined value is set, record the presence
244 R${SobigFPat} $*        $: $(storage {SobigFCheck} $@ SobigF $) $1
245 R$*                     $@ OK
246
247 ######################################################################
248 Scheck_eoh
249 # Check if a Message-Id was found
250 R$*                     $: < $&{MessageIdCheck} >
251
252 # If Message-Id was found clear the X-MailScanner store and return with OK
253 R< $+ >                 $@ OK $>ClearStorage
254
255 # Are we the first Hop?
256 R$*                     $: < $&{ReceivedCheck} >
257 R< $+ >                 $@ OK $>ClearStorage
258
259 # no Message-Id->check X-Mailscanner presence, too
260 R$*                     $: < $&{SobigFCheck} >
261
262 # clear store
263 R$*                     $: $>ClearStorage $1
264 # no msgid, first hop and Header found? -> reject the message
265 R < SobigF >            $#error $: 553 ${SobigFMsg}
266
267 # No Header! Fine, take the message
268 R$*                     $@ OK
269
270 ######################################################################
271 SClearStorage
272 R$*                     $: $(storage {SobigFCheck} $) $1
273 R$*                     $: $(storage {ReceivedCheck} $) $1
274 R$*                     $: $(storage {MessageIdCheck} $) $1
275 R$*                     $@ $1