When the DKIMSign module fails to determine the domain for signing
(the one added to the header and used for retrieving the publickey record)
the code logs that no signing will take place, but only does not set the
domain - resulting in a generated and added signature with domain 'example.com'
Fixed by returning the success-status from signing_domain and only signing if
it was successful.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
if ($self->{sign_all}) {
$self->domain($input_domain) if $self->{sign_all};
if ($self->{sign_all}) {
$self->domain($input_domain) if $self->{sign_all};
}
# check that input_domain is in/a subdomain of in the
}
# check that input_domain is in/a subdomain of in the
foreach my $domain (sort keys %$dkimdomains) {
if ( $input_domain =~ /\Q$domain\E$/i ) {
$self->domain($domain);
foreach my $domain (sort keys %$dkimdomains) {
if ( $input_domain =~ /\Q$domain\E$/i ) {
$self->domain($domain);
}
}
syslog('info', "not DKIM signing mail from $sender_email");
}
}
syslog('info', "not DKIM signing mail from $sender_email");
my $signer = __PACKAGE__->new($selector, $sign_all);
$signer->extended_headers($extended_headers);
my $signer = __PACKAGE__->new($selector, $sign_all);
$signer->extended_headers($extended_headers);
- $signer->signing_domain($sender);
- $entity->print($signer);
- my $signature = $signer->create_signature();
- $entity->head->add('DKIM-Signature', $signature, 0);
+ if ($signer->signing_domain($sender)) {
+ $entity->print($signer);
+ my $signature = $signer->create_signature();
+ $entity->head->add('DKIM-Signature', $signature, 0);
+ }