summaryrefslogtreecommitdiffstats
path: root/modules/retiolum
diff options
context:
space:
mode:
Diffstat (limited to 'modules/retiolum')
-rw-r--r--modules/retiolum/Makefile23
-rw-r--r--modules/retiolum/README13
-rwxr-xr-xmodules/retiolum/bin/addipv619
-rwxr-xr-xmodules/retiolum/bin/fillxx6
-rwxr-xr-xmodules/retiolum/build_debian.sh11
-rw-r--r--modules/retiolum/hosts/Lassulus9
-rw-r--r--modules/retiolum/hosts/alphalabs9
-rw-r--r--modules/retiolum/hosts/also9
-rw-r--r--modules/retiolum/hosts/foobaz8
-rw-r--r--modules/retiolum/hosts/kaah11
-rw-r--r--modules/retiolum/hosts/krebs10
-rw-r--r--modules/retiolum/hosts/miefda9019
-rw-r--r--modules/retiolum/hosts/miefdahome9
-rw-r--r--modules/retiolum/hosts/miefdat10
-rw-r--r--modules/retiolum/hosts/no_omo9
-rw-r--r--modules/retiolum/hosts/pa_sharepoint7
-rw-r--r--modules/retiolum/hosts/pfleidi9
-rw-r--r--modules/retiolum/hosts/pornocauster9
-rw-r--r--modules/retiolum/hosts/supernode10
-rw-r--r--modules/retiolum/hosts/tart6
-rw-r--r--modules/retiolum/scripts/README16
-rw-r--r--modules/retiolum/scripts/adv_graphgen/README28
-rwxr-xr-xmodules/retiolum/scripts/adv_graphgen/parse.py91
-rwxr-xr-xmodules/retiolum/scripts/adv_graphgen/sanitize.sh13
-rw-r--r--modules/retiolum/scripts/autostart/Makefile8
-rwxr-xr-xmodules/retiolum/scripts/autostart/tinc94
-rwxr-xr-xmodules/retiolum/scripts/tinc_multicast/retiolum34
-rwxr-xr-xmodules/retiolum/scripts/tinc_multicast/retiolum.py349
-rw-r--r--modules/retiolum/scripts/tinc_setup/README18
-rw-r--r--modules/retiolum/scripts/tinc_setup/bootstrap.sh11
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/build_arch.sh (renamed from modules/retiolum/build_arch.sh)0
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/build_debian.sh32
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/build_debian_clean.sh31
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/build_ec2.sh (renamed from modules/retiolum/build_ec2.sh)0
-rw-r--r--modules/retiolum/scripts/tinc_setup/build_no.de.sh (renamed from modules/retiolum/build_no.de.sh)0
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/install.sh (renamed from modules/retiolum/install.sh)9
36 files changed, 769 insertions, 171 deletions
diff --git a/modules/retiolum/Makefile b/modules/retiolum/Makefile
index 9bda5dfc..c1ebfe37 100644
--- a/modules/retiolum/Makefile
+++ b/modules/retiolum/Makefile
@@ -1,8 +1,15 @@
-all:
- mkdir -p /etc/tinc/retiolum
- git clone git://github.com/miefda/retiolum.git /etc/tinc/retiolum/hosts
- echo cd /etc/tinc/retiolum/hosts/.scripts
- echo "choose the right build script from here"
-update:
- cd /etc/tinc/retiolum/hosts
- git pull origin master
+.phony: update it all so install
+
+all: select-target
+
+it: so
+so: it
+
+/etc/tinc/retiolum/hosts:
+ cd $(dir $@) && git clone https://github.com/krebscode/hosts
+
+update: /etc/tinc/retiolum/hosts
+ cd $< && git pull
+
+install:
+ curl -k https://github.com/miefda/retiolum/raw/master/.scripts/tinc_setup/bootstrap.sh | sh
diff --git a/modules/retiolum/README b/modules/retiolum/README
deleted file mode 100644
index e6ae9454..00000000
--- a/modules/retiolum/README
+++ /dev/null
@@ -1,13 +0,0 @@
-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_ec2
- Amazon ec2 base instance build script
-4. install.sh
- configures the tinc daemon
- $1 is the nickname
- $2 is the ip-address
-hosts.tar contains the currently available hosts
diff --git a/modules/retiolum/bin/addipv6 b/modules/retiolum/bin/addipv6
new file mode 100755
index 00000000..da82e0d1
--- /dev/null
+++ b/modules/retiolum/bin/addipv6
@@ -0,0 +1,19 @@
+#! /bin/sh
+#
+# Add IPv6 to the retiolum interface.
+#
+# usage: addipv6
+#
+set -euf
+
+file=/etc/tinc/retiolum/hosts/`hostname`
+addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file`
+
+if test `id -u` != 0; then
+ echo "we're going sudo..." >&2
+ exec sudo "$0" "$@"
+ exit 23 # go to hell
+fi
+
+ip -6 addr add $addr dev retiolum
+ip -6 route add 42::/16 dev retiolum
diff --git a/modules/retiolum/bin/fillxx b/modules/retiolum/bin/fillxx
new file mode 100755
index 00000000..5e558362
--- /dev/null
+++ b/modules/retiolum/bin/fillxx
@@ -0,0 +1,6 @@
+#! /bin/sh
+while echo $1 | grep -q xx; do
+ xx=`od -An -tx1 -N 1 /dev/urandom | tr -d \ `
+ set -- `echo $1 | sed s/xx/$xx/`
+done
+echo $1
diff --git a/modules/retiolum/build_debian.sh b/modules/retiolum/build_debian.sh
deleted file mode 100755
index cb346b5f..00000000
--- a/modules/retiolum/build_debian.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-set -xe
-MYIP=10.7.7.66
-
-apt-get install -y install tinc git curl python git-core
-
-./install.sh `hostname` $MYIP
-
-# for autostart
-echo "retiolum" >> /etc/tinc/nets.boot
-echo "EXTRA=\"\"" >> /etc/default/tinc
diff --git a/modules/retiolum/hosts/Lassulus b/modules/retiolum/hosts/Lassulus
deleted file mode 100644
index 61c2d62b..00000000
--- a/modules/retiolum/hosts/Lassulus
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.11
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAsj1PCibKOfF68gmFQ+wwyfhUWpqKqpznrJX1dZ+daae7l7nBHvsE
-H0QwkiMmk3aZy1beq3quM6gX13aT+/wMfWnLyuvT11T5C9JEf/IS91STpM2BRN+R
-+P/DhbuDcW4UsdEe6uwQDGEJbXRN5ZA7GI0bmcYcwHJ9SQmW5v7P9Z3oZ+09hMD+
-1cZ3HkPN7weSdMLMPpUpmzCsI92cXGW0xRC4iBEt1ZeBwjkLCRsBFBGcUMuKWwVa
-9sovca0q3DUar+kikEKVrVy26rZUlGuBLobMetDGioSawWkRSxVlfZvTHjAK5JzU
-O6y6hj0yQ1sp6W2JjU8ntDHf63aM71dB9QIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/alphalabs b/modules/retiolum/hosts/alphalabs
deleted file mode 100644
index 6aea1dec..00000000
--- a/modules/retiolum/hosts/alphalabs
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.10
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAvUAbMmmOFn+4kOvJAvmi0R/XCQa1YBlkjUvC6Pmt0Q8gV1DodXjB
-DgwP8yhLcxaVy2Hk82aJvNTUrfMeB2sdt1RJHQiEPQkHthdp8Spm0Px4uTiMjmFB
-ev91xi00eCCGIKsXdh/qso1K7EDHt9MEVHOvSlkawWzoyJ6AaHStW1ElwDdGjZpl
-0YWrhx4Gk5X7pCp3LKkQJFfGtqoqGOVg2JjqK3qMsAdRo6QvYDqjFzARed/D0k55
-kcKXjBJAVxoU/CqGfS/Lr0fL8tdYgXaAXvPO9dbr1t0KyOUY2KRNBePeSvRp/etb
-H0LBPsO9F7PQiPI3DBoWCYgsuj/hBXapvwIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/also b/modules/retiolum/hosts/also
deleted file mode 100644
index 9f9dcd73..00000000
--- a/modules/retiolum/hosts/also
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.23
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAsnF1eyd/R4qXMGo8UEZ98hnJK+6ZEKUubgdzEwAuSxK40B6nX8Ry
-Euy3v3s0ps/GMdE52gUbFB+bhM99hHiKW+7zcxnoMJ69a9yK6VG0Im+7ib0WTliZ
-llgUfRETQd/2KaIfJWH/nVsBuK0hp1LscroWcoO08BCw6v94q3He8502Bk/ZYZQF
-wD7Y6LldipWKo/K9YtIU3zD3taj2NGnetOc0BRRncSgGiicXJKhtfcs+Ti2Y/ITz
-bFkHnFgB0KnhjwJBumxdmgjHWknlwVkROvmzIgyoXxqEw31bF+g/XzA7RTMXsiFM
-w0SZ15k4HG5L1PWpUyY2Th5yIjMW+sSrhQIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/foobaz b/modules/retiolum/hosts/foobaz
deleted file mode 100644
index 47ac4d6e..00000000
--- a/modules/retiolum/hosts/foobaz
+++ /dev/null
@@ -1,8 +0,0 @@
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEA4wJHcyS3PI2rugPbhQy5qLKQwtaOIsLV367b9Pq6VLKEly2dWAZx
-xvFmdKRbm/n/HaRzX+vyDuhWOxkzrF0NLNrrU58Rw5suHfNU2ryuO1QB2sIGMj1R
-QXwB+W6MNM5OamBkLLo740aPvVjfud9tc3yrUg6mTCJP1tbRLgHyDy6DT3s5WGvO
-R6bfYRjdzVLjwqqn5P/ED51gBgDmJEhoWzQ4IzBSO+mxRrkvwfPQNiTSrrQBAiU7
-r5lstDzEY8qDdwY6t1w91hxm34LLJ/gQr9uvXGF/GThm4J8Ndlj4tOl8UmFbo3Nz
-6Zm0b2JZ4dWbA/NXp7Sf9qKC5duQkAPb1QIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/kaah b/modules/retiolum/hosts/kaah
deleted file mode 100644
index d56014fa..00000000
--- a/modules/retiolum/hosts/kaah
+++ /dev/null
@@ -1,11 +0,0 @@
-Address = kaah.ath.cx
-Subnet = 10.7.7.21
-
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAtd9+R7NYs/5LmXoFakuoFzdO/8hy4MMeGjdDqbubKyJmIO/nvQWS
-TQns55znLgPIapUtCijxphoQrcTB5LijVXFj/2uipqiOJHVmhA80NiQgYhrFG++x
-9AQie2c04xqq+6Bptjs8vnQS6odLsBAiY1OJDpaEPZqzrpSMnYzEwPWqOAzzbVRd
-SFDokIhm62xmDK0+M4H8l3zmMnInnxdHd0fMhBJr5lXXqdzXJ3zluU6fZyHysF4c
-OnvFrGNrc3MPpgmzULVUUVg+Z4NeQYa5LuhXA9xia0R5d8ALCi34L4tAvCfSi1Lu
-RSUiJHeWDvNzwIy9+hxofqqcJqA05kyGLQIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/krebs b/modules/retiolum/hosts/krebs
deleted file mode 100644
index 4aba5105..00000000
--- a/modules/retiolum/hosts/krebs
+++ /dev/null
@@ -1,10 +0,0 @@
-Subnet = 10.7.7.156
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAl6vUmUL8w8r2gUTpUF8QWx0U3nzDPao2I7l0WU1NnGcR8DVug7YN
-595guvDkRGcM4eYGizgVYVvDCmjTQRXRn57ucVud2bGE1NGtdomVs6wggpgzLiaf
-m9BJwsigoCyMv+8ewGfc+D10TupulcIiZSp/RAewYlX0rhmgdsEGnCt+TWvXRsIa
-kY1pvt4YeKjs2ctib3OmaPuNokK4ophxSpdZ5arjHCaiVMj2O6pPAQbU7WFY63Fw
-UP64cAmtqBM+uMteT7bdG1jT3KZS6W7Dy8rIBd+pp+vB656A5PhrDcGEUMFSXqPD
-BwIxhV7OAejSn4XjrZyd5eNtMOQKopIMQwIDAQAB
------END RSA PUBLIC KEY-----
-
diff --git a/modules/retiolum/hosts/miefda901 b/modules/retiolum/hosts/miefda901
deleted file mode 100644
index a1b59a29..00000000
--- a/modules/retiolum/hosts/miefda901
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.22
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEApbEYmHf0vEDYa/2aVvWVxEGgC+JJlXcArdxkQooSIpnZfSAfsH0S
-MFz8v7UkM7EJSwDsFWf+gxyoAORdFpdQm+XQoDqWVZ1e0isYtNluP2C/51s3lu2F
-kVLZ+86el7zd4unHG+6CHmyaBcO5yV6VU8WFeuinB2+ojnujOWlHgOipMOrxsab8
-vwcH/0k/iR9BjH9xzo+kwhzqG0plLkQnvsvVyDN/gQj0Euz6YHfgo5c2gxQKKH7h
-Bv6prIxCbpY7WMMtg0z+OlyGkQefVRl18kZwoNtOFlh5NBe7imYcH+wyhhQ9rqnN
-VoHpJw4lNOuWfy3Af28kYDQ7KnPGYFq4nwIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/miefdahome b/modules/retiolum/hosts/miefdahome
deleted file mode 100644
index 9a9f4310..00000000
--- a/modules/retiolum/hosts/miefdahome
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.30
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAopwKn000XAcoI61OqQ7cjgrPHm/jHmuB1LHeCUggWMOD78WDFNzq
-8/l9ASlU9kbSZFhoMuBR5BPWgciYWsC1EqY1nRAc/Si1rUHnJw+Xcyl0MNsZ7Cef
-WaFRvC1VNC3qlQp5/e+fi46oOp4i+BqlFSxe7Jrr0EVyBVTOw8rMGToqDsOih6M9
-SFvmVMOnqh7n8LEOUtAL4nID59k7CTXzoNhXc0cEJoBkC2YCexonb4ru/J8F2BRG
-Y3yzHYVskBrrPie1JNhfUHGCABIbtODTiHQYH8NFTYzdBnVV88IWqiTBbmKcRf+j
-zEyGyXu/3YLFfjmsi7ysT+BWLIPvkyr7/wIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/miefdat b/modules/retiolum/hosts/miefdat
deleted file mode 100644
index 43e2a6e6..00000000
--- a/modules/retiolum/hosts/miefdat
+++ /dev/null
@@ -1,10 +0,0 @@
-Subnet = 10.7.7.20
-
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAvCestFRcrr10nzSzc1l4Flkv6ZG5ijGneZBeDaP+bB3GhFx0BYzP
-CQjcCFTcExVVAorknjX1/rjT60+dSBuJoH/pEeloPowtwm6YVgfhcQD/5qRHmAPF
-Ss1pdiTVtyi0BmcqDGoOTcR/tR4v2LBEDnxK89wWIFWbeDeR6UyjD2psbFBal8Zd
-TmkuBTg1OGPVhB+BmuKSqPBt6AtLV+0fKHdrTOVNwF2W/8lCVTd3uCVtnUEeTLrW
-KA8h9C0K2gAxxhJTF3pJtR/YQPpgwXRg3CfzMKsvHNOsqfMnnk/WFM0vrSJSi2El
-xCD5Pm/BPZyA8B4vhz8im4hWofOP2/JiNwIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/no_omo b/modules/retiolum/hosts/no_omo
deleted file mode 100644
index f2398f18..00000000
--- a/modules/retiolum/hosts/no_omo
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.111
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAuHQEeowvxRkoHJUw6cUp431pnoIy4MVv7kTLgWEK46nzgZtld9LM
-ZdNMJB9CuOVVMHEaiY6Q5YchUmapGxwEObc0y+8zQxTPw3I4q0GkSJqKLPrsTpkn
-sgEkHPfs2GVdtIBXDn9I8i5JsY2+U8QF8fbIQSOO08/Vpa3nknDAMege9yEa3NFm
-s/+x+2pS+xV6uzf/H21XNv0oufInXwZH1NCNXAy5I2V6pz7BmAHilVOGCT7g2zn6
-GasmofiYEnro4V5s8gDlQkb7bCZEIA9EgX/HP6fZJQezSUHcDCQFI0vg26xywbr6
-5+9tTn8fN2mWS5+Pdmx3haX1qFcBP5HglwIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/pa_sharepoint b/modules/retiolum/hosts/pa_sharepoint
deleted file mode 100644
index 384a7c22..00000000
--- a/modules/retiolum/hosts/pa_sharepoint
+++ /dev/null
@@ -1,7 +0,0 @@
-Address = pa-sharepoint.informatik.ba-stuttgart.de
-Subnet = 10.7.7.5
------BEGIN RSA PUBLIC KEY-----
-MIGJAoGBAKSle+5vi8j+auGIC41PwFRPdzuyhP/paAEht+9mWpTYYC1meyPDwQR8
-EPNLwj1ccjsAvhubfaDmI3B13cBQx5q1BbTCK81Y5RS1tj384kvAabJAtKsz3aIg
-1hWXjiDJUGNpQhKsD7IIg4lkkDcgOBAbdtXlynCQXdQL+YjLTavBAgMBAAE=
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/pfleidi b/modules/retiolum/hosts/pfleidi
deleted file mode 100644
index 416658cf..00000000
--- a/modules/retiolum/hosts/pfleidi
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.177
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAwdoS19bbKmVncJcf+uT5nNpyuR8SL9ekd+XMoKBpoqDf0r7ap3F2
-HLNI82NSbSAA4zdASrfrDl75sJ05VIIsueNAwMkFc72YNA9CPBFGcvCNVi0d4XcC
-t6voNrgCVaxT77MVBAnohT7+HfYmkTTSrLaDKusRx7ybz6ZaRO9i2peC2VWKVIjP
-m3QlvPeTpIJg/nGEBNO3rotBPxpMEB+fJnWxfBHRlt9klK3VhLaXCLUt5KcJ2SA4
-q3BFQbptUfI+d6OSA9btJerdtZ3PVBqlIJ45b3RDUWMborVg6jQ7S4WBzARe1eKs
-SHHk0aR5LoiSGiNVGTDlxLVe1UT1dF8voQIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/pornocauster b/modules/retiolum/hosts/pornocauster
deleted file mode 100644
index eee28777..00000000
--- a/modules/retiolum/hosts/pornocauster
+++ /dev/null
@@ -1,9 +0,0 @@
-Subnet = 10.7.7.42
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAnztrijsfao+fmNtwAjqwIDKsRaMP3ECsq2T2zqKvxwCyXk69G9bG
-RFhWjgaawS9ZhnHSlgWK/vtoR0O9NxpzdU/mvdQijbVGxM02DegjO9qDSIe8EGmA
-kscW4nDqYtw4rtjOVPfnNiWXbcWD8eiYR0kcSWmSvfOpVvdhTETqduTx5HRHyEFD
-JRQYR/tJSvVWXmM670PENAPNJFJ4VSJR60s5A+bFT7J/uw7HzJXX28LygJz73Dj2
-2a4ev0WcZQngLq072h/91R/TOpg+ogUDVhXkQtKyFj7im0287JTL4bXGofZBhzaf
-+h9dFGs1QLoNyhG/cgt9fog7boSXTelAiQIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/supernode b/modules/retiolum/hosts/supernode
deleted file mode 100644
index 5cee4e32..00000000
--- a/modules/retiolum/hosts/supernode
+++ /dev/null
@@ -1,10 +0,0 @@
-Address = 46.252.21.5
-Subnet = 10.7.7.1
------BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAr3DlBmQxP9UTBCkohK8FCYSk2td4Ov5lQYvC3Adx04lEWHfp+0nP
-sShYqqN9Aj3iCqj/DHx5jGuSqjyTmmFWIOMM9IwKMo2Oiz/PcBM56N6gzIHuR5wj
-+0bV0NRhePD2Tqo3zsEly9Hxw7xmz8azm5l4GcyOtgdRV7R1T3j/jB/9Kv2sj2Y7
-1zhSedCxjt/+NosiZZGE2JhLjzMgsCZSroAIKCZ3X/DP81mTTRxibjol82/Qn61I
-b7GbuuB7SwjtZ+9xjsExN1JX5+AFuw9a3AkYuKWLpP50YY16/OTPq7flmB/EtK+Z
-rrESIYKtX7pJbLc8Ywi0hBL5oPm07q+0BQIDAQAB
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/hosts/tart b/modules/retiolum/hosts/tart
deleted file mode 100644
index 986140ee..00000000
--- a/modules/retiolum/hosts/tart
+++ /dev/null
@@ -1,6 +0,0 @@
-Subnet = 10.7.7.123
------BEGIN RSA PUBLIC KEY-----
-MIGJAoGBALvZ4rLz0soCzkyOraC1aKtJzfVqYd2je6rkuaV12CLybCUc6YXaW/HP
-rzJyDGmdh355kU4FNNyjnWP/U/juhMaeYFyTUWCRVXdqvDdeiEe/EJ0g+fFGKvPY
-DEFo3VMCEkrXKuwDBQP02b4xmAWWnVBityGv5tgDFjl9uXh/SzL1AgMBAAE=
------END RSA PUBLIC KEY-----
diff --git a/modules/retiolum/scripts/README b/modules/retiolum/scripts/README
new file mode 100644
index 00000000..4dbb42af
--- /dev/null
+++ b/modules/retiolum/scripts/README
@@ -0,0 +1,16 @@
+This Folder contains all the cool scripts created for tinc_retiolum
+
+currently the following functions are deployed:
+
+adv_graphgen/ - makefu
+ this folder contains a script suite which parses the interesting
+ parameters from the syslog file by sending SIGUSR2 to the tinc process
+
+tinc_multicast/ - Miefda,Lassulus
+ A tinc multicast script suite which provides automagic-discovery in a
+ local network by utilizing multicast
+
+tinc_setup/ - makefu (i am so sorry...)
+ A number of scripts which build and configure tinc on a local machine.
+ Core is the install.sh script which actually writes the configuration
+ and creates users as well as private/public keys
diff --git a/modules/retiolum/scripts/adv_graphgen/README b/modules/retiolum/scripts/adv_graphgen/README
new file mode 100644
index 00000000..082e0f2b
--- /dev/null
+++ b/modules/retiolum/scripts/adv_graphgen/README
@@ -0,0 +1,28 @@
+The folder contains a number of scripts which provide a convenient way to
+generate advanced graphs from the SIGUSR2 output of tinc.
+
+it currently contains the following files:
+
+sanitize.sh:
+ wrapper arond parse.py which filters the syslog file for all tinc
+ related lines and removes the status informations:
+ this means that
+ <code>
+ May 19 20:40:44 servarch dnsmasq[5382]: reading /etc/resolv.conf
+ May 19 20:41:38 servarch tinc.retiolum[4780]: Error looking up pa-sharepoint.informatik.ba-stuttgart.de port 655: Name or service not known
+ </code>
+ becomes
+ <code>
+ Error looking up pa-sharepoint.informatik.ba-stuttgart.de port 655: Name or service not known
+ </code>
+ and so on.
+ It also provides a wrapper around graphviz which automagically
+ generates graphs from the produced graph file
+
+parse.py:
+ reads from stdin the sanitized syslog file and prints a valid dot file
+ from the given output.
+ The parser module may also produce any other output (e.g. for dns
+ entries and so on) you will need to actually read and modify the source
+ in order to be able to do this. ~May the source be with you~
+
diff --git a/modules/retiolum/scripts/adv_graphgen/parse.py b/modules/retiolum/scripts/adv_graphgen/parse.py
new file mode 100755
index 00000000..04b42c33
--- /dev/null
+++ b/modules/retiolum/scripts/adv_graphgen/parse.py
@@ -0,0 +1,91 @@
+#!/usr/bin/python2
+# -*- coding: utf8 -*-
+
+import sys
+""" TODO: Refactoring needed to pull the edges out of the node structures again,
+it should be easier to handle both structures"""
+
+def write_digraph(nodes):
+ """
+ writes the complete digraph in dot format
+ """
+ print ('digraph retiolum {')
+ print (' node[shape=box,style=filled,fillcolor=grey]')
+ generate_stats(nodes)
+ merge_edges(nodes)
+ for k,v in nodes.iteritems():
+ write_node(k,v)
+ print ('}')
+def generate_stats(nodes):
+ """ Generates some statistics of the network and nodes
+ """
+ for k,v in nodes.iteritems():
+ v['num_conns'] = len(v.get('to',[]))
+
+def merge_edges(nodes):
+ """ merge back and forth edges into one
+ DESTRUCTS the current structure by deleting "connections" in the nodes
+
+ """
+ for k,v in nodes.iteritems():
+ for con in v.get('to',[]):
+ for i,secon in enumerate(nodes[con['name']].get('to',[])):
+ if k == secon['name']:
+ del (nodes[con['name']]['to'][i])
+ con['bidirectional'] = True
+
+
+def write_node(k,v):
+ """ 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"
+ if v.has_key('num_conns'):
+ node += "Num Connects:"+str(v['num_conns'])+"\\l"
+
+ node += "internal:"+v.get('internal-ip','¯\\\\(°_o)/¯')+"\\l\""
+ if v['external-ip'] == "MYSELF":
+ node += ",fillcolor=steelblue1"
+ node += "]"
+ print (node)
+ for con in v.get('to',[]):
+ 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:
+ line = line.replace('\n','')
+ if line == 'Nodes:':
+ nodes={}
+ for line in sys.stdin:
+ if line == 'End of nodes.\n':
+ break
+ l = line.replace('\n','').split() #TODO unhack me
+ nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] }
+ if line == 'Subnet list:':
+ for line in sys.stdin:
+ if line == 'End of subnet list.\n':
+ break
+ l = line.replace('\n','').split()
+ nodes[l[2]]['internal-ip'] = l[0].split('#')[0]
+ if line == 'Edges:':
+ edges = {}
+ for line in sys.stdin:
+ if line == 'End of edges.\n':
+ break
+ l = line.replace('\n','').split()
+
+ if not nodes[l[0]].has_key('to') :
+ nodes[l[0]]['to'] = []
+ nodes[l[0]]['to'].append(
+ {'name':l[2],'addr':l[4],'port':l[6],'weight' : l[10] })
+ return nodes
+nodes = parse_input()
+write_digraph(nodes)
diff --git a/modules/retiolum/scripts/adv_graphgen/sanitize.sh b/modules/retiolum/scripts/adv_graphgen/sanitize.sh
new file mode 100755
index 00000000..88591b67
--- /dev/null
+++ b/modules/retiolum/scripts/adv_graphgen/sanitize.sh
@@ -0,0 +1,13 @@
+GRAPH_SETTER1=dot
+GRAPH_SETTER2=circo
+LOG_FILE=/var/log/everything.log
+OPENER=/bin/true
+
+sudo pkill -USR2 tincd
+sudo sed -n '/tinc.retiolum/{s/.*tinc.retiolum\[[0-9]*\]: //gp}' $LOG_FILE |\
+ ./parse.py > retiolum.dot
+
+$GRAPH_SETTER1 -Tpng -o $1retiolum_1.png retiolum.dot
+$GRAPH_SETTER2 -Tpng -o $1retiolum_2.png retiolum.dot
+$OPENER retiolum_1.png &>/dev/null
+rm retiolum.dot
diff --git a/modules/retiolum/scripts/autostart/Makefile b/modules/retiolum/scripts/autostart/Makefile
new file mode 100644
index 00000000..7ca589e1
--- /dev/null
+++ b/modules/retiolum/scripts/autostart/Makefile
@@ -0,0 +1,8 @@
+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
diff --git a/modules/retiolum/scripts/autostart/tinc b/modules/retiolum/scripts/autostart/tinc
new file mode 100755
index 00000000..12e77d6a
--- /dev/null
+++ b/modules/retiolum/scripts/autostart/tinc
@@ -0,0 +1,94 @@
+#! /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=""
+
+modprobe tun
+
+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
+
diff --git a/modules/retiolum/scripts/tinc_multicast/retiolum b/modules/retiolum/scripts/tinc_multicast/retiolum
new file mode 100755
index 00000000..1d6b775f
--- /dev/null
+++ b/modules/retiolum/scripts/tinc_multicast/retiolum
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+TINCNAME='retiolum'
+case "$1" in
+ start)
+ stat_busy "Starting retiolum Daemon"
+ success=0
+ /home/death/git/retiolum/.scripts/tinc_multicast/retiolum.py -n retiolum -T &
+ sleep 2
+ if [ $success -eq 0 ]; then
+ add_daemon retiolum
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping retiolum Daemon"
+ kill `cat /var/lock/retiolum.retiolum`
+ rm_daemon retiolum
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 4
+ $0 start
+ ;;
+ *)
+ echo "usage $0 {start¦stop¦restart}"
+esac
+exit 0
diff --git a/modules/retiolum/scripts/tinc_multicast/retiolum.py b/modules/retiolum/scripts/tinc_multicast/retiolum.py
new file mode 100755
index 00000000..8cf57471
--- /dev/null
+++ b/modules/retiolum/scripts/tinc_multicast/retiolum.py
@@ -0,0 +1,349 @@
+#!/usr/bin/python2
+import sys, os, time, signal, socket, subprocess, thread, random, Queue, binascii, logging, hashlib, urllib2 #these should all be in the stdlib
+from optparse import OptionParser
+
+def pub_encrypt(hostname_t, text): #encrypt data with public key
+ logging.debug("encrypt: " + text)
+ if hostname_t.find("`") != -1: return(-1)
+ try:
+ enc_text = subprocess.os.popen("echo '" + text + "' | openssl rsautl -pubin -inkey /etc/tinc/" + netname + "/hosts/.pubkeys/" + hostname_t + " -encrypt | base64 -w0")
+ return(enc_text.read())
+ except:
+ return(-1)
+
+def priv_decrypt(enc_data): #decrypt data with private key
+ if enc_data.find("`") != -1: return(-1)
+ dec_text = subprocess.os.popen("echo '" + enc_data + "' | base64 -d | openssl rsautl -inkey /etc/tinc/" + netname + "/rsa_key.priv -decrypt")
+ return(dec_text.read())
+
+def address2hostfile(hostname, address): #adds address to hostsfile or restores it if address is empty
+ hostfile = "/etc/tinc/" + netname + "/hosts/" + hostname
+ addr_file = open(hostfile, "r")
+ addr_cache = addr_file.readlines()
+ addr_file.close()
+ if address != "":
+ addr_cache.insert(0, "Address = " + address + "\n")
+ addr_file = open(hostfile, "w")
+ addr_file.writelines(addr_cache)
+ addr_file.close
+ logging.info("sending SIGHUP to tinc deamon!")
+ tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True)
+ else:
+ recover = subprocess.os.popen("tar xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/ " + hostname)
+
+def findhostinlist(hostslist, hostname, ip): #finds host + ip in list
+ for line in xrange(len(hostslist)):
+ if hostname == hostslist[line][0] and ip == hostslist[line][1]:
+ return line
+ return -1 #nothing found
+
+def getHostname(netname):
+ tconf = open("/etc/tinc/" + netname + "/tinc.conf", "r")
+ feld = tconf.readlines()
+ tconf.close()
+ for x in feld:
+ if x.startswith("Name"):
+ return str(x.partition("=")[2].lstrip().rstrip("\n"))
+
+ print("hostname not found!")
+ return -1 #nothing found
+
+def get_hostfiles(url_files, url_md5sum):
+ try:
+ get_hosts_tar = urllib2.urlopen(url_files)
+ get_hosts_md5 = urllib2.urlopen(url_md5sum)
+ hosts_tar = get_hosts_tar.read()
+ hosts_md5 = get_hosts_md5.read()
+
+ if str(hosts_md5) == str(hashlib.md5(hosts_tar).hexdigest() + " hosts.tar.gz\n"):
+ hosts = open("/etc/tinc/" + netname + "/hosts/hosts.tar.gz", "w")
+ hosts.write(hosts_tar)
+ hosts.close()
+ else:
+ logging.error("hosts.tar.gz md5sum check failed!")
+ except:
+ logging.error("hosts file download failed!")
+
+
+####Thread functions
+
+
+def sendthread(sendfifo, ghostmode): #send to multicast, sends keep alive packets
+ while True:
+ try:
+ #{socket init start
+ ANY = "0.0.0.0"
+ SENDPORT = 23542
+ MCAST_ADDR = "224.168.2.9"
+ MCAST_PORT = 1600
+
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) #initalize socket with udp
+ sock.bind((ANY,SENDPORT)) #now bound to Interface and Port
+ sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255) #activate multicast
+ #}socket init end