summaryrefslogtreecommitdiff
path: root/bin/cryptonomic-dyndns-command
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cryptonomic-dyndns-command')
-rwxr-xr-xbin/cryptonomic-dyndns-command16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/cryptonomic-dyndns-command b/bin/cryptonomic-dyndns-command
index 348ed74..c191066 100755
--- a/bin/cryptonomic-dyndns-command
+++ b/bin/cryptonomic-dyndns-command
@@ -83,6 +83,21 @@ add()
83 powerdns_sqlite_add_replace_record "$domain" "$record_type" "$ip" 83 powerdns_sqlite_add_replace_record "$domain" "$record_type" "$ip"
84} 84}
85 85
86validate_ssh_server()
87{
88 e=$(mktemp)
89 ssh-keyscan -t "$SSH_CLIENT_KEYTYPE" "$ip_address" | grep -q " $SSH_CLIENT_KEYDATA\$" 2>"$e"
90 if [ $? = 0 ]
91 then
92 rm "$e"
93 return 0
94 else
95 cat "$e" >&2
96 rm "$e"
97 false
98 fi
99}
100
86validate_dns_label() 101validate_dns_label()
87{ 102{
88 if [ $#1 -gt 64 ] 103 if [ $#1 -gt 64 ]
@@ -105,6 +120,7 @@ validate_dns_label()
105 120
106main() 121main()
107{ 122{
123 validate_ssh_server "$ip_address" || return
108 add "$domain" "$ip_address" 124 add "$domain" "$ip_address"
109 for label in $SSH_ORIGINAL_COMMAND 125 for label in $SSH_ORIGINAL_COMMAND
110 do 126 do