summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2021-09-29 21:26:18 -0400
committerAndrew Cady <d@jerkface.net>2021-09-29 21:26:18 -0400
commit01f2462f6b553ba649a26874ab1b9096f6f082f1 (patch)
treeca16b9a0398ef715fb131e6a6167d6cc6e7aece3
parent21f59a6bb67615fc9cea97a35d428ab5c21302d6 (diff)
show ssh-keyscan errors
-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