summaryrefslogtreecommitdiff
path: root/bin/cryptonomic-dyndns-command
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cryptonomic-dyndns-command')
-rwxr-xr-xbin/cryptonomic-dyndns-command29
1 files changed, 26 insertions, 3 deletions
diff --git a/bin/cryptonomic-dyndns-command b/bin/cryptonomic-dyndns-command
index c191066..3e69f56 100755
--- a/bin/cryptonomic-dyndns-command
+++ b/bin/cryptonomic-dyndns-command
@@ -14,11 +14,12 @@ powerdns_sqlite_add_replace_record()
14 local sql_record_type="$(sql_string "$2")" 14 local sql_record_type="$(sql_string "$2")"
15 local sql_ip_address="$(sql_string "$3")" 15 local sql_ip_address="$(sql_string "$3")"
16 16
17 zone=${1#*.} 17 zone=cryptonomic.net
18 new_name=${label:+$label.}${1: -64 : 64} 18 new_name=${label:+$label.}${1: -64 : 64}
19 19
20 local sql_new_name="$(sql_string "$new_name")" 20 local sql_new_name="$(sql_string "$new_name")"
21 local sql_zone="$(sql_string "$zone")" 21 local sql_zone="$(sql_string "$zone")"
22 local sql_sshfp="$(sql_string "$SSH_CLIENT_SSHFP_DATA")"
22 23
23 if false 24 if false
24 then 25 then
@@ -37,7 +38,7 @@ powerdns_sqlite_add_replace_record()
37 sqlite3 $DB <<END 38 sqlite3 $DB <<END
38${SQL_ECHO:+.echo on} 39${SQL_ECHO:+.echo on}
39BEGIN; 40BEGIN;
40 DELETE FROM records WHERE type=$sql_record_type AND name=$sql_new_name; 41 DELETE FROM records WHERE name=$sql_new_name;
41 42
42 INSERT INTO records 43 INSERT INTO records
43 44
@@ -53,10 +54,30 @@ BEGIN;
53 $sql_new_name, 54 $sql_new_name,
54 $sql_record_type, 55 $sql_record_type,
55 $sql_ip_address, 56 $sql_ip_address,
56 3600, 57 600,
57 0 58 0
58 FROM domains 59 FROM domains
59 WHERE name=$sql_zone; 60 WHERE name=$sql_zone;
61
62 INSERT INTO records
63
64 (domain_id,
65 name,
66 type,
67 content,
68 ttl,
69 prio)
70
71 SELECT
72 id,
73 $sql_new_name,
74 'SSHFP',
75 $sql_sshfp,
76 600,
77 0
78 FROM domains
79 WHERE name=$sql_zone;
80
60COMMIT; 81COMMIT;
61END 82END
62 r=$? 83 r=$?
@@ -133,6 +154,8 @@ PEM_DEST=$HOME/public_rsync
133 154
134eval "$(samizdat-ssh-uid --copy-pem "$PEM_DEST")" 155eval "$(samizdat-ssh-uid --copy-pem "$PEM_DEST")"
135 156
157[ "$SSH_CLIENT_SSHFP_DATA" ] || die wtf
158
136domain=${SSH_CLIENT_DOMAIN} 159domain=${SSH_CLIENT_DOMAIN}
137ip_address=${SSH_CLIENT%% *} 160ip_address=${SSH_CLIENT%% *}
138 161