summaryrefslogtreecommitdiff
path: root/src/publish-ip.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/publish-ip.sh')
-rwxr-xr-xsrc/publish-ip.sh53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/publish-ip.sh b/src/publish-ip.sh
deleted file mode 100755
index 37fd2e3..0000000
--- a/src/publish-ip.sh
+++ /dev/null
@@ -1,53 +0,0 @@
1#!/bin/sh
2
3kiki_hostkey=/var/cache/kiki/config/ssh_host_rsa_key
4debian_hostkey=/etc/ssh/ssh_host_rsa_key
5
6determine_lan_ip()
7{
8 ip -4 -oneline addr show |
9 while read n dev _ ip rest; do
10 case "$rest" in
11 *'scope global'*) ;;
12 *) continue ;;
13 esac
14 # Exclude our IP address on br0 -- hosts connected via this device should
15 # be receiving DNS servers from us via DHCP, so dyndns is unnecessary.
16 # However, perhaps we could install a third entry in the dyndns. (Perhaps
17 # something like *.br0.ssh.cryptonomic.net would give us automatic names
18 # for all devices.)
19 case "$dev" in
20 br0) continue ;;
21 esac
22 echo ${ip%/*}
23 break
24 done
25}
26
27ssh_cryptonomic_net__known_hosts()
28{
29cat <<'END'
30|1|ORqVRkqd0LO25vHCB0LezHAgwRE=|ih7EYLpvg9jpU86/0Od0N8Ur36c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHkIETz7wmKd7TZgb3NPeUElZDjZqw2VPd8yDOBTj5UzUBmcgCyE1oCS3Oe1iO9zJWpPtG0QyYa29lKi+vN6pN4=
31END
32}
33
34tmpfile=$(mktemp) || exit 1
35trap 'rm -f "$tmpfile"' EXIT
36ssh_cryptonomic_net__known_hosts > "$tmpfile"
37
38lan_ip=$(determine_lan_ip)
39
40if [ "$lan_ip" ]; then
41 set -- lan "$lan_ip"
42else
43 set --
44fi
45
46hostkey=
47for f in "$kiki_hostkey" "$debian_hostkey"; do
48 [ -r "$f" ] || continue
49 hostkey=$f
50 break
51done
52
53ssh -o GlobalKnownHostsFile="$tmpfile" ${hostkey:+ -i "$hostkey"} dyndns@ssh.cryptonomic.net "$@"