diff options
Diffstat (limited to 'bin/update-dns.sh')
-rwxr-xr-x | bin/update-dns.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/update-dns.sh b/bin/update-dns.sh new file mode 100755 index 0000000..1262195 --- /dev/null +++ b/bin/update-dns.sh | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | view="internal" | ||
4 | #view="external" | ||
5 | |||
6 | zone_key=$(grep "key \"master-view-$view\"" <<EOF | ||
7 | key "master-view-external" { algorithm hmac-sha256; secret "$(pass Pomona/DNS_External_Key)"; }; | ||
8 | key "master-view-internal" { algorithm hmac-sha256; secret "$(pass Pomona/DNS_Internal_Key)"; }; | ||
9 | EOF | ||
10 | ) | ||
11 | |||
12 | # Zone Transfer | ||
13 | #zone="" | ||
14 | #dig @ns1.as398223.net +nostats +nocmd -k <(echo $zone_key) AXFR $zone | ||
15 | #exit 0 | ||
16 | |||
17 | if [[ $1 != "-r" ]]; then | ||
18 | echo "Dry run mode, no changes made" && exit 1 | ||
19 | fi | ||
20 | |||
21 | # Update Records | ||
22 | # NOTE: White space between PTR lines matters for buggy reasons | ||
23 | ( | ||
24 | cat <<EOF | ||
25 | |||
26 | |||
27 | |||
28 | update add dev.ssh-proxy.crute.me. 60 IN A 127.0.0.1 | ||
29 | |||
30 | |||
31 | |||
32 | |||
33 | |||
34 | |||
35 | send | ||
36 | EOF | ||
37 | ) | nsupdate -k <(echo $zone_key) | ||
38 | echo "Updated: $?" | ||