1Mail::SpamAssassin::PluUgsienr::CDoKnItMr(i3b)uted PerlMDaoiclu:m:eSnptaamtAisosnassin::Plugin::DKIM(3)
2
3
4

NAME

6       Mail::SpamAssassin::Plugin::DKIM - perform DKIM verification tests
7

SYNOPSIS

9        loadplugin Mail::SpamAssassin::Plugin::DKIM [/path/to/DKIM.pm]
10
11       Taking into account signatures from any signing domains:
12
13        full   DKIM_SIGNED           eval:check_dkim_signed()
14        full   DKIM_VALID            eval:check_dkim_valid()
15        full   DKIM_VALID_AU         eval:check_dkim_valid_author_sig()
16        full   DKIM_VALID_EF         eval:check_dkim_valid_envelopefrom()
17
18       Taking into account signatures from specified signing domains only:
19       (quotes may be omitted on domain names consisting only of letters,
20       digits, dots, and minus characters)
21
22        full   DKIM_SIGNED_MY1       eval:check_dkim_signed('dom1','dom2',...)
23        full   DKIM_VALID_MY1        eval:check_dkim_valid('dom1','dom2',...)
24        full   DKIM_VALID_AU_MY1     eval:check_dkim_valid_author_sig('d1','d2',...)
25
26        full   __DKIM_DEPENDABLE     eval:check_dkim_dependable()
27
28       Author Domain Signing Practices (ADSP) from any author domains:
29
30        header DKIM_ADSP_NXDOMAIN    eval:check_dkim_adsp('N')
31        header DKIM_ADSP_ALL         eval:check_dkim_adsp('A')
32        header DKIM_ADSP_DISCARD     eval:check_dkim_adsp('D')
33        header DKIM_ADSP_CUSTOM_LOW  eval:check_dkim_adsp('1')
34        header DKIM_ADSP_CUSTOM_MED  eval:check_dkim_adsp('2')
35        header DKIM_ADSP_CUSTOM_HIGH eval:check_dkim_adsp('3')
36
37       Author Domain Signing Practices (ADSP) from specified author domains
38       only:
39
40        header DKIM_ADSP_MY1         eval:check_dkim_adsp('*','dom1','dom2',...)
41
42        describe DKIM_SIGNED   Message has a DKIM or DK signature, not necessarily valid
43        describe DKIM_VALID    Message has at least one valid DKIM or DK signature
44        describe DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain
45        describe DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain
46        describe __DKIM_DEPENDABLE     A validation failure not attributable to truncation
47
48        describe DKIM_ADSP_NXDOMAIN    Domain not in DNS and no valid author domain signature
49        describe DKIM_ADSP_ALL         Domain signs all mail, no valid author domain signature
50        describe DKIM_ADSP_DISCARD     Domain signs all mail and suggests discarding mail with no valid author domain signature, no valid author domain signature
51        describe DKIM_ADSP_CUSTOM_LOW  adsp_override is CUSTOM_LOW, no valid author domain signature
52        describe DKIM_ADSP_CUSTOM_MED  adsp_override is CUSTOM_MED, no valid author domain signature
53        describe DKIM_ADSP_CUSTOM_HIGH adsp_override is CUSTOM_HIGH, no valid author domain signature
54
55       For compatibility with pre-3.3.0 versions, the following are synonyms:
56
57        OLD: eval:check_dkim_verified = NEW: eval:check_dkim_valid
58        OLD: eval:check_dkim_signall  = NEW: eval:check_dkim_adsp('A')
59        OLD: eval:check_dkim_signsome = NEW: redundant, semantically always true
60
61       The __DKIM_DEPENDABLE eval rule deserves an explanation. The rule
62       yields true when signatures are supplied by a caller, OR ELSE when
63       signatures are obtained by this plugin AND either there are no
64       signatures OR a rule __TRUNCATED was false. In other words:
65       __DKIM_DEPENDABLE is true when failed signatures can not be attributed
66       to message truncation when feeding a message to SpamAssassin.  It can
67       be consulted to prevent false positives on large but truncated messages
68       with poor man's implementation of ADSP by hand-crafted rules.
69

DESCRIPTION

