diff --git a/plugins/dmarc b/plugins/dmarc index 6f41234..1c1eaa0 100644 --- a/plugins/dmarc +++ b/plugins/dmarc @@ -52,7 +52,7 @@ _dmarc IN TXT "v=DMARC1; p=reject; pct=100; rua=mailto:dmarc-feedback@example.c 3. activate this plugin (add to config/plugins) -Be sure to run the DMARC after the SPF & DKIM plugins, and you should also have I set for both SPF and DKIM. +Be sure to run the DMARC plugin after the SPF & DKIM plugins. Configure the SPF and DKIM messages to not reject mail. =head2 Parse dmarc feedback reports into a database @@ -146,6 +146,12 @@ sub data_post_handler { # Domain Owner. See Section 6.2 for details. return DECLINED if lc $policy->{p} eq 'none'; + my $pct = $policy->{pct} || 100; + if ( $pct != 100 && int(rand(100)) >= $pct ) { + $self->log("fail, tolerated, policy, sampled out"); + return DECLINED; + }; + return $self->get_reject("failed DMARC policy"); } @@ -348,6 +354,7 @@ sub host_has_rr { $self->log(LOGDEBUG, "fail, non-existent domain: $domain"); return; } + return if $res->errorstring eq 'NOERROR'; $self->log(LOGINFO, "error, looking up $domain: " . $res->errorstring); return; };