Randy Candy
2018-02-23 03:16:40 UTC
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, "<INPUTMSG")) {
while(<TOSIGN>) {
# remove local line terminators
chomp;
s/\015$//;
# use SMTP line terminators
$dkim->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 ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/m
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, "<INPUTMSG")) {
while(<TOSIGN>) {
# remove local line terminators
chomp;
s/\015$//;
# use SMTP line terminators
$dkim->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 ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/m