You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Benny Pedersen <me...@junc.eu> on 2019/12/03 08:56:58 UTC

spamassassin dkim says invalid

while this simple perl gives pass

# verify a message
use Mail::DKIM::Verifier;

# create a verifier object
my $dkim = Mail::DKIM::Verifier->new();

# read an email from stdin, pass it into the verifier
while (<STDIN>)
{
     # remove local line terminators
     chomp;
     s/\015$//;

     # use SMTP line terminators
     $dkim->PRINT("$_\015\012");
}
$dkim->CLOSE;

# what is the result of the verify?
# my $result = $dkim->result;

print $dkim->result;


# how to use
cat email | above.pl

known problem ?

Re: spamassassin dkim says invalid

Posted by Henrik K <he...@hege.li>.
On Tue, Dec 03, 2019 at 09:56:58AM +0100, Benny Pedersen wrote:
> 
> while this simple perl gives pass
> 
> # how to use
> cat email | above.pl
> 
> known problem ?

Impossible to know without SA version and sample message?


Re: spamassassin dkim says invalid

Posted by Henrik K <he...@hege.li>.
On Tue, Dec 03, 2019 at 11:42:21AM +0100, Benny Pedersen wrote:
> On 2019-12-03 10:26, Henrik K wrote:
> 
> >Tried with 3.4.2, 3.4.3, trunk, all result in DKIM_VALID
> >$ spamassassin -t -D dkim < benny.eml
> 
> good
> 
> >$ perl -MMail::DKIM::Verifier -e 'print $Mail::DKIM::Verifier::VERSION'
> >0.53
> 
> maked gentoo ebuild for 0.58 solved it for me :=)
> 
> in 3.4.3 set minimal version to 0.53, gentoo is still on 0.4
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91c3d08c8746b941b4f3c6e60faa213d0350b864

I downgraded 0.44, 0.41 and even 0.40, they all work flawlessly here.

You probably upgraded some dependency module at the same time, I wonder what?


Re: spamassassin dkim says invalid

Posted by Benny Pedersen <me...@mx.junc.eu>.
On 2019-12-03 10:26, Henrik K wrote:

> Tried with 3.4.2, 3.4.3, trunk, all result in DKIM_VALID
> $ spamassassin -t -D dkim < benny.eml

good

> $ perl -MMail::DKIM::Verifier -e 'print $Mail::DKIM::Verifier::VERSION'
> 0.53

maked gentoo ebuild for 0.58 solved it for me :=)

in 3.4.3 set minimal version to 0.53, gentoo is still on 0.4

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91c3d08c8746b941b4f3c6e60faa213d0350b864

Re: spamassassin dkim says invalid

Posted by Henrik K <he...@hege.li>.
On Tue, Dec 03, 2019 at 10:17:23AM +0100, Benny Pedersen wrote:
> On 2019-12-03 10:10, Henrik K wrote:
> 
> >Anyway, that code is not identical to SA, which goes like this in 3.4:
> >
> >my $msg = do { local $/; <STDIN> }; # Slurp
> >$msg =~ s/\012/\015\012/gs;
> >$dkim->PRINT($msg);
> >
> >Your code would break with missing line terminator at message end I think.
> 
> https://metacpan.org/pod/Mail::DKIM sample perl code here there
> 
> i have sent in private sample that gives sa dkim invalid
> 
> and i use 3.4.2 on gentoo still, Mail-DKIM could be updated on gentoo but if
> thats the problem the sample perl code would aswell say invalid

No problem here

$ sha1sum benny.eml
51679607db739807aa353986b537400848ab454b  benny.eml

Tried with 3.4.2, 3.4.3, trunk, all result in DKIM_VALID
$ spamassassin -t -D dkim < benny.eml

$ perl -MMail::DKIM::Verifier -e 'print $Mail::DKIM::Verifier::VERSION'
0.53


Re: spamassassin dkim says invalid

Posted by Benny Pedersen <me...@mx.junc.eu>.
On 2019-12-03 10:10, Henrik K wrote:

> Anyway, that code is not identical to SA, which goes like this in 3.4:
> 
> my $msg = do { local $/; <STDIN> }; # Slurp
> $msg =~ s/\012/\015\012/gs;
> $dkim->PRINT($msg);
> 
> Your code would break with missing line terminator at message end I 
> think.

https://metacpan.org/pod/Mail::DKIM sample perl code here there

i have sent in private sample that gives sa dkim invalid

and i use 3.4.2 on gentoo still, Mail-DKIM could be updated on gentoo 
but if thats the problem the sample perl code would aswell say invalid


Re: spamassassin dkim says invalid

Posted by Henrik K <he...@hege.li>.
On Tue, Dec 03, 2019 at 09:56:58AM +0100, Benny Pedersen wrote:
> 
> # read an email from stdin, pass it into the verifier
> while (<STDIN>)
> {
>     # remove local line terminators
>     chomp;
>     s/\015$//;
> 
>     # use SMTP line terminators
>     $dkim->PRINT("$_\015\012");
> }

Anyway, that code is not identical to SA, which goes like this in 3.4:

my $msg = do { local $/; <STDIN> }; # Slurp
$msg =~ s/\012/\015\012/gs;
$dkim->PRINT($msg);

Your code would break with missing line terminator at message end I think.