DKIM2 verification
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
use std::future::Future;
|
||||
|
||||
use common::Server;
|
||||
use mail_auth::{DkimResult, DmarcResult, SpfResult, dmarc::Policy};
|
||||
use mail_auth::{Dkim2Result, DkimResult, DmarcResult, SpfResult, dmarc::Policy};
|
||||
|
||||
use crate::SpamFilterContext;
|
||||
|
||||
@@ -52,6 +52,18 @@ impl SpamFilterAnalyzeDmarc for Server {
|
||||
},
|
||||
);
|
||||
|
||||
ctx.result.add_tag(
|
||||
ctx.input
|
||||
.dkim2_result
|
||||
.map_or("DKIM2_NA", |r| match r.result() {
|
||||
Dkim2Result::Pass => "DKIM2_ALLOW",
|
||||
Dkim2Result::Fail(_) => "DKIM2_REJECT",
|
||||
Dkim2Result::PermError(_) => "DKIM2_PERMFAIL",
|
||||
Dkim2Result::TempError(_) => "DKIM2_TEMPFAIL",
|
||||
Dkim2Result::None => "DKIM2_NA",
|
||||
}),
|
||||
);
|
||||
|
||||
ctx.result
|
||||
.add_tag(ctx.input.arc_result.map_or("ARC_NA", |r| match r.result() {
|
||||
DkimResult::Pass => "ARC_ALLOW",
|
||||
|
||||
@@ -11,7 +11,9 @@ pub mod modules;
|
||||
|
||||
use analysis::ElementLocation;
|
||||
use analysis::url::UrlParts;
|
||||
use mail_auth::{ArcOutput, DkimOutput, DmarcResult, IprevOutput, SpfOutput, dmarc::Policy};
|
||||
use mail_auth::{
|
||||
ArcOutput, DkimOutput, DmarcResult, IprevOutput, SpfOutput, dkim2::Dkim2Output, dmarc::Policy,
|
||||
};
|
||||
use mail_parser::Message;
|
||||
use modules::html::HtmlToken;
|
||||
use nlp::tokenizers::types::TokenType;
|
||||
@@ -30,6 +32,7 @@ pub struct SpamFilterInput<'x> {
|
||||
pub spf_ehlo_result: Option<&'x SpfOutput>,
|
||||
pub spf_mail_from_result: Option<&'x SpfOutput>,
|
||||
pub dkim_result: &'x [DkimOutput<'x>],
|
||||
pub dkim2_result: Option<&'x Dkim2Output<'x>>,
|
||||
pub dmarc_result: Option<&'x DmarcResult>,
|
||||
pub dmarc_policy: Option<&'x Policy>,
|
||||
pub iprev_result: Option<&'x IprevOutput>,
|
||||
@@ -147,6 +150,7 @@ impl<'x> SpamFilterInput<'x> {
|
||||
spf_ehlo_result: None,
|
||||
spf_mail_from_result: None,
|
||||
dkim_result: &[],
|
||||
dkim2_result: None,
|
||||
dmarc_result: None,
|
||||
dmarc_policy: None,
|
||||
iprev_result: None,
|
||||
|
||||
Reference in New Issue
Block a user