From 278399f1ad17c52bee28c6b69325281b45bbfef7 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sun, 21 Apr 2013 12:15:14 -0400 Subject: [PATCH] dkim: when signing, use signing domain when we finding the signing key in a different directory than the sending (eg: example.com instead of www.example.com.) --- plugins/dkim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/dkim b/plugins/dkim index 39c6759..dbef7a7 100644 --- a/plugins/dkim +++ b/plugins/dkim @@ -418,7 +418,8 @@ sub get_keydir { shift @labels; # remove the first label (ie: www) my $zone = join '.', @labels; # reassemble the labels if (-e "config/dkim/$zone") { # if the directory exists - $dir = "config/dkim/$zone"; # use the parent domain's key + $domain = $zone; # the DKIM signing domain + $dir = "config/dkim/$zone"; # use the parent domain's key $self->log(LOGINFO, "info, using $zone key for $domain"); } } @@ -451,6 +452,7 @@ sub save_signatures_to_note { foreach my $sig ($dkim->signatures) { next if $sig->result ne 'pass'; my $doms = $self->connection->notes('dkim_pass_domains') || []; + next if grep /$sig->domain/, @$doms; # already in the list push @$doms, $sig->domain; $self->connection->notes('dkim_pass_domains', $doms); $self->log(LOGINFO, "info, added " . $sig->domain); @@ -515,7 +517,7 @@ sub get_selector { my $selector = <$SFH>; chomp $selector; close $SFH; - $self->log(LOGINFO, "info, selector: $selector"); + $self->log(LOGDEBUG, "info, selector: $selector"); return $selector; }