Re: [Mimedefang] DKIM and boilerplate conflict

2018-02-24 Thread Randy Candy
Thank you Dianne so much for the information as I was looking at an older 
version of the man page which only had four steps in the calling sequence. 
Thanks to you and all who have helped develop such an elegant framework.

-Randy
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] DKIM and boilerplate conflict

2018-02-23 Thread Richard Laager
On 02/22/2018 09:16 PM, Randy Candy wrote:
>     my $signature = $dkim->signature()->as_string();
>     $signature =~ s/^DKIM-Signature:\s+//i;
>     action_add_header('DKIM-Signature', $signature);

On a related note... I just implement DKIM signing a few days ago, and I
got broken messages until I stripped the CRs from the signature. See the
third line below:

my $signature = $dkim->signature()->as_string();
$signature =~ s/^DKIM-Signature:\s+//i;
$signature =~ s/\015//g;
action_add_header('DKIM-Signature', $signature);

-- 
Richard
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] DKIM and boilerplate conflict

2018-02-23 Thread Dianne Skoll
On Fri, 23 Feb 2018 04:16:40 +0100
"Randy Candy"  wrote:

> I have implemented the following subroutine dkim_sign (listed below)
> and call it from filter_end after I verify that specific criteria are
> met. Prior to calling dkim_sign I utilize append_text_boilerplate
> and then call action_rebuild. My question is how do I pass the email
> with boilerplate to dkim_sign?

You need to do the DKIM signing in filter_wrapup, a filter callback function
introduced in MIMEDefang version 2.76.  It gets passed the final MIME::Entity
with all your modifications.  You need to write this out to a temporary file
and use that file (not INPUTMSG) as the input for DKIM signing.
Use $entity->stringify() to get the message that you need to sign.

Regards,

Dianne.
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


[Mimedefang] DKIM and boilerplate conflict

2018-02-22 Thread Randy Candy
Hello,
 
I have implemented the following subroutine dkim_sign (listed below) and call 
it from filter_end after I verify that specific criteria are met.  Prior to 
calling dkim_sign I utilize append_text_boilerplate and then call 
action_rebuild. 
 
My question is how do I pass the email with boilerplate to dkim_sign? 
 
This subroutine dkim_sign utilizes INPUTMSG but that is a copy of the entire 
message as received by Sendmail prior to any boilerplate or action* functions 
being called.  I see under the $CWD/Working dir the INPUTMBOX and msg-409-1.txt.
 
Any advice could be greatly appreciated.
 
 

sub dkim_sign
{
    my $dkim = Mail::DKIM::Signer->new(
    Algorithm => "rsa-sha1",
    Method => "relaxed",
    Domain => "roaringpenguin.com",
    Selector => "beta",
    KeyFile => "/etc/ssl/private/roaringpenguin.com.dkim.key");
    if (open(TOSIGN, "PRINT("$_\015\012");
    }
    close(TOSIGN);
    $dkim->CLOSE();
    my $signature = $dkim->signature()->as_string();
    $signature =~ s/^DKIM-Signature:\s+//i;
    action_add_header('DKIM-Signature', $signature);
    }
}
 
-Randy

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang