summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/dyndns-command.sh59
l---------src/dyndns.ecdsa-sha2-nistp256.cryptonomic.net1
l---------src/dyndns.ssh-dss.cryptonomic.net1
l---------src/dyndns.ssh-ed25519.cryptonomic.net1
4 files changed, 62 insertions, 0 deletions
diff --git a/src/dyndns-command.sh b/src/dyndns-command.sh
new file mode 100755
index 0000000..1061b31
--- /dev/null
+++ b/src/dyndns-command.sh
@@ -0,0 +1,59 @@
1#!/bin/bash
2subdomain=${SSH_REMOTE_FINGERPRINT//:/}
3ip_address=${SSH_CLIENT%% *}
4lan_address="$SSH_ORIGINAL_COMMAND"
5
6domain=ssh.cryptonomic.net
7
8sqlescape()
9{
10 printf '%s' "'${1/\'/\'\'}'"
11}
12
13add()
14{
15 local newdomain="$(sqlescape "$1.$domain")" ip_address="$(sqlescape "$2")" domain="$(sqlescape "$domain")"
16
17 sqlite3 /etc/powerdns/powerdns.sqlite3 <<END
18BEGIN;
19 delete from records where type='A' and name=$newdomain;
20
21 insert into records
22
23 (domain_id,
24 name,
25 type,
26 content,
27 ttl,
28 prio)
29
30 select
31 id,
32 $newdomain,
33 'A',
34 $ip_address,
35 3600,
36 0
37 from domains
38 where name=$domain;
39COMMIT;
40END
41 if [ $? = 0 ]; then
42 printf '%s\n' "$1 $2"
43 fi
44}
45
46add "$subdomain" "$ip_address"
47
48set -- $lan_address
49while [ $# -ge 2 ]; do
50 d=$1
51 ip=$2
52 shift 2
53
54 case "$d" in
55 *.*) continue;;
56 esac
57
58 add "$d.$subdomain" "$ip"
59done
diff --git a/src/dyndns.ecdsa-sha2-nistp256.cryptonomic.net b/src/dyndns.ecdsa-sha2-nistp256.cryptonomic.net
new file mode 120000
index 0000000..e46be55
--- /dev/null
+++ b/src/dyndns.ecdsa-sha2-nistp256.cryptonomic.net
@@ -0,0 +1 @@
dyndns.ssh-rsa.cryptonomic.net \ No newline at end of file
diff --git a/src/dyndns.ssh-dss.cryptonomic.net b/src/dyndns.ssh-dss.cryptonomic.net
new file mode 120000
index 0000000..e46be55
--- /dev/null
+++ b/src/dyndns.ssh-dss.cryptonomic.net
@@ -0,0 +1 @@
dyndns.ssh-rsa.cryptonomic.net \ No newline at end of file
diff --git a/src/dyndns.ssh-ed25519.cryptonomic.net b/src/dyndns.ssh-ed25519.cryptonomic.net
new file mode 120000
index 0000000..e46be55
--- /dev/null
+++ b/src/dyndns.ssh-ed25519.cryptonomic.net
@@ -0,0 +1 @@
dyndns.ssh-rsa.cryptonomic.net \ No newline at end of file