diff options
Diffstat (limited to 'retiolum')
-rw-r--r-- | retiolum/Makefile | 7 | ||||
-rwxr-xr-x | retiolum/bin/check-free-retiolum-v4 | 5 | ||||
-rwxr-xr-x | retiolum/bin/hosts | 4 | ||||
-rwxr-xr-x | retiolum/bin/ipv6 | 2 | ||||
-rwxr-xr-x | retiolum/bin/update-retiolum-hosts | 3 | ||||
-rwxr-xr-x | retiolum/bin/update_tinc_hosts | 6 | ||||
-rw-r--r-- | retiolum/hosts/also | 1 | ||||
-rw-r--r-- | retiolum/hosts/iiso | 10 | ||||
-rw-r--r-- | retiolum/hosts/sir_krebs_a_lot | 11 | ||||
-rw-r--r-- | retiolum/scripts/adv_graphgen/Makefile | 4 | ||||
-rwxr-xr-x | retiolum/scripts/adv_graphgen/parse.py | 5 | ||||
-rwxr-xr-x | retiolum/scripts/adv_graphgen/sanitize.sh | 19 | ||||
-rwxr-xr-x | retiolum/scripts/tinc_setup/tinc-up | 6 | ||||
-rw-r--r-- | retiolum/scripts/tinc_setup/write_channel.py | 1 |
14 files changed, 62 insertions, 22 deletions
diff --git a/retiolum/Makefile b/retiolum/Makefile index 407d8c60..c80a6faa 100644 --- a/retiolum/Makefile +++ b/retiolum/Makefile @@ -8,9 +8,10 @@ links: for x in $(EXES); do ln -vsnf ../retiolum/bin/$$x ../bin; done hosts: - bin/update-retiolum-hosts + bin/update-retiolum-hosts || true install: update + @#punani -Ei tinc python @# will not run automatically scripts/tinc_setup/install.sh scripts/autostart/create-startup.sh @@ -18,10 +19,10 @@ install: update update: hosts @echo creating Magic bin/update_tinc_hosts "create magic" || true - @echo adding hosts + @echo adding hosts bin/update_tinc_hosts restart arch-install: update install arch-autostart autohosts arch-autostart: - make -C scripts/autostart arch + make -C scripts/autostart arch || true diff --git a/retiolum/bin/check-free-retiolum-v4 b/retiolum/bin/check-free-retiolum-v4 index e9c6b3ce..3f0dbdf8 100755 --- a/retiolum/bin/check-free-retiolum-v4 +++ b/retiolum/bin/check-free-retiolum-v4 @@ -1,5 +1,4 @@ #! /bin/sh -set -x netname=retiolum myipv4=${1-10.7.7.-1} v4num=${myipv4##*.} @@ -10,12 +9,12 @@ then 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 + if grep -q -e $myipv4\$ $i ;then echo "Host IP already taken by $i! " exit 1 fi done - printf "Passed" + printf "Passed\n" else printf "you are made of stupid. bailing out\n" exit 1 diff --git a/retiolum/bin/hosts b/retiolum/bin/hosts index 6939f52c..bd0c77dc 100755 --- a/retiolum/bin/hosts +++ b/retiolum/bin/hosts @@ -6,6 +6,8 @@ netname=${1-retiolum} cd /etc/tinc/$netname/hosts for i in `ls`; do - sed -rn 's|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1\t'$i' '$i'.'$netname'|p' $i + sed -n ' + s|^ *Subnet *= *\([^ /]*\)\(/[0-9]*\)\? *$|\1\t'$i' '$i'.'$netname'|p + ' $i done | sort diff --git a/retiolum/bin/ipv6 b/retiolum/bin/ipv6 index 65a1eaa1..34c6de71 100755 --- a/retiolum/bin/ipv6 +++ b/retiolum/bin/ipv6 @@ -13,7 +13,7 @@ if test `id -u` != 0; then fi file=/etc/tinc/retiolum/hosts/`hostname` -addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file` +addr=`sed -n 's|^Subnet *= *\(42:[0-9A-Fa-f:]*/128\)|\1|p' $file` route=42::/16 start() { diff --git a/retiolum/bin/update-retiolum-hosts b/retiolum/bin/update-retiolum-hosts index 7b2fa0e5..1fecfe15 100755 --- a/retiolum/bin/update-retiolum-hosts +++ b/retiolum/bin/update-retiolum-hosts @@ -7,6 +7,9 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exit 23 # go to hell fi +# cd //retiolum +cd $(dirname $(readlink -f $0))/.. + mkdir -v -p /etc/tinc/retiolum/hosts cp -v -r hosts/* /etc/tinc/retiolum/hosts pkill -HUP tincd diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts index fe0785e3..86a28992 100755 --- a/retiolum/bin/update_tinc_hosts +++ b/retiolum/bin/update_tinc_hosts @@ -29,9 +29,13 @@ case "${*-I am made of stupid}" in ;; ('create magic') $0 has magic || $0 print magic >> $hosts < /dev/null + $0 start ;; ('destroy magic') - $0 has magic && sed -ie "/^$bs$/,/^$es$/d" $hosts + if $0 has magic; then + cache="`cat $hosts`" + echo "$cache" | sed "/^$bs$/,/^$es$/d" > $hosts + fi ;; ('has magic') grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts diff --git a/retiolum/hosts/also b/retiolum/hosts/also index 14001d7a..4d118f31 100644 --- a/retiolum/hosts/also +++ b/retiolum/hosts/also @@ -1,4 +1,5 @@ Subnet = 42:9c90:a590:e88a:52cf:126f:b710:1a9c/128 +Subnet = 10.7.7.23 -----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEAsnF1eyd/R4qXMGo8UEZ98hnJK+6ZEKUubgdzEwAuSxK40B6nX8Ry Euy3v3s0ps/GMdE52gUbFB+bhM99hHiKW+7zcxnoMJ69a9yK6VG0Im+7ib0WTliZ diff --git a/retiolum/hosts/iiso b/retiolum/hosts/iiso new file mode 100644 index 00000000..ca7b3004 --- /dev/null +++ b/retiolum/hosts/iiso @@ -0,0 +1,10 @@ +Subnet = 42:b2cd:6c75:d528:e736:ec4e:fc39:8bdc/128 +Subnet = 10.7.7.218 +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAvsjBR0FUkjiNNLhz3AArosLqEiLZY7O8L6LorfUplD/IjG9P7XXx +ry4gbKEH57GPn11IOPP1AKQcz7SfW7EwvUS8U1IZgkQq8BuuD3oGBQxOqwnOwzVN ++XKSZjUfmT/Uf81PHfWE52BfbitI+SBTi0m9cIuhgyYRAjD7We97ogkWDogBXKvC +p1YYH44wcLte7lzWmId9hNOJtTu4KnCVgtXi/DYVLvuofrEk28DhhRSFiun4dkN6 +qMl8ZWOILOhUVSZN+cx/dslCwoog1FuEj7TyuhJFj8yoWIdI4xUGugzmV6npzTvU +bLkcVfuQQYlIV9D7YYPyEFB11U6mifZ5uwIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/retiolum/hosts/sir_krebs_a_lot b/retiolum/hosts/sir_krebs_a_lot new file mode 100644 index 00000000..14e9d242 --- /dev/null +++ b/retiolum/hosts/sir_krebs_a_lot @@ -0,0 +1,11 @@ +Address = 84.23.79.81 +Subnet = 10.7.7.100 +Subnet = 42:48bd:f4cd:b2f1:ff6b:865c:d041:def6/128 +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAzkVF0BSWUEqzdUidLTa6qL4wlNSb8gaxyZperzoAj65d5l25SCqc +jjqvREcE6p+jM4t1STXoohnNvexubNXW3PVo5Zpew+BsaGjVvow0LkqCJ9k96Rrk +JzU5lAVH6om3/QYws/Ot0zq1Z/+Xw/0+9JpVKhEipMWLpLgjAvWdvzSW6aBIHVN1 +3E85fkTE5f0azct+XNSNzUebdyIy8wu/EexGmFI9bN+ewIvqjZJdvxP+Ank55MsE +8P7K9TKwVXw440MGqqoQaOhdaT75TL+2nsAfWYcrNnE3YehMOmCMp9oY+RAvsIkK +iAYyF5l7ZTi/7KGHNsG7rr0cbytiz2nS6wIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/retiolum/scripts/adv_graphgen/Makefile b/retiolum/scripts/adv_graphgen/Makefile new file mode 100644 index 00000000..fafac84e --- /dev/null +++ b/retiolum/scripts/adv_graphgen/Makefile @@ -0,0 +1,4 @@ +install: + #punani install graphviz + echo "add this line to your tinc.conf if you dare:" + echo 'GraphDumpFile = |/krebs/retiolum/scripts/adv_graphgen /srv/http/tmp/graphs/' diff --git a/retiolum/scripts/adv_graphgen/parse.py b/retiolum/scripts/adv_graphgen/parse.py index 0744b262..0bcf42a0 100755 --- a/retiolum/scripts/adv_graphgen/parse.py +++ b/retiolum/scripts/adv_graphgen/parse.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python # -*- coding: utf8 -*- import sys @@ -47,6 +47,7 @@ def write_node(k,v): edges are weightet with the informations inside the nodes provided by tinc """ + node = " "+k+"[label=\"" node += k+"\\l" node += "external:"+v['external-ip']+":"+v['external-port']+"\\l" @@ -57,7 +58,7 @@ def write_node(k,v): node +="\"" if v['external-ip'] == "MYSELF": node += ",fillcolor=steelblue1" - node +=",group="+v['external-ip'].replace(".","")+"" + node +=",group=\""+v['external-ip'].replace(".","")+"\"" node += "]" print node diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh index 38281fba..1dc43bf4 100755 --- a/retiolum/scripts/adv_graphgen/sanitize.sh +++ b/retiolum/scripts/adv_graphgen/sanitize.sh @@ -1,17 +1,20 @@ +#!/bin/sh +HERE=$(dirname `readlink -f $0`) +TMP=/tmp GRAPH_SETTER1=dot GRAPH_SETTER2=circo GRAPH_SETTER3='neato -Goverlap=prism ' GRAPH_SETTER4=sfdp -LOG_FILE=/var/log/everything.log +LOG_FILE=/var/log/syslog OPENER=/bin/true sudo pkill -USR2 tincd sudo sed -n '/tinc.retiolum/{s/.*tinc.retiolum\[[0-9]*\]: //gp}' $LOG_FILE |\ - ./parse.py > retiolum.dot + $HERE/parse.py > $TMP/retiolum.dot -$GRAPH_SETTER1 -Tpng -o $1retiolum_1.png retiolum.dot -$GRAPH_SETTER2 -Tpng -o $1retiolum_2.png retiolum.dot -$GRAPH_SETTER3 -Tpng -o $1retiolum_3.png retiolum.dot -$GRAPH_SETTER4 -Tpng -o $1retiolum_4.png retiolum.dot -$OPENER retiolum_1.png &>/dev/null -rm retiolum.dot +$GRAPH_SETTER1 -Tpng -o $1/retiolum_1.png $TMP/retiolum.dot +$GRAPH_SETTER2 -Tpng -o $1/retiolum_2.png $TMP/retiolum.dot +$GRAPH_SETTER3 -Tpng -o $1/retiolum_3.png $TMP/retiolum.dot +$GRAPH_SETTER4 -Tpng -o $1/retiolum_4.png $TMP/retiolum.dot +$OPENER $HERE/retiolum_1.png &>/dev/null +rm $TMP/retiolum.dot diff --git a/retiolum/scripts/tinc_setup/tinc-up b/retiolum/scripts/tinc_setup/tinc-up index ae7c68e6..9a557787 100755 --- a/retiolum/scripts/tinc_setup/tinc-up +++ b/retiolum/scripts/tinc_setup/tinc-up @@ -4,15 +4,15 @@ dirname="`dirname "$0"`" conf=$dirname/tinc.conf -name=`sed -rn 's|^ *Name *= *([^ ]*) *$|\1|p' $conf` +name=`sed -n 's|^ *Name *= *\([^ ]*\) *$|\1|p' $conf` host=$dirname/hosts/$name route4=10.7.7.0/24 -addr4=`sed -rn 's|^ *Subnet *= *(10\.[^ ]*) *$|\1|p' $host` +addr4=`sed -n 's|^ *Subnet *= *\(10\.[^ ]*\) *$|\1|p' $host` route6=42::/16 -addr6=`sed -rn 's|^ *Subnet *= *(42:[^ ]*) *$|\1|p' $host` +addr6=`sed -n 's|^ *Subnet *= *\(42:[^ ]*\) *$|\1|p' $host` ifconfig $INTERFACE up $addr4 route add -net $route4 dev $INTERFACE diff --git a/retiolum/scripts/tinc_setup/write_channel.py b/retiolum/scripts/tinc_setup/write_channel.py index a11d4605..ee28674f 100644 --- a/retiolum/scripts/tinc_setup/write_channel.py +++ b/retiolum/scripts/tinc_setup/write_channel.py @@ -12,6 +12,7 @@ FILE="/etc/tinc/retiolum/hosts/"+myname PORT=6667 NICK= myname+"_"+str(random.randint(23,666)) +print "Connecting..." sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.connect((HOST,PORT)) print NICK |