diff options
author | tv <tv@nomic.retiolum> | 2013-02-02 00:19:20 +0100 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2013-02-02 00:19:20 +0100 |
commit | f2992565ab8be0544ae328c3d11243131a3b7441 (patch) | |
tree | c65c16797ec2ab1d7e9c1b4aa2bd6431e2defc6d /retiolum/bin/list-known-public-addresses | |
parent | 367edf6e568b9d9ac094693e2c6345f120e2a99c (diff) |
//retiolum list-known-public-addresses: initial commit
Diffstat (limited to 'retiolum/bin/list-known-public-addresses')
-rwxr-xr-x | retiolum/bin/list-known-public-addresses | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/retiolum/bin/list-known-public-addresses b/retiolum/bin/list-known-public-addresses new file mode 100755 index 00000000..d157cea4 --- /dev/null +++ b/retiolum/bin/list-known-public-addresses @@ -0,0 +1,28 @@ +#! /bin/sh +# +# printf '%s %s\n' hostname IP-address for each known public retiolum address +# +set -eu + +cd /etc/tinc/retiolum/hosts + +grep --with-filename '^Address' * | +sed ' + # filter "%s %s %s\n" hostname var val + s/: */ / + s/ *= */ / + # filter "%s %s\n" hostname address + s/ Address \([a-zA-Z0-9.:_]*\) \?.*/ \1/ + T + # prepare hostname lookup + /:/!{/ [0-9.]*$/!{s/ / `dig +short /;s/$/` \&/}} + s/^/echo / + $s/$/\nwait/ + # perform hostname lookup +' | sh | sed ' + # drop private IPv4 addresses + / 10\./d + / 172\.\(1[6-9]\|2[0-9]\|3[01]\)\./d + / 192\.168\./d + # TODO drop private IPv6 addresses +' |