diff options
author | root <root@krebs> | 2011-05-27 02:20:02 +0200 |
---|---|---|
committer | root <root@krebs> | 2011-05-27 02:20:02 +0200 |
commit | a6563e5a9c554aa5d08c11f645815fb25deb8bcd (patch) | |
tree | 018ebffdbb800cc8ad170653bdfb0665f8ac7398 /modules/retiolum/scripts/tinc_setup | |
parent | 5cbbac4c4ade45524085983625206e2be91b8e3f (diff) | |
parent | d2ce18954f19edccf23dddf76c737cd76ca7881e (diff) |
Merge branch 'import-miefda-retiolum'
Conflicts:
modules/retiolum/scripts/tinc_setup/build_arch.sh
modules/retiolum/scripts/tinc_setup/build_ec2.sh
modules/retiolum/scripts/tinc_setup/build_no.de.sh
modules/retiolum/scripts/tinc_setup/install.sh
Diffstat (limited to 'modules/retiolum/scripts/tinc_setup')
-rw-r--r-- | modules/retiolum/scripts/tinc_setup/README | 18 | ||||
-rw-r--r-- | modules/retiolum/scripts/tinc_setup/bootstrap.sh | 11 | ||||
-rwxr-xr-x | modules/retiolum/scripts/tinc_setup/build_arch.sh | 14 | ||||
-rwxr-xr-x | modules/retiolum/scripts/tinc_setup/build_debian.sh | 32 | ||||
-rwxr-xr-x | modules/retiolum/scripts/tinc_setup/build_debian_clean.sh | 31 | ||||
-rwxr-xr-x | modules/retiolum/scripts/tinc_setup/build_ec2.sh | 16 | ||||
-rw-r--r-- | modules/retiolum/scripts/tinc_setup/build_no.de.sh | 1 | ||||
-rwxr-xr-x | modules/retiolum/scripts/tinc_setup/install.sh | 67 |
8 files changed, 190 insertions, 0 deletions
diff --git a/modules/retiolum/scripts/tinc_setup/README b/modules/retiolum/scripts/tinc_setup/README new file mode 100644 index 00000000..11d6f6e9 --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/README @@ -0,0 +1,18 @@ +This directory contains the build and install scripts for shack-retiolum + +1. build_arch + arch linux build script +2. build_debian + debian build script +3. build_debian_clean + debian script which builds a clean tinc daemon +4. build_ec2 + Amazon ec2 base instance build script +5. install.sh + configures the tinc daemon + $1 is the nickname + $2 is the ip-address + also writes a python file inside the tinc/retiolum folder which posts + the public key into the IRC:freenode/#tincspasm +6. build_no.de + nonfunct no.de smartmachine build script diff --git a/modules/retiolum/scripts/tinc_setup/bootstrap.sh b/modules/retiolum/scripts/tinc_setup/bootstrap.sh new file mode 100644 index 00000000..32919e7d --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/bootstrap.sh @@ -0,0 +1,11 @@ +if [ ! `id -u` -eq "0" ] +then + echo "not root, trying sudo" + exec sudo "$0" "$@" +fi + +mkdir -p /etc/tinc/retiolum/ +git clone git://github.com/miefda/retiolum.git /etc/tinc/retiolum/hosts +cd /etc/tinc/retiolum/hosts/.scripts + +echo "use the build script of your choice from /etc/tinc/retiolum/hosts/.scripts" diff --git a/modules/retiolum/scripts/tinc_setup/build_arch.sh b/modules/retiolum/scripts/tinc_setup/build_arch.sh new file mode 100755 index 00000000..5ef5d765 --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/build_arch.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e +sudo pacman -S openssl gcc lzo +curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz +cd tinc-1.0.13 +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +sudo make install +cd .. + +echo "overwriting python to python2" +sed 's/\/usr\/bin\/python/\/usr\/bin\/python2/g' install.sh >install2.sh +mv install2.sh install.sh + diff --git a/modules/retiolum/scripts/tinc_setup/build_debian.sh b/modules/retiolum/scripts/tinc_setup/build_debian.sh new file mode 100755 index 00000000..52e61390 --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/build_debian.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -x +if [ ! "$MYIP" ] +then + MYIP=10.0.7.7.55 +fi +if [ ! "$MYHOSTNAME" ] +then + MYHOSTNAME="penis" +fi + +if [ "$MYHOSTNAME" = "penis" ]; +then + read -n1 -p "name is penis, are u sure? [yN]" + if [[ "$REPLY" != [yY] ]] + then + echo "then better RTFC" + echo "bailing out" + exit 0 + fi +fi +apt-get install tinc git curl python + +./install.sh "$MYHOSTNAME" "$MYIP" + +# for autostart +sed -i '/retiolum/d' /etc/tinc/nets.boot +echo "retiolum" >> /etc/tinc/nets.boot +sed -i '/EXTRA/d' /etc/tinc/nets.boot +echo "EXTRA=\"\"" >> /etc/default/tinc + +/etc/init.d/tinc start diff --git a/modules/retiolum/scripts/tinc_setup/build_debian_clean.sh b/modules/retiolum/scripts/tinc_setup/build_debian_clean.sh new file mode 100755 index 00000000..a7332f4e --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/build_debian_clean.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -xe +MYIP=10.0.7.7.55 + +apt-get install tinc git curl gcc gcc-dev build-essential libssl-dev python + +git clone https://github.com/makefu/shack-retiolum.git + +mkdir build +cd build +curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar +xz +cd lzo-2.04 +./configure --prefix=/usr +make +sudo make install +cd .. +curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz +cd tinc-1.0.13 +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +sudo make install +cd ../.. + +cd shack-retiolum +./install.sh `hostname` $MYIP + +rm shack-retiolum +# for autostart +echo "retiolum" >> /etc/tinc/nets.boot +echo "EXTRA=\"--user=tincd --chroot\"" >> /etc/default/tinc diff --git a/modules/retiolum/scripts/tinc_setup/build_ec2.sh b/modules/retiolum/scripts/tinc_setup/build_ec2.sh new file mode 100755 index 00000000..79f2af28 --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/build_ec2.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -e +sudo yum install -y gcc openssl-devel +mkdir build +cd build +curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar xz +cd lzo-2.04 +./configure --prefix=/usr +make +sudo make install +cd .. +curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz +cd tinc-1.0.13 +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +sudo make install diff --git a/modules/retiolum/scripts/tinc_setup/build_no.de.sh b/modules/retiolum/scripts/tinc_setup/build_no.de.sh new file mode 100644 index 00000000..2976d3a2 --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/build_no.de.sh @@ -0,0 +1 @@ +pkgin in lzo gcc-tools gcc-compiler gcc34 diff --git a/modules/retiolum/scripts/tinc_setup/install.sh b/modules/retiolum/scripts/tinc_setup/install.sh new file mode 100755 index 00000000..89465b64 --- /dev/null +++ b/modules/retiolum/scripts/tinc_setup/install.sh @@ -0,0 +1,67 @@ +#! /bin/sh +# USE WITH GREAT CAUTION + +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` +# create configuration directory for $netname +mkdir -p /etc/tinc/$netname +cd /etc/tinc/$netname + +# get currently known hosts +cp -r $hostsfile hosts +echo "added known hosts:" +ls -1 | LC_ALL=C sort +echo "delete the nodes you do not trust!" + + +cat>tinc-up<<EOF +#! /bin/sh +ifconfig \$INTERFACE up $myipv4/24 +route add -net $mynet4/24 dev \$INTERFACE +EOF + +chmod +x tinc-up + +cat>tinc.conf<<EOF +Name = $myname +ConnectTo = supernode +ConnectTo = kaah +ConnectTo = pa_sharepoint +Device = /dev/net/tun +EOF +echo "Subnet = $myipv4" > hosts/$myname +tincd -n $netname -K + +echo Writing Public Key to irc channel +cat>write_channel.py<<EOF +#!/usr/bin/python +import random, sys, time, socket + +CHANNEL = '#tincspasm' +HOST='irc.freenode.net' +FILE="/etc/tinc/retiolum/hosts/$myname" +PORT=6667 +NICK= "${myname}_"+str(random.randint(23,666)) + +sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) +sock.connect((HOST,PORT)) +print NICK +sock.send("NICK %s\r\n" % NICK) +sock.send("USER %s %s bla : %s\r\n" %(NICK,HOST,NICK)) +sock.send("JOIN %s\r\n" % CHANNEL) +time.sleep(23) +f = open(FILE,'r') +a = [ sock.send("PRIVMSG %s : %s" % ( CHANNEL,line)) for line in f] +time.sleep(5) #because irc is so lazy +print "closing socket" +sock.close() +EOF +python write_channel.py +# add user tincd +useradd tincd |