From 58695662f2d4bebe53b2b3dd9974bac44b4b9ead Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Fri, 27 May 2011 15:24:04 +0200 Subject: install.sh is now enterprise(probably) install.sh: if no username is given, read from stdin same goes for v4 ip generate v6 address automagically rewrites all the config write_channel: now write_channel is outsourced --- modules/retiolum/Makefile | 2 +- modules/retiolum/scripts/tinc_setup/install.sh | 94 +++++++++++++--------- .../retiolum/scripts/tinc_setup/write_channel.py | 21 +++++ 3 files changed, 78 insertions(+), 39 deletions(-) create mode 100644 modules/retiolum/scripts/tinc_setup/write_channel.py (limited to 'modules') diff --git a/modules/retiolum/Makefile b/modules/retiolum/Makefile index c1ebfe37..0d99ee70 100644 --- a/modules/retiolum/Makefile +++ b/modules/retiolum/Makefile @@ -12,4 +12,4 @@ update: /etc/tinc/retiolum/hosts cd $< && git pull install: - curl -k https://github.com/miefda/retiolum/raw/master/.scripts/tinc_setup/bootstrap.sh | sh + scripts/tinc_setup/install.sh diff --git a/modules/retiolum/scripts/tinc_setup/install.sh b/modules/retiolum/scripts/tinc_setup/install.sh index 89465b64..b7679041 100755 --- a/modules/retiolum/scripts/tinc_setup/install.sh +++ b/modules/retiolum/scripts/tinc_setup/install.sh @@ -1,29 +1,63 @@ #! /bin/sh # USE WITH GREAT CAUTION +make -C ../../ update + set -e -myname="${1:-dummy}" -rel_hostsfile=`dirname $0`/.. -hostsfile=`readlink -f $rel_hostsfile` -netname=retiolum -myipv4="${2:-10.7.7.56}" -mynet4=10.7.7.0 + + CURR=`pwd` +MYBIN=../../bin +netname=penisland # create configuration directory for $netname -mkdir -p /etc/tinc/$netname +mkdir -p /etc/tinc/$netname/hosts cd /etc/tinc/$netname -# get currently known hosts -cp -r $hostsfile hosts echo "added known hosts:" -ls -1 | LC_ALL=C sort +ls -1 hosts | LC_ALL=C sort echo "delete the nodes you do not trust!" +myname="${1:-}" +if [ ! "$myname" ] +then + echo "select username: " + read myname +fi +if [ ! -e "hosts/$myname" ] +then + myipv4="${2:-}" + mynet4=10.7.7.0 + + if [ ! "$myipv4" ] + then + echo "select v4 subnet ip (1-255) :" + read v4num + if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; + then + echo "check" + else + echo "you are made of stupid. bailing out" + exit 1 + fi + myipv4=10.7.7.$v4num + fi + echo "Subnet = $myipv4" > hosts/$myname + + myipv6=`${CURR}/../../bin/fillxx 42:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`/128 + echo "Subnet = $myipv6" >> hosts/$myname +else + echo "own host file already exists! will not write again!" +fi + + +myipv6=${myipv6:-`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' /etc/tinc/$netname/hosts/$myname`} cat>tinc-up< hosts/$myname -tincd -n $netname -K - -echo Writing Public Key to irc channel -cat>write_channel.py<