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,27 @@
1
+#!/bin/sh
2
+set -euC
3
+
4
+# nfsn-dns-spf DOMAIN NAME [INCLUDE]...
5
+
6
+# nfsn-dns-spf "example.com" "mailgun.org"
7
+
8
+# Arguments.
9
+
10
+domain="$1" ; shift
11
+name="$1" ; shift
12
+
13
+# Process.
14
+
15
+data="$(
16
+    printf -- "v=spf1"
17
+    for include in "$@"
18
+    do
19
+        printf -- " include:%s" "$include"
20
+    done
21
+    printf -- " -all"
22
+    printf -- "\n"
23
+)"
24
+
25
+# Update.
26
+
27
+nfsn-dns-update "$domain" "$name" "TXT" '^v=spf1' "$data"