[Mimedefang] What about DKIM
David F. Skoll
dfs at roaringpenguin.com
Thu May 9 17:30:45 EDT 2013
On Thu, 9 May 2013 12:14:40 -0600
Philip Prindeville <philipp_subx at redfish-solutions.com> wrote:
> And DKIM support for verification is in SpamAssassin, but I'm not
> seeing any support for signing in MimeDefang.
It is very easy to add. Use the Mail::DKIM::Signer and Mail::DKIM::TextWrap
modules from CPAN. This is in our filter and we call it to sign a message
from filter_end:
sub dkim_sign
{
my $dkim = Mail::DKIM::Signer->new(
Algorithm => "rsa-sha1",
Method => "relaxed",
Domain => "roaringpenguin.com",
Selector => "main",
KeyFile => "/etc/ssl/private/roaringpenguin.com.dkim.2048.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);
}
}
Regards,
David.
More information about the MIMEDefang
mailing list