Browse code

WIP: Add implementation

Robert Cranston authored on 17/06/2023 18:12:27
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,31 @@
1
+#!/bin/sh
2
+set -euC
3
+
4
+# nfsn-dns-dmarc DOMAIN NAME EMAIL_NAME POLICY
5
+
6
+# nfsn-dns-dmarc "example.com" "" "" "none"
7
+# nfsn-dns-dmarc "example.com" "" "" "quarantine"
8
+# nfsn-dns-dmarc "example.com" "" "" "reject"
9
+
10
+# Arguments.
11
+
12
+domain="$1" ; shift
13
+name="$1" ; shift
14
+email_name="${1:-"postmaster"}" ; shift
15
+policy="$1" ; shift
16
+
17
+# Process.
18
+
19
+name="_dmarc${name:+".$name"}"
20
+data="$(
21
+    printf "%s" \
22
+        "v=DMARC1; " \
23
+        "p=$policy; " \
24
+        "sp=$policy; " \
25
+        "pct=100; " \
26
+        "rua=mailto:$email_name@$domain"
27
+)"
28
+
29
+# Update.
30
+
31
+nfsn-dns-update "$domain" "$name" "TXT" '' "$data"