71       This SpamAssassin plugin implements DKIM lookups as described by the
72       RFC 4871, as well as historical DomainKeys lookups, as described by RFC
73       4870, thanks to the support for both types of signatures by newer
74       versions of module Mail::DKIM.
75
76       It requires the "Mail::DKIM" CPAN module to operate. Many thanks to
77       Jason Long for that module.
78

TAGS

80       The following tags are added to the set, available for use in reports,
81       header fields, other plugins, etc.:
82
83         _DKIMIDENTITY_
84           Agent or User Identifier (AUID) (the 'i' tag) from valid signatures;
85
86         _DKIMDOMAIN_
87           Signing Domain Identifier (SDID) (the 'd' tag) from valid signatures;
88
89         _DKIMSELECTOR_
90           DKIM selector (the 's' tag) from valid signatures;
91
92       Identities and domains from signatures which failed verification are
93       not included in these tags. Duplicates are eliminated (e.g. when there
94       are two or more valid signatures from the same signer, only one copy
95       makes it into a tag).  Note that there may be more than one signature
96       in a message - currently they are provided as a space-separated list,
97       although this behaviour may change.
98

SEE ALSO

100       "Mail::DKIM" Mail::SpamAssassin::Plugin(3)
101
102         http://dkimproxy.sourceforge.net/
103         https://tools.ietf.org/rfc/rfc4871.txt
104         https://tools.ietf.org/rfc/rfc4870.txt
105         https://tools.ietf.org/rfc/rfc5617.txt
106         https://datatracker.ietf.org/group/dkim/about/
107

USER SETTINGS

