From 33ef131e1e710834dff9acd8bc2e3b1da469e044 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Wed, 25 May 2011 23:19:54 +0200 Subject: added startup script for tinc --- retiolum/hosts/.scripts/autostart/Makefile | 7 +++ retiolum/hosts/.scripts/autostart/tinc | 92 ++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 retiolum/hosts/.scripts/autostart/Makefile create mode 100644 retiolum/hosts/.scripts/autostart/tinc diff --git a/retiolum/hosts/.scripts/autostart/Makefile b/retiolum/hosts/.scripts/autostart/Makefile new file mode 100644 index 00000000..58bfc0c5 --- /dev/null +++ b/retiolum/hosts/.scripts/autostart/Makefile @@ -0,0 +1,7 @@ +INIT_FOLDER=/etc/rc.d +.phony: all +all: + #TODO change the tinc file before writing + cp tinc $(INIT_FOLDER)/tinc + echo "retiolum" > /etc/tinc/nets.boot + update-rc.d tinc defaults diff --git a/retiolum/hosts/.scripts/autostart/tinc b/retiolum/hosts/.scripts/autostart/tinc new file mode 100644 index 00000000..06d10403 --- /dev/null +++ b/retiolum/hosts/.scripts/autostart/tinc @@ -0,0 +1,92 @@ +#! /bin/sh +# +### BEGIN INIT INFO +# Provides: tinc +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Should-Start: $syslog $named +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start tinc daemons +# Description: Create a file $NETSFILE (/etc/tinc/nets.boot), +# and put all the names of the networks in there. +# These names must be valid directory names under +# $TCONF (/etc/tinc). Lines starting with a # will be +# ignored in this file. +### END INIT INFO +# +# Based on Lubomir Bulej's Redhat init script. + +DAEMON="/usr/sbin/tincd" +NAME="tinc" +DESC="tinc daemons" +TCONF="/etc/tinc" +NETSFILE="$TCONF/nets.boot" +NETS="" + +test -f $DAEMON || exit 0 + +[ -r /etc/default/tinc ] && . /etc/default/tinc + +# foreach_net "what-to-say" action [arguments...] +foreach_net() { + if [ ! -f $NETSFILE ] ; then + echo "Please create $NETSFILE." + exit 0 + fi + echo -n "$1" + shift + egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do + echo -n " $net" + "$@" $net $args + done + echo "." +} + +start() { + $DAEMON $EXTRA -n "$@" +} +stop() { + $DAEMON -n $1 -k +} +reload() { + $DAEMON -n $1 -kHUP +} +restart() { + stop "$@" + sleep 0.5 + i=0; + while [ -f /var/run/tinc.$1.pid ] ; do + if [ $i = '10' ] ; then + break + else + echo -n "." + sleep 0.5 + i=$(($i+1)) + fi + done + start "$@" +} + +case "$1" in + start) + foreach_net "Starting $DESC:" start + ;; + stop) + foreach_net "Stopping $DESC:" stop + ;; + reload|force-reload) + foreach_net "Reloading $DESC configuration:" reload + ;; + restart) + foreach_net "Restarting $DESC:" restart + ;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + -- cgit v1.2.3 From c32f57caebcf3cc442a07968a090ef9ee5f5304c Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 26 May 2011 01:54:47 +0200 Subject: removed old hosts --- retiolum/hosts/.pubkeys/5eruun | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 retiolum/hosts/.pubkeys/5eruun diff --git a/retiolum/hosts/.pubkeys/5eruun b/retiolum/hosts/.pubkeys/5eruun deleted file mode 100644 index ce24501f..00000000 --- a/retiolum/hosts/.pubkeys/5eruun +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/YOSX4xEKitiVzIP0xFU -KQvC01uKN+KCT2Y7H8MFzowB+GWdVvplRi8TukMF1EYlIZoSIrgPO/SoOFZNvxPa -83I6PeN6W830qKpUt3xYMqyuL2ZJw1hvhsgPWbGXF2yA39mQas9Skf2SNnEJppFp -N8mGw449PLhTFmGoR3x3354kgO40zts4qqvpMcyTOx+zQhnGBO4KQqftJU1klgCc -YUHrN+ql5vq3u6YgMpUIczPnhN6Cnm+jhys6sTXN/DFcpq6YGXTHSGZO1JTuAyfZ -HfXXgUtIbW5W03LLtkYcMIiaIafe+qivtAs3cZIEKZVp+1fdfypQok6nDPwC1jy8 -TwIDAQAB ------END PUBLIC KEY----- -- cgit v1.2.3 From f7bc1f56d7824e73b324dbe9db5d209c12d97af1 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 26 May 2011 10:28:35 +0200 Subject: changed weight-calculation for graphgen --- retiolum/hosts/.scripts/adv_graphgen/parse.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/retiolum/hosts/.scripts/adv_graphgen/parse.py b/retiolum/hosts/.scripts/adv_graphgen/parse.py index 27fe3a99..b0534d93 100755 --- a/retiolum/hosts/.scripts/adv_graphgen/parse.py +++ b/retiolum/hosts/.scripts/adv_graphgen/parse.py @@ -35,7 +35,10 @@ def merge_edges(nodes): def write_node(k,v): - """ writes a single node and its edges """ + """ writes a single node and its edges + 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" @@ -47,11 +50,12 @@ def write_node(k,v): node += "]" print (node) for con in v.get('to',[]): - edge = " "+k+ " -> " +con['name'] + "[weight="+str(10/float(con['weight'])) + edge = " "+k+ " -> " +con['name'] + "[weight="+str(float(con['weight'])) if con.get('bidirectional',False): edge += ",dir=both" edge += "]" print edge + def parse_input(): nodes={} for line in sys.stdin: -- cgit v1.2.3 From 32c1be4902f05a262715af6af4714d344f80bd93 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 26 May 2011 13:06:12 +0200 Subject: fixed missing +x in startup script --- retiolum/hosts/.scripts/autostart/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/retiolum/hosts/.scripts/autostart/Makefile b/retiolum/hosts/.scripts/autostart/Makefile index 58bfc0c5..7ca589e1 100644 --- a/retiolum/hosts/.scripts/autostart/Makefile +++ b/retiolum/hosts/.scripts/autostart/Makefile @@ -1,7 +1,8 @@ -INIT_FOLDER=/etc/rc.d +INIT_FOLDER=/etc/init.d .phony: all all: #TODO change the tinc file before writing cp tinc $(INIT_FOLDER)/tinc + chmod +x $(INIT_FOLDER)/tinc echo "retiolum" > /etc/tinc/nets.boot update-rc.d tinc defaults -- cgit v1.2.3 From aea8e374caa9ba8cbb1bc3cff39753fbfe0e3605 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 26 May 2011 13:59:47 +0200 Subject: fixed borken parse script wrong behaviour when we do not know the internal ip of a node for some reason. fixed autostart script to modprobe tun before continuning --- retiolum/hosts/.scripts/adv_graphgen/parse.py | 4 +++- retiolum/hosts/.scripts/autostart/tinc | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) mode change 100644 => 100755 retiolum/hosts/.scripts/autostart/tinc diff --git a/retiolum/hosts/.scripts/adv_graphgen/parse.py b/retiolum/hosts/.scripts/adv_graphgen/parse.py index b0534d93..04b42c33 100755 --- a/retiolum/hosts/.scripts/adv_graphgen/parse.py +++ b/retiolum/hosts/.scripts/adv_graphgen/parse.py @@ -1,4 +1,5 @@ #!/usr/bin/python2 +# -*- coding: utf8 -*- import sys """ TODO: Refactoring needed to pull the edges out of the node structures again, @@ -44,7 +45,8 @@ def write_node(k,v): node += "external:"+v['external-ip']+":"+v['external-port']+"\\l" if v.has_key('num_conns'): node += "Num Connects:"+str(v['num_conns'])+"\\l" - node += "internal:"+v['internal-ip']+"\\l\"" + + node += "internal:"+v.get('internal-ip','¯\\\\(°_o)/¯')+"\\l\"" if v['external-ip'] == "MYSELF": node += ",fillcolor=steelblue1" node += "]" diff --git a/retiolum/hosts/.scripts/autostart/tinc b/retiolum/hosts/.scripts/autostart/tinc old mode 100644 new mode 100755 index 06d10403..12e77d6a --- a/retiolum/hosts/.scripts/autostart/tinc +++ b/retiolum/hosts/.scripts/autostart/tinc @@ -25,6 +25,8 @@ TCONF="/etc/tinc" NETSFILE="$TCONF/nets.boot" NETS="" +modprobe tun + test -f $DAEMON || exit 0 [ -r /etc/default/tinc ] && . /etc/default/tinc -- cgit v1.2.3