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.)
This commit is contained in:
Matt Simerson 2013-04-21 12:15:14 -04:00
parent 8122fcfb27
commit 278399f1ad

View File

@ -418,7 +418,8 @@ sub get_keydir {
shift @labels; # remove the first label (ie: www) shift @labels; # remove the first label (ie: www)
my $zone = join '.', @labels; # reassemble the labels my $zone = join '.', @labels; # reassemble the labels
if (-e "config/dkim/$zone") { # if the directory exists 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"); $self->log(LOGINFO, "info, using $zone key for $domain");
} }
} }
@ -451,6 +452,7 @@ sub save_signatures_to_note {
foreach my $sig ($dkim->signatures) { foreach my $sig ($dkim->signatures) {
next if $sig->result ne 'pass'; next if $sig->result ne 'pass';
my $doms = $self->connection->notes('dkim_pass_domains') || []; my $doms = $self->connection->notes('dkim_pass_domains') || [];
next if grep /$sig->domain/, @$doms; # already in the list
push @$doms, $sig->domain; push @$doms, $sig->domain;
$self->connection->notes('dkim_pass_domains', $doms); $self->connection->notes('dkim_pass_domains', $doms);
$self->log(LOGINFO, "info, added " . $sig->domain); $self->log(LOGINFO, "info, added " . $sig->domain);
@ -515,7 +517,7 @@ sub get_selector {
my $selector = <$SFH>; my $selector = <$SFH>;
chomp $selector; chomp $selector;
close $SFH; close $SFH;
$self->log(LOGINFO, "info, selector: $selector"); $self->log(LOGDEBUG, "info, selector: $selector");
return $selector; return $selector;
} }