109       whitelist_from_dkim author@example.com [signing-domain]
110           Works similarly to whitelist_from, except that in addition to
111           matching an author address (From) to the pattern in the first
112           parameter, the message must also carry a valid Domain Keys
113           Identified Mail (DKIM) signature made by a signing domain (SDID,
114           i.e. the d= tag) that is acceptable to us.
115
116           Only one whitelist entry is allowed per line, as in
117           "whitelist_from_rcvd".  Multiple "whitelist_from_dkim" lines are
118           allowed. File-glob style characters are allowed for the From
119           address (the first parameter), just like with
120           "whitelist_from_rcvd".
121
122           The second parameter (the signing-domain) does not accept full
123           file-glob style wildcards, although a simple '*.' (or just a '.')
124           prefix to a domain name is recognized and implies any subdomain of
125           the specified domain (but not the domain itself).
126
127           If no signing-domain parameter is specified, the only acceptable
128           signature will be an Author Domain Signature (sometimes called
129           first-party signature) which is a signature where the signing
130           domain (SDID) of a signature matches the domain of the author's
131           address (i.e. the address in a From header field).
132
133           Since this whitelist requires a DKIM check to be made, network
134           tests must be enabled.
135
136           Examples of whitelisting based on an author domain signature
137           (first-party):
138
139             whitelist_from_dkim joe@example.com
140             whitelist_from_dkim *@corp.example.com
141             whitelist_from_dkim *@*.example.com
142
143           Examples of whitelisting based on third-party signatures:
144
145             whitelist_from_dkim jane@example.net      example.org
146             whitelist_from_dkim rick@info.example.net example.net
147             whitelist_from_dkim *@info.example.net    example.net
148             whitelist_from_dkim *@*                   mail7.remailer.example.com
149             whitelist_from_dkim *@*                   *.remailer.example.com
150
151       def_whitelist_from_dkim author@example.com [signing-domain]
152           Same as "whitelist_from_dkim", but used for the default whitelist
153           entries in the SpamAssassin distribution.  The whitelist score is
154           lower, because these are often targets for abuse of public mailers
155           which sign their mail.
156
157       unwhitelist_from_dkim author@example.com [signing-domain]
158           Removes an email address with its corresponding signing-domain
159           field from def_whitelist_from_dkim and whitelist_from_dkim tables,
160           if it exists.  Parameters to unwhitelist_from_dkim must exactly
161           match the parameters of a corresponding whitelist_from_dkim or
162           def_whitelist_from_dkim config option which created the entry, for
163           it to be removed (a domain name is matched case-insensitively);
164           i.e. if a signing-domain parameter was specified in a whitelisting
165           command, it must also be specified in the unwhitelisting command.
166
167           Useful for removing undesired default entries from a distributed
168           configuration by a local or site-specific configuration or by
169           "user_prefs".
170
171       adsp_override domain [signing-practices]
172           Currently few domains publish their signing practices (RFC 5617 -
173           ADSP), partly because the ADSP rfc is rather new, partly because
174           they think hardly any recipient bothers to check it, and partly for
175           fear that some recipients might lose mail due to problems in their
176           signature validation procedures or mail mangling by mailers beyond
177           their control.
178
179           Nevertheless, recipients could benefit by knowing signing practices
180           of a sending (author's) domain, for example to recognize forged
181           mail claiming to be from certain domains which are popular targets
182           for phishing, like financial institutions. Unfortunately, as
183           signing practices are seldom published or are weak, it is hardly
184           justifiable to look them up in DNS.
185
186           To overcome this chicken-or-the-egg problem, the "adsp_override"
187           mechanism allows recipients using SpamAssassin to override
188           published or defaulted ADSP for certain domains. This makes it
189           possible to manually specify a stronger (or weaker) signing
190           practices than a signing domain is willing to publish (explicitly
191           or by default), and also save on a DNS lookup.
192
193           Note that ADSP (published or overridden) is only consulted for
194           messages which do not contain a valid DKIM signature from the
195           author's domain.
196
197           According to RFC 5617, signing practices can be one of the
198           following: "unknown", "all" and "discardable".
199
200           "unknown": The domain might sign some or all email - messages from
201           the domain may or may not have an Author Domain Signature. This is
202           a default if a domain exists in DNS but no ADSP record is found.
203
204           "all": All mail from the domain is signed with an Author Domain
205           Signature.
206
207           "discardable": All mail from the domain is signed with an Author
208           Domain Signature.  Furthermore, if a message arrives without a
209           valid Author Domain Signature, the domain encourages the
210           recipient(s) to discard it.
211
212           ADSP lookup can also determine that a domain is "out of scope",
213           i.e., the domain does not exist (NXDOMAIN) in the DNS.
214
215           To override domain's signing practices in a SpamAssassin
216           configuration file, specify an "adsp_override" directive for each
217           sending domain to be overridden.
218
219           Its first argument is a domain name. Author's domain is matched
220           against it, matching is case insensitive. This is not a regular
221           expression or a file-glob style wildcard, but limited wildcarding
222           is still available: if this argument starts by a "*." (or is a sole
223           "*"), author's domain matches if it is a subdomain (to one or more
224           levels) of the argument. Otherwise (with no leading asterisk) the
225           match must be exact (not a subdomain).
226
227           An optional second parameter is one of the following keywords
228           (case-insensitive): "nxdomain", "unknown", "all", "discardable",
229           "custom_low", "custom_med", "custom_high".
230
231           Absence of this second parameter implies "discardable". If a domain
232           is not listed by a "adsp_override" directive nor does it explicitly
233           publish any ADSP record, then "unknown" is implied for valid
234           domains, and "nxdomain" for domains not existing in DNS. (Note:
235           domain validity is only checked with versions of Mail::DKIM 0.37 or
236           later (actually since 0.36_5), the "nxdomain" would never turn up
237           with older versions).
238
239           The strong setting "discardable" is useful for domains which are
240           known to always sign their mail and to always send it directly to
241           recipients (not to mailing lists), and are frequent targets of
242           fishing attempts, such as financial institutions. The "discardable"
243           is also appropriate for domains which are known never to send any
244           mail.
245
246           When a message does not contain a valid signature by the author's
247           domain (the domain in a From header field), the signing practices
248           pertaining to author's domain determine which of the following
249           rules fire and contributes its score: DKIM_ADSP_NXDOMAIN,
250           DKIM_ADSP_ALL, DKIM_ADSP_DISCARD, DKIM_ADSP_CUSTOM_LOW,
251           DKIM_ADSP_CUSTOM_MED, DKIM_ADSP_CUSTOM_HIGH. Not more than one of
252           these rules can fire for messages that have one author (but see
253           below). The last three can only result from a 'signing-practices'
254           as given in a "adsp_override" directive (not from a DNS lookup),
255           and can serve as a convenient means of providing a different score
256           if scores assigned to DKIM_ADSP_ALL or DKIM_ADSP_DISCARD are not
257           considered suitable for some domains.
258
259           RFC 5322 permits a message to have more than one author - multiple
260           addresses may be listed in a single From header field.  RFC 5617
261           defines that a message with multiple authors has multiple signing
262           domain signing practices, but does not prescribe how these should
263           be combined. In presence of multiple signing practices, more than
264           one of the DKIM_ADSP_* rules may fire.
265
266           As a precaution against firing DKIM_ADSP_* rules when there is a
267           known local reason for a signature verification failure, the
268           domain's ADSP is considered 'unknown' when DNS lookups are disabled
269           or a DNS lookup encountered a temporary problem on fetching a
270           public key from the author's domain. Similarly, ADSP is considered
271           'unknown' when this plugin did its own signature verification
272           (signatures were not passed to SA by a caller) and a metarule
273           __TRUNCATED was triggered, indicating the caller intentionally
274           passed a truncated message to SpamAssassin, which was a likely
275           reason for a signature verification failure.
276
277           Example:
278
279             adsp_override *.mydomain.example.com   discardable
280             adsp_override *.neversends.example.com discardable
281
282             adsp_override ebay.com
283             adsp_override *.ebay.com
284             adsp_override ebay.co.uk
285             adsp_override *.ebay.co.uk
286             adsp_override paypal.com
287             adsp_override *.paypal.com
288             adsp_override amazon.com
289             adsp_override ealerts.bankofamerica.com
290             adsp_override americangreetings.com
291             adsp_override egreetings.com
292             adsp_override bluemountain.com
293             adsp_override hallmark.com   all
294             adsp_override *.hallmark.com all
295             adsp_override youtube.com    custom_high
296             adsp_override google.com     custom_low
297             adsp_override gmail.com      custom_low
298             adsp_override googlemail.com custom_low
299             adsp_override yahoo.com      custom_low
300             adsp_override yahoo.com.au   custom_low
301             adsp_override yahoo.se       custom_low
302
303             adsp_override junkmailerkbw0rr.com nxdomain
304             adsp_override junkmailerd2hlsg.com nxdomain
305
306             # effectively disables ADSP network DNS lookups for all other domains:
307             adsp_override *              unknown
308
309             score DKIM_ADSP_ALL          2.5
310             score DKIM_ADSP_DISCARD     25
311             score DKIM_ADSP_NXDOMAIN     3
312
313             score DKIM_ADSP_CUSTOM_LOW   1
314             score DKIM_ADSP_CUSTOM_MED   3.5
315             score DKIM_ADSP_CUSTOM_HIGH  8
316
317       dkim_minimum_key_bits n             (default: 1024)
318           The smallest size of a signing key (in bits) for a valid signature
319           to be considered for whitelisting. Additionally, the eval function
320           check_dkim_valid() will return false on short keys when called with
321           explicitly listed domains, and the eval function
322           check_dkim_valid_author_sig() will return false on short keys
323           (regardless of its arguments). Setting the option to 0 disables a
324           key size check.
325
326           Note that the option has no effect when the eval function
327           check_dkim_valid() is called with no arguments (like in a rule
328           DKIM_VALID). A mere presence of some valid signature on a message
329           has no reputational value (without being associated with a
330           particular domain), regardless of its key size - anyone can prepend
331           its own signature on a copy of some third party mail and re-send
332           it, which makes it no more trustworthy than without such signature.
333           This is also a reason for a rule DKIM_VALID to have a near-zero
334           score, i.e. a rule hit is only informational.
335

ADMINISTRATOR SETTINGS

337       dkim_timeout n             (default: 5)
338           How many seconds to wait for a DKIM query to complete, before
339           scanning continues without the DKIM result. A numeric value is
340           optionally suffixed by a time unit (s, m, h, d, w, indicating
341           seconds (default), minutes, hours, days, weeks).
342
343
344
345perl v5.36.0                      2022-07-23Mail::SpamAssassin::Plugin::DKIM(3)
Impressum