summaryrefslogtreecommitdiff
path: root/bin/update-dns.sh
blob: 12621953166e2735ddda424c629bcbefc87ba759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

view="internal"
#view="external"

zone_key=$(grep "key \"master-view-$view\"" <<EOF
key "master-view-external" { algorithm hmac-sha256; secret "$(pass Pomona/DNS_External_Key)"; };
key "master-view-internal" { algorithm hmac-sha256; secret "$(pass Pomona/DNS_Internal_Key)"; };
EOF
)

# Zone Transfer
#zone=""
#dig @ns1.as398223.net +nostats +nocmd -k <(echo $zone_key) AXFR $zone
#exit 0

if [[ $1 != "-r" ]]; then
	echo "Dry run mode, no changes made" && exit 1
fi

# Update Records
# NOTE: White space between PTR lines matters for buggy reasons
(
cat  <<EOF



update add dev.ssh-proxy.crute.me. 60 IN A 127.0.0.1






send
EOF
) | nsupdate -k <(echo $zone_key)
echo "Updated: $?"