diff options
Diffstat (limited to 'src/publish-ip.sh')
-rwxr-xr-x | src/publish-ip.sh | 53 |
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 | |||
3 | kiki_hostkey=/var/cache/kiki/config/ssh_host_rsa_key | ||
4 | debian_hostkey=/etc/ssh/ssh_host_rsa_key | ||
5 | |||
6 | determine_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 | |||
27 | ssh_cryptonomic_net__known_hosts() | ||
28 | { | ||
29 | cat <<'END' | ||
30 | |1|ORqVRkqd0LO25vHCB0LezHAgwRE=|ih7EYLpvg9jpU86/0Od0N8Ur36c= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHkIETz7wmKd7TZgb3NPeUElZDjZqw2VPd8yDOBTj5UzUBmcgCyE1oCS3Oe1iO9zJWpPtG0QyYa29lKi+vN6pN4= | ||
31 | END | ||
32 | } | ||
33 | |||
34 | tmpfile=$(mktemp) || exit 1 | ||
35 | trap 'rm -f "$tmpfile"' EXIT | ||
36 | ssh_cryptonomic_net__known_hosts > "$tmpfile" | ||
37 | |||
38 | lan_ip=$(determine_lan_ip) | ||
39 | |||
40 | if [ "$lan_ip" ]; then | ||
41 | set -- lan "$lan_ip" | ||
42 | else | ||
43 | set -- | ||
44 | fi | ||
45 | |||
46 | hostkey= | ||
47 | for f in "$kiki_hostkey" "$debian_hostkey"; do | ||
48 | [ -r "$f" ] || continue | ||
49 | hostkey=$f | ||
50 | break | ||
51 | done | ||
52 | |||
53 | ssh -o GlobalKnownHostsFile="$tmpfile" ${hostkey:+ -i "$hostkey"} dyndns@ssh.cryptonomic.net "$@" | ||