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,6 +418,7 @@ 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
$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;
}