aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshukuru <shukuru@boitalett.re>2024-02-18 14:50:55 +0100
committershukuru <shukuru@boitalett.re>2024-02-18 14:50:55 +0100
commit13e1af6641cdfc8c8427b5c2a81f8b79aef9e26b (patch)
treedec1f255e72e747ea070afe210f971927c958e3d
parentd3609f9be18caf3134dbb0e5c051bd56185a9c56 (diff)
Add DMARC report data structure code
-rw-r--r--examples/dmarc_report_example.xml50
-rw-r--r--src/data_structures.rs35
2 files changed, 85 insertions, 0 deletions
diff --git a/examples/dmarc_report_example.xml b/examples/dmarc_report_example.xml
new file mode 100644
index 0000000..d560d85
--- /dev/null
+++ b/examples/dmarc_report_example.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<feedback xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <version>1.0</version>
+ <report_metadata>
+ <org_name>Enterprise Outlook</org_name>
+ <email>dmarcreport@microsoft.com</email>
+ <report_id>3374fb5148ba40c1a5cf8e3d36f34a34</report_id>
+ <date_range>
+ <begin>1707436800</begin>
+ <end>1707523200</end>
+ </date_range>
+ </report_metadata>
+ <policy_published>
+ <domain>boitalett.re</domain>
+ <adkim>s</adkim>
+ <aspf>s</aspf>
+ <p>reject</p>
+ <sp>reject</sp>
+ <pct>100</pct>
+ <fo>0</fo>
+ </policy_published>
+ <record>
+ <row>
+ <source_ip>195.154.102.43</source_ip>
+ <count>1</count>
+ <policy_evaluated>
+ <disposition>none</disposition>
+ <dkim>pass</dkim>
+ <spf>pass</spf>
+ </policy_evaluated>
+ </row>
+ <identifiers>
+ <envelope_to>babilou.com</envelope_to>
+ <envelope_from>boitalett.re</envelope_from>
+ <header_from>boitalett.re</header_from>
+ </identifiers>
+ <auth_results>
+ <dkim>
+ <domain>boitalett.re</domain>
+ <selector>2023101501</selector>
+ <result>pass</result>
+ </dkim>
+ <spf>
+ <domain>boitalett.re</domain>
+ <scope>mfrom</scope>
+ <result>pass</result>
+ </spf>
+ </auth_results>
+ </record>
+</feedback> \ No newline at end of file
diff --git a/src/data_structures.rs b/src/data_structures.rs
new file mode 100644
index 0000000..a90b7b0
--- /dev/null
+++ b/src/data_structures.rs
@@ -0,0 +1,35 @@
+enum DMARCPolicy {
+ None,
+ Quarantine,
+ Reject
+}
+
+enum DMARCAlignment {
+ Relaxed,
+ Strict
+}
+
+enum DMARCFailureOption {
+ AlignedPassFailure,
+ OtherAlignedPassFailure,
+ SignatureAlignmentFailure,
+ SPFFailure
+}
+
+struct DMARCRecord {
+ domain: String,
+ adkim: DMARCAlignment,
+ aspf: DMARCAlignment,
+ policy: DMARCPolicy,
+ subdomain_policy: DMARCPolicy,
+ percentage: u64,
+ failure_opt: DMARCFailureOption
+}
+
+pub struct DMARCReport {
+ id: String,
+ org: String,
+ record: DMARCRecord,
+ dkim_pass: bool,
+ spf_pass: bool
+}