diff options
author | makefu <github@syntax-fehler.de> | 2011-08-13 16:18:25 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-08-13 16:18:25 +0200 |
commit | df758080d53482d0680a8eda3d5f5e1888ae091c (patch) | |
tree | e2b63468b6af298a4c1770419998f68514e96c26 /retiolum/bin | |
parent | 541620dc51862d588a2bdfea9b84dbf9bf21bf73 (diff) |
check-free-retiolum-*: initial commit
scripts determine if an ip-address is already taken by one of the darknet nodes
this goes for the ipv6 retiolum darknet prefix, as well as internal 10.7.7.0/24 addresses
Diffstat (limited to 'retiolum/bin')
-rwxr-xr-x | retiolum/bin/check-free-retiolum-v4 | 22 | ||||
-rwxr-xr-x | retiolum/bin/check-free-retiolum-v6 | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/retiolum/bin/check-free-retiolum-v4 b/retiolum/bin/check-free-retiolum-v4 new file mode 100755 index 00000000..e9c6b3ce --- /dev/null +++ b/retiolum/bin/check-free-retiolum-v4 @@ -0,0 +1,22 @@ +#! /bin/sh +set -x +netname=retiolum +myipv4=${1-10.7.7.-1} +v4num=${myipv4##*.} +printf "Retard check: " +if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; +then + printf "No retard detected\n" + cd /etc/tinc/$netname/hosts + printf "Check if ip is still free: " + for i in `ls -1`; do + if grep $myipv4 $i &>/dev/null ;then + echo "Host IP already taken by $i! " + exit 1 + fi + done + printf "Passed" +else + printf "you are made of stupid. bailing out\n" + exit 1 +fi diff --git a/retiolum/bin/check-free-retiolum-v6 b/retiolum/bin/check-free-retiolum-v6 new file mode 100755 index 00000000..20f87efe --- /dev/null +++ b/retiolum/bin/check-free-retiolum-v6 @@ -0,0 +1,2 @@ +#! /bin/sh +exit 0 |