bin/dmarc-check-mail.pl

filter: Statementstmt 99.1% 110 / 111 Branchbran 81.2% 39 / 48 Conditioncond 66.6% 18 / 27 MC/DCmcdc 43.7% 7 / 16 Subroutinesub 100% 17 / 17 Podpod n/a totaltotal 87.2% 191 / 219 CC 15 SCAR 13.2
CC
15
Cov
90%
candidate_keys
8.4
find_keyfile
4.8
unusable_address
3.0
CRAP 3.7
« bin/dmarc-report.pl ↑ Summary bin/mail-dkim »
1 #!/usr/bin/env perl
2 #
3 # The POD at the end of this file is this programme's description: perldoc
4 # dmarc-check-mail.pl.
5  
6 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 21 ▶use Getopt::Long qw(GetOptions);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 21 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 21 ▶use POSIX qw(strftime);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 21 ▶use Sys::Hostname qw(hostname);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 21 ▶use FindBin qw($Bin);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 # Beside the module in a checkout, and under lib/perl5 when installed with
16 # INSTALL_BASE into a prefix that @INC does not reach on its own.
17 21 ▶use lib grep { -d } map { "$Bin/../$_" } qw(lib lib/perl5);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 # Kept apart from what the options become, so that the usage text goes on
20 # offering these however the programme was called.
21 my %default = (
22 'to' => $ENV{'DMARC_TEST_TO'} || 'test@example.org',
23 'from' => $ENV{'DMARC_TEST_FROM'} || 'alerts@example.org',
24 'domain' => $ENV{'DMARC_TEST_DOMAIN'} || 'example.org',
25 'selector' => $ENV{'DMARC_TEST_SELECTOR'} || 'selector1',
26 'sendmail' => $ENV{'SENDMAIL'} || '/usr/sbin/sendmail',
27 21 ▶ 'keyfile' => $ENV{'DKIM_KEYFILE'},
Condition50%5/10
$ENV{'DMARC_TEST_TO'} || 'test@example.org'
l!l
021
$ENV{'DMARC_TEST_FROM'} || 'alerts@example.org'
l!l
021
$ENV{'DMARC_TEST_DOMAIN'} || 'example.org'
l!l
021
$ENV{'DMARC_TEST_SELECTOR'} || 'selector1'
l!l
021
$ENV{'SENDMAIL'} || '/usr/sbin/sendmail'
l!l
021
MC/DC0%0/1
$ENV{'DMARC_TEST_TO'} || 'test@example.org'
$ENV{'DMARC_TEST_TO'}
MC/DC0%0/1
$ENV{'DMARC_TEST_FROM'} || 'alerts@example.org'
$ENV{'DMARC_TEST_FROM'}
MC/DC0%0/1
$ENV{'DMARC_TEST_DOMAIN'} || 'example.org'
$ENV{'DMARC_TEST_DOMAIN'}
MC/DC0%0/1
$ENV{'DMARC_TEST_SELECTOR'} || 'selector1'
$ENV{'DMARC_TEST_SELECTOR'}
MC/DC0%0/1
$ENV{'SENDMAIL'} || '/usr/sbin/sendmail'
$ENV{'SENDMAIL'}
Truth table50%1/2
A
A= $ENV{'DMARC_TEST_TO'}
Aresult
11
00
Truth table50%1/2
A
A= $ENV{'DMARC_TEST_FROM'}
Aresult
11
00
Truth table50%1/2
A
A= $ENV{'DMARC_TEST_DOMAIN'}
Aresult
11
00
Truth table50%1/2
A
A= $ENV{'DMARC_TEST_SELECTOR'}
Aresult
11
00
Truth table50%1/2
A
A= $ENV{'SENDMAIL'}
Aresult
11
00
28 );
29  
30 21 my %opt = (
31 %default,
32 'plain' => 0,
33 'dry-run' => 0,
34 'save' => undef,
35 );
36  
37 # Nothing that goes wrong once the options have been read is a usage error, and
38 # die() decides a status of its own - whatever errno was left over (2 for a
39 # directory that is not there, 13 for one that is not writable) or sendmail's
40 # own - which would hand out the 2 that means "the options were not usable".
41 # 1 is the status for having sent nothing, whichever failure it was.
42 sub fail
43 7 ▶{
Subroutine fail: called CC=1 SCAR=0.0
44 7 print STDERR @_;
45  
46 7 exit(1);
47 }
48  
49 GetOptions(
50 'to|t=s' => \$opt{'to'},
51 'from|f=s' => \$opt{'from'},
52 'domain=s' => \$opt{'domain'},
53 'selector=s' => \$opt{'selector'},
54 'keyfile|k=s' => \$opt{'keyfile'},
55 'sendmail=s' => \$opt{'sendmail'},
56 'plain' => \$opt{'plain'},
57 'dry-run|n' => \$opt{'dry-run'},
58 'save=s' => \$opt{'save'},
59 1 ▶ 'help|h' => sub { usage(0) },
Subroutine __ANON__: called CC=1 SCAR=0.0
60 21 ▶) or usage(2);
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions("to|t=s", \$opt{"to"}, "from|f=s", \$opt{"from"}, "domain=s", \$opt{"domain"}, "selector=s", \$opt{"selector"}, "keyfile|k=s", \$opt{"keyfile"}, "sendmail=s", \$opt{"sendmail"}, "plain", \$opt{"plain"}, "dry-run|n", \$opt{"dry-run"}, "save=s", \$opt{"save"}, "help|h", sub { usage(0); } ) or usage(2) 19 1 20
61  
62 19 ▶usage(2) unless($opt{'to'} && $opt{'from'});
Branch: 1 branch
BranchTrueFalseTotal
unless $opt{"to"} and $opt{"from"} 2 17 19
Condition100%3/3
$opt{"to"} and $opt{"from"}
!ll&&!rl&&r
1117
MC/DC100%2/2
$opt{"to"} and $opt{"from"}
$opt{"to"} $opt{"from"}
Truth table100%3/3
A and B
A= $opt{"to"}B= $opt{"from"}
ABresult
0X0
100
111
63 # Both addresses become headers, and --from is sendmail's envelope sender as
64 # well, so neither may hold a space or a control character - the shape of a
65 # header injection - or begin with a - that sendmail would read as an option.
66 17 ▶usage(2) if(unusable_address($opt{'to'}) || unusable_address($opt{'from'}));
Branch: 1 branch
BranchTrueFalseTotal
if unusable_address($opt{"to"}) or unusable_address($opt{"from"}) 5 12 17
Condition100%3/3
unusable_address($opt{"to"}) or unusable_address($opt{"from"})
l!l&&r!l&&!r
3212
MC/DC100%2/2
unusable_address($opt{"to"}) or unusable_address($opt{"from"})
unusable_address($opt{"to"}) unusable_address($opt{"from"})
Truth table100%3/3
A or B
A= unusable_address($opt{"to"})B= unusable_address($opt{"from"})
ABresult
1X1
011
000
67  
68 12 my $host = hostname();
69 12 my $token = sprintf('%s-%d', $host, time());
70 12 my @then = localtime();
71 12 my $now = strftime('%Y-%m-%d %H:%M:%S %z', @then);
72 # The Date: header has the form RFC 5322 gives, with English names whatever
73 # the locale is.
74 12 my $date = sprintf('%s, %02d %s %04d %02d:%02d:%02d %s',
75 (qw(Sun Mon Tue Wed Thu Fri Sat))[$then[6]], $then[3],
76 (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$then[4]], $then[5] + 1900,
77 @then[2, 1, 0], strftime('%z', @then));
78  
79 # Sending unsigned from the signing path is a mistake worth stopping: the
80 # whole point is to see a signature arrive. --plain asks for it deliberately.
81 12 my ($keyfile, $mailer);
82 12 ▶if($opt{'plain'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{'plain'}) { } 8 4 12
83 8 $mailer = 'sendmail(1), unsigned';
84 } else {
85 4 ▶ $keyfile = $opt{'keyfile'} || find_keyfile();
Condition100%3/3
$opt{'keyfile'} || find_keyfile()
l!l&&r!l&&!r
211
MC/DC100%2/2
$opt{'keyfile'} || find_keyfile()
$opt{'keyfile'} find_keyfile()
Truth table100%3/3
A || B
A= $opt{'keyfile'}B= find_keyfile()
ABresult
1X1
011
000
86 4 ▶ if(!$keyfile) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($keyfile) 1 3 4
87 1 my @candidates = candidate_keys();
88 1 ▶ fail "No DKIM key found: name one with --keyfile or set DKIM_KEYFILE.\n"
Branch: 1 branch
BranchTrueFalseTotal
@candidates ? : 0 1 1
89 . (@candidates ? 'Looked at: ' . join(', ', @candidates) . "\n" : '')
90 . "Use --plain to send unsigned on purpose.\n";
91 }
92 3 ▶ fail "Cannot read $keyfile\n" unless(-r $keyfile);
Branch: 1 branch
BranchTrueFalseTotal
unless -r $keyfile 1 2 3
93 # Loaded here rather than with use, so that --plain still works on a host
94 # without Mail::DKIM: sending unsigned is exactly what it is for there.
95 fail "Mail::DKIM is not installed for $^X, so nothing can be signed.\n"
96 . "Install it, or use --plain to send unsigned on purpose.\n"
97 2 ▶ unless(eval { require Mail::DKIM::Signer; require Mail::Send::DKIM; 1 });
Branch: 1 branch
BranchTrueFalseTotal
unless eval { do { require Mail::DKIM::Signer; require Mail::Send::DKIM; 1 } } 0 2 2
98 2 $mailer = "Mail::Send::DKIM, signed with d=$opt{'domain'} s=$opt{'selector'}";
99 }
100  
101 10 my $subject = "DKIM check from $host at $now";
102 10 my $body = <<"BODY";
103 This is a test message from $host at $now.
104  
105 It was sent by $mailer.
106  
107 Its only purpose is to show, in the headers at the far end, whether mail from
108 this host authenticates. The token below is unique to this run, so the message
109 can be found again among others:
110  
111 $token
112  
113 Nothing replies to it and nothing depends on it.
114 BODY
115  
116 10 my $message = join('',
117 "From: $opt{'from'}\n",
118 "To: $opt{'to'}\n",
119 "Subject: $subject\n",
120 "Date: $date\n",
121 "Message-ID: <$token\@$host>\n",
122 "MIME-Version: 1.0\n",
123 "Content-Type: text/plain; charset=utf-8\n",
124 "Content-Transfer-Encoding: 8bit\n",
125 "\n",
126 $body,
127 );
128  
129 # Sign first, then decide what to do with the result, so that what is printed,
130 # saved and sent are the same bytes - and so that a rehearsal exercises the
131 # signing rather than pretending to.
132 10 ▶my $wire = $opt{'plain'} ? $message : sign($message);
Branch: 1 branch
BranchTrueFalseTotal
$opt{'plain'} ? : 8 2 10
133  
134 10 ▶if($opt{'save'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{"save"}) 2 8 10
135 2 ▶ open(my $fh, '>', $opt{'save'}) or fail "Cannot write $opt{'save'}: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $opt{"save"} or fail(qq[Cannot write $opt{"save"}: $!\n]) 1 1 2
136 1 print $fh $wire;
137 1 ▶ close($fh) or fail "Cannot close $opt{'save'}: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or fail(qq[Cannot close $opt{"save"}: $!\n]) 1 0 1
138 1 print "Message as sent is in $opt{'save'}\n\n";
139 }
140  
141 9 ▶if($opt{'dry-run'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{"dry-run"}) 4 5 9
142 4 print $wire;
143 4 print "\n--- nothing was sent; run again without --dry-run ---\n";
144 4 exit(0);
145 }
146  
147 # A sendmail that leaves before reading the message must be a failure that is
148 # reported, not a SIGPIPE. A handler, so that sendmail does not inherit it.
149 5 ▶local $SIG{'PIPE'} = sub { };
Subroutine __ANON__: called CC=1 SCAR=0.0
150  
151 5 ▶open(my $sendmail, '|-', $opt{'sendmail'}, '-t', '-f', $opt{'from'})
Branch: 1 branch
BranchTrueFalseTotal
open my $sendmail, "|-", $opt{"sendmail"}, "-t", "-f", $opt{"from"} or fail(qq[Cannot run $opt{"sendmail"}: $!\n]) 4 1 5
152 or fail "Cannot run $opt{'sendmail'}: $!\n";
153 4 $sendmail->autoflush(1);
154 4 my $written = print {$sendmail} $wire;
155 4 ▶unless(close($sendmail) && $written) {
Branch: 1 branch
BranchTrueFalseTotal
unless (close $sendmail and $written) 3 1 4
Condition66%2/3
close $sendmail and $written
!ll&&!rl&&r
301
MC/DC50%1/2
close $sendmail and $written
close $sendmail $written
Truth table66%2/3
A and B
A= close $sendmailB= $written
ABresult
0X0
100
111
156 3 fail "sendmail reported a failure; the message was not delivered.\n";
157 }
158  
159 1 print "Sent to $opt{'to'} as $opt{'from'}\n";
160 1 print " via : $mailer\n";
161 1 print " token : $token\n\n";
162 1 print "In the mailbox, open that message and choose \"Show original\". You want:\n";
163 1 print " SPF: pass (ip= the sending host)\n";
164 1 print " DKIM: pass (domain=$opt{'domain'}, selector=$opt{'selector'})\n";
165 1 print " DMARC: pass\n\n";
166 1 print "If DKIM is missing, nothing downstream can pass: check that the key is\n";
167 1 print "the one published at $opt{'selector'}._domainkey.$opt{'domain'}, and that\n";
168 1 print "Mail::DKIM is installed for $^X.\n";
169  
170 1 exit(0);
171  
172 # One signing implementation for the repository: Mail::Send::DKIM, which is
173 # what bin/mail-dkim uses, so what this sends is what the site's mail looks
174 # like. The message's own From: domain is allowed as well as --domain, so a
175 # test sent as a different address than the one being signed for still signs.
176 sub sign
177 2 ▶{
Subroutine sign: called CC=2 SCAR=7.2
178 2 my $message = shift;
179  
180 2 require Mail::Send::DKIM;
181  
182 my $dkim = Mail::Send::DKIM->new(
183 'domains' => [$opt{'domain'}, Mail::Send::DKIM::from_domain($message)],
184 'keyfile' => $keyfile,
185 2 'selector' => $opt{'selector'},
186 );
187  
188 2 my $signed = $dkim->sign($message);
189 2 ▶ return $signed if(defined($signed));
Branch: 1 branch
BranchTrueFalseTotal
if defined $signed 2 0 2
190  
191 # The module has already said what went wrong on standard error; this adds
192 # what the tester knows and it does not: which key was meant.
193 0 fail "Cannot sign with $keyfile.\n"
194 . "Check that it is the key published at $opt{'selector'}._domainkey.$opt{'domain'}.\n";
195 }
196  
197 # The site's key is wherever the site keeps it; these are the places it has
198 # lived, so the common case needs no argument.
199 sub candidate_keys
200 3 ▶{
Subroutine candidate_keys: called CC=8 SCAR=21.3
201 9 ▶ my @dirs = grep { defined } (
Branch: 3 branches
BranchTrueFalseTotal
$ENV{'HOME'} ? : 3 0 3
$ENV{'HOME'} ? : 3 0 3
$ENV{'HOME'} ? : 3 0 3
202 $ENV{'HOME'} ? File::Spec->catdir($ENV{'HOME'}, 'dkim') : undef,
203 $ENV{'HOME'} ? File::Spec->catdir($ENV{'HOME'}, '.dkim') : undef,
204 3 $ENV{'HOME'} ? File::Spec->catdir($ENV{'HOME'}, 'lib', 'dkim') : undef,
205 );
206  
207 3 my @keys;
208 3 foreach my $dir (@dirs) {
209 9 ▶ next unless(-d $dir);
Branch: 1 branch
BranchTrueFalseTotal
unless -d $dir 8 1 9
210 21 ▶ foreach my $name (glob(File::Spec->catfile($dir, '*'))) {
Subroutine BEGIN: called CC=1 SCAR=0.0
211 1 ▶ next unless($name =~ /\.(?:private|key|pem)\z/);
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /\.(?:private|key|pem)\z/ 0 1 1
212 1 push @keys, $name;
213 }
214 }
215  
216 3 return @keys;
217 }
218  
219 sub find_keyfile
220 2 ▶{
Subroutine find_keyfile: called CC=4 SCAR=15.8
221 2 foreach my $key (candidate_keys()) {
222 # A directory can hold keys for several domains; the selector names
223 # the one this message must be signed with.
224 1 ▶ return $key if($key =~ /\Q$opt{'selector'}\E/ || $key =~ /\Q$opt{'domain'}\E/);
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /\Q$opt{"selector"}\E/ or $key =~ /\Q$opt{"domain"}\E/ 1 0 1
Condition33%1/3
$key =~ /\Q$opt{"selector"}\E/ or $key =~ /\Q$opt{"domain"}\E/
l!l&&r!l&&!r
100
MC/DC0%0/2
$key =~ /\Q$opt{"selector"}\E/ or $key =~ /\Q$opt{"domain"}\E/
$key =~ /\Q$opt{"selector"}\E/ $key =~ /\Q$opt{"domain"}\E/
Truth table33%1/3
A or B
A= $key =~ /\Q$opt{"selector"}\E/B= $key =~ /\Q$opt{"domain"}\E/
ABresult
1X1
011
000
225 }
226  
227 1 return undef;
228 }
229  
230 # An address that cannot be written into a header as it stands, and that would
231 # be read as an option by sendmail if it began with a dash.
232 sub unusable_address
233 31 ▶{
Subroutine unusable_address: called CC=3 SCAR=11.0
234 31 my $address = shift;
235  
236 31 ▶ return 1 if($address =~ /[\x00-\x20\x7f]/);
Branch: 1 branch
BranchTrueFalseTotal
if $address =~ /[\x00-\x20\x7f]/ 3 28 31
237 28 ▶ return 1 if($address =~ /\A-/);
Branch: 1 branch
BranchTrueFalseTotal
if $address =~ /\A-/ 2 26 28
238  
239 26 return 0;
240 }
241  
242 sub usage
243 9 ▶{
Subroutine usage: called CC=2 SCAR=7.1
244 9 ▶ my $status = shift // 0;
Condition50%1/2
shift() // 0
l!l
90
MC/DC0%0/1
shift() // 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
245  
246 9 print <<"USAGE";
247 $0 - send one test message from this host, so its authentication can be read
248  
249 Usage:
250 $0 [options]
251  
252 --to ADDR where to send it (default $default{'to'})
253 --from ADDR envelope and header From (default $default{'from'})
254 --domain DOMAIN the domain to sign for (default $default{'domain'})
255 --selector SEL the DKIM selector (default $default{'selector'})
256 --keyfile FILE the DKIM private key (default: found under ~/dkim)
257 --plain send unsigned via sendmail(1), the way cron does
258 --dry-run sign the message, print it, send nothing
259 --save FILE also write the message, as it is sent, to FILE
260 --sendmail PATH sendmail to use (default $default{'sendmail'})
261 --help this text
262  
263 Sent through Mail::Send::DKIM, the signer bin/mail-dkim uses, so that what
264 arrives is what the site's mail actually looks like.
265 USAGE
266  
267 9 exit($status);
268 }
269  
270 =pod
271  
272 =head1 NAME
273  
274 dmarc-check-mail.pl - send one test message from this host, so its authentication can be read
275  
276 =head1 SYNOPSIS
277  
278 dmarc-check-mail.pl
279  
280 dmarc-check-mail.pl --plain
281  
282 dmarc-check-mail.pl --keyfile ~/dkim/selector1.private --domain example.org
283  
284 =head1 DESCRIPTION
285  
286 Sends one message through sendmail(1) to a mailbox that can be read, and says
287 what the C<Authentication-Results> header at the far end should contain. The
288 message is signed with L<Mail::Send::DKIM>, the signer C<mail-dkim> uses, so
289 that what arrives is what this site's mail really looks like, rather than a test
290 of a signing path nothing else uses. C<--plain> sends the same message
291 unsigned, which is what a cron job without the module looks like, so that both
292 can be compared in the same mailbox.
293  
294 The subject and body carry a token made of the host name and the time, so that
295 the message can be found again among others.
296  
297 =head1 OPTIONS
298  
299 =over 4
300  
301 =item B<--to> ADDR (C<-t>)
302  
303 Where to send it. Default C<DMARC_TEST_TO>, or C<test@example.org>. It is
304 written into the message's C<To:> header, so an address holding a space or a
305 control character, or beginning with a C<->, is refused, as C<--from> is.
306  
307 =item B<--from> ADDR (C<-f>)
308  
309 The envelope sender and the header C<From:>. Default C<DMARC_TEST_FROM>, or
310 C<alerts@example.org>. An address holding a space or a control character, or
311 beginning with a C<->, is refused.
312  
313 =item B<--domain> DOMAIN
314  
315 The domain to sign for. Default C<DMARC_TEST_DOMAIN>, or C<example.org>. The
316 domain in the message's own C<From:> is signed for as well, so that a test sent
317 as an address from the domain being signed for still signs.
318  
319 =item B<--selector> SEL
320  
321 The selector to sign with. Default C<DMARC_TEST_SELECTOR>, or C<selector1>. It
322 also chooses the key when C<--keyfile> is not given.
323  
324 =item B<--keyfile> FILE (C<-k>)
325  
326 The private key. Default C<DKIM_KEYFILE>, or the first file under C<~/dkim>,
327 C<~/.dkim> or C<~/lib/dkim> named C<*.private>, C<*.key> or C<*.pem> whose name
328 holds the selector or the domain.
329  
330 =item B<--plain>
331  
332 Send the message unsigned, through sendmail(1) alone, which is what cron does.
333 No key is looked for and Mail::DKIM need not be installed, so this still works
334 on a host that cannot sign at all.
335  
336 =item B<--dry-run> (C<-n>)
337  
338 Sign the message, print it, and send nothing.
339  
340 =item B<--save> FILE
341  
342 Also write the message, as it is sent, to FILE.
343  
344 =item B<--sendmail> PATH
345  
346 The sendmail the message is handed to. Default C<SENDMAIL>, or
347 C</usr/sbin/sendmail>.
348  
349 =item B<--help> (C<-h>)
350  
351 Print the usage summary and exit 0.
352  
353 =back
354  
355 Each default above is set by the variable named with it, and nothing else is
356 read.
357  
358 =head1 ENVIRONMENT
359  
360 =over 4
361  
362 =item C<DMARC_TEST_TO>
363  
364 The default for C<--to>.
365  
366 =item C<DMARC_TEST_FROM>
367  
368 The default for C<--from>.
369  
370 =item C<DMARC_TEST_DOMAIN>
371  
372 The default for C<--domain>.
373  
374 =item C<DMARC_TEST_SELECTOR>
375  
376 The default for C<--selector>, which also chooses the key.
377  
378 =item C<SENDMAIL>
379  
380 The default for C<--sendmail>.
381  
382 =item C<DKIM_KEYFILE>
383  
384 The key, when C<--keyfile> is not given.
385  
386 =item C<HOME>
387  
388 Where the key is looked for when neither is given: C<~/dkim>, C<~/.dkim> and
389 C<~/lib/dkim>.
390  
391 =back
392  
393 =head1 EXIT STATUS
394  
395 C<0> when the message was handed to sendmail, printed by C<--dry-run>, or
396 C<--help> was asked for - and the first two do not mean it arrived, or that it
397 authenticated: that is what the headers at the far end say. C<1> when nothing
398 was sent: no key was found, the key could not be read, Mail::DKIM is not
399 installed for this perl, C<--save> could not be written, or sendmail could not
400 be run or reported a failure. Standard error says which. C<2> when the
401 options were not usable - an unknown option, no C<--to> or C<--from>, or a
402 C<--to> or C<--from> that cannot be an address - so nothing was signed or sent,
403 and no transport was asked to do anything. C<2> never means that a message was
404 attempted and failed.
405  
406 =head1 SEE ALSO
407  
408 L<Mail::Send::DKIM>, the signer, and C<mail-dkim>, the sendmail front end that
409 C<dmarc-weekly.sh> sends its alerts through.
410  
411 =head1 AUTHOR
412  
413 Nigel Horne, C<< <njh at nigelhorne.com> >>
414  
415 =head1 LICENCE
416  
417 Copyright 2026 Nigel Horne.
418  
419 GNU General Public License, version 2, as in the F<LICENSE> file.
420  
421 =cut
« bin/dmarc-report.pl ↑ Summary bin/mail-dkim »