"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/arcverify.pl" between
Mail-DKIM-1.20220408.tar.gz and Mail-DKIM-1.20220520.tar.gz

About: Mail-DKIM Perl module for implementing the DKIM (DomainKeys Identified Mail) message-signing and verifying standard for Internet mail.

arcverify.pl  (Mail-DKIM-1.20220408):arcverify.pl  (Mail-DKIM-1.20220520)
skipping to change at line 16 skipping to change at line 16
# GNU Public License as found at http://www.fsf.org/copyleft/gpl.html. # GNU Public License as found at http://www.fsf.org/copyleft/gpl.html.
# #
# Written by Jason Long, jlong@messiah.edu. # Written by Jason Long, jlong@messiah.edu.
use strict; use strict;
use warnings; use warnings;
use Mail::DKIM::ARC::Verifier; use Mail::DKIM::ARC::Verifier;
use Net::DNS::Resolver::Mock; use Net::DNS::Resolver::Mock;
use Mail::DKIM; use Mail::DKIM;
use Getopt::Long; use Getopt::Long::Descriptive;
use Pod::Usage; use Pod::Usage;
my ($as_canonicalization, $ams_canonicalization);
my ($details, $dns, $help);
my $FakeResolver; my $FakeResolver;
GetOptions( my ($opt, $usage) = describe_options(
"as-canonicalization=s" => \$as_canonicalization, "%c %o < original_email.txt",
"ams-canonicalization=s" => \$ams_canonicalization, [ "as-canonicalization=s" => "Output canonicalized message to file for ARC-Sea
"dns=s" => \$dns, l debugging" ],
"details" => \$details, [ "ams-canonicalization=s" => "Output canonicalized message to file for ARC-Me
"help" => \$help, ssage-Signature debugging" ],
) [ "dns=s" => "Use DNS records from this file rather than using real DNS" ],
or pod2usage(2); [ "details" => "Show details of ARC evaluation" ],
pod2usage(1) if $help or @ARGV > 0; [ "help|?" => "Show help" ],
{show_defaults=>1},
);
if ($opt->help) {
print $usage->text;
exit 1;
}
my ($asfh, $amsfh); my ($asfh, $amsfh);
if (defined $as_canonicalization) if (defined $opt->as_canonicalization)
{ {
open $asfh, ">", $as_canonicalization open $asfh, ">", $opt->as_canonicalization
or die "Error: cannot write to $as_canonicalization: $!\n"; or die "Error: cannot write to ".$opt->as_canonicalization.": $!\
n";
} }
if (defined $ams_canonicalization) if (defined $opt->ams_canonicalization)
{ {
open $amsfh, ">", $ams_canonicalization open $amsfh, ">", $opt->ams_canonicalization
or die "Error: cannot write to $ams_canonicalization: $!\n"; or die "Error: cannot write to ".$opt->ams_canonicalization.": $!
\n";
} }
# use fake DNS records # use fake DNS records
if($dns) { if($opt->dns) {
open(DNSR, "<$dns") or die "cannot open $dns"; open(DNSR, "<", $opt->dns) or die "cannot open ".$opt->dns;
my $dnsrecs = join("", <DNSR>); my $dnsrecs = join("", <DNSR>);
close DNSR; close DNSR;
$FakeResolver = Net::DNS::Resolver::Mock->new(); $FakeResolver = Net::DNS::Resolver::Mock->new();
$FakeResolver->zonefile_parse( $dnsrecs ); $FakeResolver->zonefile_parse( $dnsrecs );
} else { } else {
# recommended, but may cause compatibility problems with old firewalls # recommended, but may cause compatibility problems with old firewalls
Mail::DKIM::DNS::enable_EDNS0; Mail::DKIM::DNS::enable_EDNS0;
} }
skipping to change at line 72 skipping to change at line 75
); );
Mail::DKIM::DNS::resolver( $FakeResolver ) if $FakeResolver; Mail::DKIM::DNS::resolver( $FakeResolver ) if $FakeResolver;
my $msg = join("", <STDIN>); my $msg = join("", <STDIN>);
$msg =~ s/\015?\012/\015\012/g; $msg =~ s/\015?\012/\015\012/g;
$arc->PRINT($msg); $arc->PRINT($msg);
$arc->CLOSE; $arc->CLOSE;
print "RESULT: " . $arc->result . "\n"; print "RESULT: " . $arc->result . "\n";
if($details) { if($opt->details) {
printf "DETAILS: %s\nRESULTS: %s\n", $arc->{details}, $arc->result_detail ; printf "DETAILS: %s\nRESULTS: %s\n", $arc->{details}, $arc->result_detail ;
my @sigs = @{$arc->{signatures}}; my @sigs = @{$arc->{signatures}};
foreach my $s (@sigs) { foreach my $s (@sigs) {
printf "SIG: %s by %s result %s\n", $s->domain , ref($s), $s->res ult || ""; printf "SIG: %s by %s result %s\n", $s->domain , ref($s), $s->res ult || "";
} }
my @algs = @{$arc->{algorithms}}; my @algs = @{$arc->{algorithms}};
skipping to change at line 106 skipping to change at line 109
arcverify.pl [options] < signed_email.txt arcverify.pl [options] < signed_email.txt
options: options:
--as-canonicalization=FILE --as-canonicalization=FILE
--ams-canonicalization=FILE --ams-canonicalization=FILE
--dns=FILE --dns=FILE
--details --details
arcverify.pl --help arcverify.pl --help
to see a full description of the various options to see a full description of the various options
=head1 OPTIONS
=over
=item B<--as-canonicalization>
=item B<--ams-canonicalization>
Outputs the canonicalized message used for the ARC-Seal or ARC-Message-Signature
to the specified file, in addition
to computing the ARC signature. This is helpful for debugging
canonicalization methods.
=item B<--details>
Print details of ARC evaluation.
=item B<--dnsrecords=FILE>
Use DNS records from that file rather than the real DNS.
=back
=head1 AUTHOR =head1 AUTHOR
Jason Long, E<lt>jlong@messiah.eduE<gt> Jason Long, E<lt>jlong@messiah.eduE<gt>
John Levine, E<lt>john.levine@standcore.comE<gt> John Levine, E<lt>john.levine@standcore.comE<gt>
Marc Bradshaw, E<lt>marc@marcbradshaw.netE<gt>
=head1 COPYRIGHT AND LICENSE =head1 COPYRIGHT AND LICENSE
Copyright (C) 2006-2007 by Messiah College Copyright (C) 2006-2007 by Messiah College
Copyright 2017 by Standcore LLC Copyright 2017 by Standcore LLC
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or, it under the same terms as Perl itself, either Perl version 5.8.6 or,
at your option, any later version of Perl 5 you may have available. at your option, any later version of Perl 5 you may have available.
=cut =cut
 End of changes. 11 change blocks. 
43 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)