From 040b3664d770bcc8b3abdace95dc332ec3327807 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Nov 2012 14:23:06 +0100 Subject: retiolum/hosts: add casino --- retiolum/hosts/casino | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/casino diff --git a/retiolum/hosts/casino b/retiolum/hosts/casino new file mode 100644 index 00000000..e35691c3 --- /dev/null +++ b/retiolum/hosts/casino @@ -0,0 +1,11 @@ +Subnet = 10.243.0.233 +Subnet = 42:3c1f:ea16:e181:7ab2:c51a:8892:7fb7/128 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAzmZ7x4HVpW8RC3ZkwmNKY/6VGlMKQbpBQtmrUzV1XFxKWZRhH3VI +NOqlfVpTEaRTorht7R8F1aw9psDDUcg7yuQFcUdoXxBJxwbc1h0FKyZZr5kAIfpS +ObE0rbBRRqJVAWgztpQAalWC95D73y/+tpHnQ+LRFq9IWeX5+QobaSym1oG4Y0Jz +STSbw2ksjH8CuWHS5TjZr50Nyx6cH99HABDnadxhLBtQriJPSYRYdWyp7tYrW3jd +As28mxkyFj0sFV3IJ/bYfZD9KSGg1KjQu+c73xKOBUhNtSHFjUzN5myYGd/nWCw8 +0PUReLrWC1ZHYPzqiwelTHcNJ3UcojpO9wIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From a781abb96d1f03cdb558c62a8f52d4f1f0753c1e Mon Sep 17 00:00:00 2001 From: Lassulus Date: Fri, 23 Nov 2012 23:44:20 +0100 Subject: added juhulian --- retiolum/hosts/juhulian | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/juhulian diff --git a/retiolum/hosts/juhulian b/retiolum/hosts/juhulian new file mode 100644 index 00000000..eca4e873 --- /dev/null +++ b/retiolum/hosts/juhulian @@ -0,0 +1,11 @@ +Subnet = 10.243.0.38 +Subnet = 42:449f:b00a:e973:514c:3e9f:97ed:aac2/128 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAnNyOsNItOzNQndheZ3ppOMWvIOuO1wgLXArINS1ORcgIAJmLpqDI +whsZFCVifwAXsdeBJyyZOPZrc2PQ4F3KB9ByX6PQ9jqAhun1aE9SDDqp+woOrTlP +BtJ/8zAmRhrfak61TxpeTndLk95xOLaCwvS2P4SJLIcyutTbbFdBCqpu7cFUGOOP +qCKLX7/mv2L+GNmQAnWZ5HwXQzBS6gNaNIcQ8mPCUAIZgRU2T83x/tnyH1RlATK2 +lYUWRM0ie+dRMhiDcwmmZrwYl8wzyvuBPEr/p8ZBM2tua8GlQzJUJl44AiAcx3w9 +0EB5MIRL5Qb0yBvXD0yR+bDizqvhd40LvQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 105cff1f36a13e76013309e928a2704bdea2de7e Mon Sep 17 00:00:00 2001 From: Lassulus Date: Wed, 28 Nov 2012 05:21:19 +0100 Subject: doc about highpings --- retiolum/doc/highping | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 retiolum/doc/highping diff --git a/retiolum/doc/highping b/retiolum/doc/highping new file mode 100644 index 00000000..e3d9a47c --- /dev/null +++ b/retiolum/doc/highping @@ -0,0 +1,2 @@ +in der tinc.conf darf nicht zu einem Host connectet werden der einen DNS namen benutzt. +wenn ein nicht erreichbarer DNS name versucht wird zu erreichen pausiert tinc jedesmal alle transfers bis der DNS-Request einen Timeout hat. -- cgit v1.2.3 From 50d63b50779bca78978d5ac1049604a4c6d37c69 Mon Sep 17 00:00:00 2001 From: euer Date: Wed, 28 Nov 2012 09:47:52 +0100 Subject: pigstarter - remove dns entry --- retiolum/hosts/pigstarter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/hosts/pigstarter b/retiolum/hosts/pigstarter index 838d9587..6904f4e0 100644 --- a/retiolum/hosts/pigstarter +++ b/retiolum/hosts/pigstarter @@ -1,5 +1,5 @@ Address = 5.45.180.187 -Address = pigstarter.de +#Address = pigstarter.de Subnet = 10.243.0.153 Subnet = 42:9143:b4c0:f981:6030:7aa2:8bc5:4110/128 -----BEGIN RSA PUBLIC KEY----- -- cgit v1.2.3 From 98dab8c9585c59005466fa14f25d6094e32f8d11 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Wed, 28 Nov 2012 15:19:03 +0100 Subject: DNS -> IP --- retiolum/hosts/pico | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/hosts/pico b/retiolum/hosts/pico index 8fc732b8..b08b450d 100644 --- a/retiolum/hosts/pico +++ b/retiolum/hosts/pico @@ -1,4 +1,4 @@ -Address = pu11.de +Address = 78.111.78.33 Subnet = 10.243.0.102/32 Subnet = 42:b103:275c:1723:edc8:b24d:452b:352a/128 -----BEGIN RSA PUBLIC KEY----- -- cgit v1.2.3 From 2860ed57fd203716c5cf4b2c5e02e79b5d3dce58 Mon Sep 17 00:00:00 2001 From: euer Date: Thu, 29 Nov 2012 16:39:44 +0100 Subject: add find_super script to find valid supernodes fix stderr issues --- retiolum/scripts/adv_graphgen/find_super.py | 50 +++++++++++++++++++++++ retiolum/scripts/adv_graphgen/parse_tinc_anon.py | 4 +- retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 12 +++--- 3 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 retiolum/scripts/adv_graphgen/find_super.py diff --git a/retiolum/scripts/adv_graphgen/find_super.py b/retiolum/scripts/adv_graphgen/find_super.py new file mode 100644 index 00000000..df01734e --- /dev/null +++ b/retiolum/scripts/adv_graphgen/find_super.py @@ -0,0 +1,50 @@ +#!/usr/bin/python + +def find_super(path="/etc/tinc/retiolum/hosts"): + import os + import re + + needle_addr = re.compile("Address\s*=\s*(.*)") + needle_port = re.compile("Port\s*=\s*(.*)") + for f in os.listdir(path): + with open(path+"/"+f) as of: + addrs = [] + port = "655" + + for line in of.readlines(): + + addr_found = needle_addr.match(line) + if addr_found: + addrs.append(addr_found.group(1)) + + port_found = needle_port.match(line) + if port_found: + port = port_found.group(1) + + if addrs : yield (f ,[(addr ,int(port)) for addr in addrs]) + +def check_super(path="/etc/tinc/retiolum/hosts"): + from socket import socket,AF_INET,SOCK_STREAM + for host,addrs in find_super(path): + valid_addrs = [] + for addr in addrs: + try: + s = socket(AF_INET,SOCK_STREAM) + s.settimeout(3) + s.connect(addr) + #print("success connecting %s:%d"%(addr)) + s.settimeout(None) + s.close() + valid_addrs.append(addr) + except Exception as e: + pass + #print("cannot connect to %s:%d"%(addr)) + if valid_addrs: yield (host,valid_addrs) + + +if __name__ == "__main__": + """ + usage + """ + for host,addrs in check_super(): + print host,addrs diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py index e0bea913..21c36e0f 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py @@ -15,7 +15,7 @@ try: sys.stderr.write("connecting to %s:%d"%(host,port)) s.connect((host,port)) except Exception as e: - print >>sys.stderr, "Cannot connect to graphite: " + str(e) + sys.stderr.write( "Cannot connect to graphite: " + str(e)) """ TODO: Refactoring needed to pull the edges out of the node structures again, it should be easier to handle both structures""" DUMP_FILE = "/krebs/db/availability" @@ -151,4 +151,4 @@ try: msg = '%s.graph.anon_build_time %d %d\r\n' % (g_path,((end-begin)*1000),end) s.send(msg) s.close() -except Exception as e: print >>sys.stderr, e +except Exception as e: pass diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py index 16f4f795..8371ad3d 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py @@ -2,6 +2,7 @@ # -*- coding: utf8 -*- from BackwardsReader import BackwardsReader import sys,json +from find_super import check_super try: from time import time import socket @@ -16,7 +17,10 @@ try: except Exception as e: sys.stderr.write("Cannot connect to graphite: %s\n" % str(e)) -supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] +supernodes= [ ] +#supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] +for supernode,addr in check_super(): + supernodes.append(supernode) """ TODO: Refactoring needed to pull the edges out of the node structures again, it should be easier to handle both structures""" DUMP_FILE = "/krebs/db/availability" @@ -53,8 +57,7 @@ def write_stat_node(nodes): try: msg = '%s.num_nodes %d %d\r\n' %(g_path,num_nodes,begin) s.send(msg) - #print >>sys.stderr, msg - except Exception as e: print sys.stderr,e + except Exception as e: pass #except: pass for k,v in nodes.iteritems(): num_conns+= len(v['to']) @@ -82,8 +85,7 @@ def generate_stats(nodes): jlines.append(jline) lines_to_use -=1 - except Exception,e: - sys.stderr.write(str(e)) + except Exception,e: sys.stderr.write(str(e)) for k,v in nodes.iteritems(): conns = v.get('to',[]) for c in conns: #sanitize weights -- cgit v1.2.3 From 9df3e874598a68873df94ffa344e3c172824736a Mon Sep 17 00:00:00 2001 From: euer Date: Thu, 29 Nov 2012 17:36:05 +0100 Subject: add github_listener a listener which fires create-host-tar every time being hit by github webhook --- retiolum/bin/create-host-tar | 8 ++++++++ retiolum/scripts/github_listener/github_listener.conf | 3 +++ retiolum/scripts/github_listener/listen | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100755 retiolum/bin/create-host-tar create mode 100644 retiolum/scripts/github_listener/github_listener.conf create mode 100755 retiolum/scripts/github_listener/listen diff --git a/retiolum/bin/create-host-tar b/retiolum/bin/create-host-tar new file mode 100755 index 00000000..344109d1 --- /dev/null +++ b/retiolum/bin/create-host-tar @@ -0,0 +1,8 @@ +#!/bin/sh +set -xeuf +WEBDIR=${WEBDIR:-/srv/http/pub/retiolum} +HOSTFILE=$WEBDIR/hosts.tar +cd $(dirname $(readlink -f $0)) +#rm $HOSTFILE +tar cf $HOSTFILE -C ../hosts . +chmod a+rx $HOSTFILE diff --git a/retiolum/scripts/github_listener/github_listener.conf b/retiolum/scripts/github_listener/github_listener.conf new file mode 100644 index 00000000..d1f2dae4 --- /dev/null +++ b/retiolum/scripts/github_listener/github_listener.conf @@ -0,0 +1,3 @@ +[program:github_listener] +command=/krebs/retiolum/scripts/github_listener/listen 5432 +user=nobody diff --git a/retiolum/scripts/github_listener/listen b/retiolum/scripts/github_listener/listen new file mode 100755 index 00000000..c701d14b --- /dev/null +++ b/retiolum/scripts/github_listener/listen @@ -0,0 +1,6 @@ +#!/bin/sh +PORT=${1:-5432} +# eloop pattern +while sleep 1; do + nc -l -p $PORT -e /krebs/retiolum/bin/create-host-tar && logger "successfully built retiolum hosts tarball" +done -- cgit v1.2.3 From 1fa6c7a186a97f833028e4dcb4ec63d631cffa22 Mon Sep 17 00:00:00 2001 From: euer Date: Thu, 29 Nov 2012 18:00:33 +0100 Subject: github_listener: add README --- retiolum/scripts/github_listener/README | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 retiolum/scripts/github_listener/README diff --git a/retiolum/scripts/github_listener/README b/retiolum/scripts/github_listener/README new file mode 100644 index 00000000..ad43031c --- /dev/null +++ b/retiolum/scripts/github_listener/README @@ -0,0 +1,18 @@ +GITHUB_LISTENER +=============== + +The github listener is an application which listens for github post-receive +hook calls and runs a script each time currently the github listener is +used to create a tarball of all nodes in the retiolum darknet. the current +tarball can be retrieved at http://euer.krebsco.de/retiolum/hosts.tar + +listen script +============= + +the listen script is a quick hack which runs netcat in an e-loop together +with a "logger" command to signalise successful tarball generation. + + +github_listener.conf +=================== +the supervisor config file -- cgit v1.2.3 From 53cfad1bcfe41fa1f7d8e12ffc5b0f992b2fbc0f Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 6 Dec 2012 15:39:55 +0100 Subject: //retiolum/bin/dump-graph: get graph from journald --- retiolum/bin/dump-graph | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 retiolum/bin/dump-graph diff --git a/retiolum/bin/dump-graph b/retiolum/bin/dump-graph new file mode 100755 index 00000000..87539f49 --- /dev/null +++ b/retiolum/bin/dump-graph @@ -0,0 +1,9 @@ +#! /bin/sh +set -euf + +t0="`date '+%Y-%m-%d %H:%M:%S'`" +systemctl kill --signal=USR2 tincd@retiolum +sleep 5 +journalctl --since="$t0" | sed -n ' + s/.*tinc\.retiolum\[[0-9]\+\]: \([^ ]\+\) to \([^ ]\+\) at \([^ ]\+\) .*$/\1 \2 \3/p +' -- cgit v1.2.3 From c68a8ffec051830f7b1b357d7c583c1dd96804fb Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 6 Dec 2012 20:16:34 +0100 Subject: added cronjob --- retiolum/doc/cronjob | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 retiolum/doc/cronjob diff --git a/retiolum/doc/cronjob b/retiolum/doc/cronjob new file mode 100644 index 00000000..7b173633 --- /dev/null +++ b/retiolum/doc/cronjob @@ -0,0 +1,3 @@ +cron-eintrag fuer automatisches hosts-update + +if ping -c 1 euer.krebsco.de -W 5 &>/dev/null; then (curl euer.krebsco.de/hosts.tar | tar xk -C /etc/tinc/retiolum/hosts/);fi -- cgit v1.2.3 From d0eefeb2d8c345fc204111cd6ea49dedb25ea2f5 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 6 Dec 2012 22:21:03 +0100 Subject: removed TodesBrot --- retiolum/hosts/TodesBrot | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 retiolum/hosts/TodesBrot diff --git a/retiolum/hosts/TodesBrot b/retiolum/hosts/TodesBrot deleted file mode 100644 index f76b72b2..00000000 --- a/retiolum/hosts/TodesBrot +++ /dev/null @@ -1,9 +0,0 @@ -Subnet = 10.243.0.12/32 ------BEGIN RSA PUBLIC KEY----- -MIIBCgKCAQEAzGIijXaoIRG09v5sIXyVdqdpDruPMqKJfvZUXCF/POMCZEsZ4tjd -jHHdbTfREExvSNBUxS6GaYwg/HR2R7nprzOazSN9kzp9fmFJofbCOxz6X/8O/fMM -gTBmZzYu4cfysjTD5tsrJp/dQOZ0wKpUXBOWWWDUTLM9Zo3+6Bxe/6pN+gphvl6m -ReIAwl34QkZ24mq1W4YZofU2PxLxnhtuBgXuJRfn8FDlgKKPhPpKX070J5pamzpp -1/Idxl0zTmoKeXWhJ0wY0SNeglaWgH1P2EeNUNoVEX4Egk4XQGkzOfShRG7zoJMA -tKJlNZOw/4EF3E/IM8mG1yG3NqtFlIyNYQIDAQAB ------END RSA PUBLIC KEY----- -- cgit v1.2.3 From bedf7d79f297e3584757e8ebf3995aafd46daf7a Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 6 Dec 2012 23:11:49 +0100 Subject: removed carriage returns --- retiolum/hosts/juhulian | 22 +++++++++++----------- retiolum/hosts/laqueus | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/retiolum/hosts/juhulian b/retiolum/hosts/juhulian index eca4e873..d9da75aa 100644 --- a/retiolum/hosts/juhulian +++ b/retiolum/hosts/juhulian @@ -1,11 +1,11 @@ -Subnet = 10.243.0.38 -Subnet = 42:449f:b00a:e973:514c:3e9f:97ed:aac2/128 - ------BEGIN RSA PUBLIC KEY----- -MIIBCgKCAQEAnNyOsNItOzNQndheZ3ppOMWvIOuO1wgLXArINS1ORcgIAJmLpqDI -whsZFCVifwAXsdeBJyyZOPZrc2PQ4F3KB9ByX6PQ9jqAhun1aE9SDDqp+woOrTlP -BtJ/8zAmRhrfak61TxpeTndLk95xOLaCwvS2P4SJLIcyutTbbFdBCqpu7cFUGOOP -qCKLX7/mv2L+GNmQAnWZ5HwXQzBS6gNaNIcQ8mPCUAIZgRU2T83x/tnyH1RlATK2 -lYUWRM0ie+dRMhiDcwmmZrwYl8wzyvuBPEr/p8ZBM2tua8GlQzJUJl44AiAcx3w9 -0EB5MIRL5Qb0yBvXD0yR+bDizqvhd40LvQIDAQAB ------END RSA PUBLIC KEY----- +Subnet = 10.243.0.38 +Subnet = 42:449f:b00a:e973:514c:3e9f:97ed:aac2/128 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAnNyOsNItOzNQndheZ3ppOMWvIOuO1wgLXArINS1ORcgIAJmLpqDI +whsZFCVifwAXsdeBJyyZOPZrc2PQ4F3KB9ByX6PQ9jqAhun1aE9SDDqp+woOrTlP +BtJ/8zAmRhrfak61TxpeTndLk95xOLaCwvS2P4SJLIcyutTbbFdBCqpu7cFUGOOP +qCKLX7/mv2L+GNmQAnWZ5HwXQzBS6gNaNIcQ8mPCUAIZgRU2T83x/tnyH1RlATK2 +lYUWRM0ie+dRMhiDcwmmZrwYl8wzyvuBPEr/p8ZBM2tua8GlQzJUJl44AiAcx3w9 +0EB5MIRL5Qb0yBvXD0yR+bDizqvhd40LvQIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/retiolum/hosts/laqueus b/retiolum/hosts/laqueus index cf4ecad5..0bdef307 100644 --- a/retiolum/hosts/laqueus +++ b/retiolum/hosts/laqueus @@ -1,5 +1,5 @@ -Subnet = 42:0:0:0:0:0:0:1a1a/128 -Subnet = 10.243.0.12/32 +Subnet = 42:0:0:0:0:0:0:1a1a/128 +Subnet = 10.243.0.12/32 -----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEAy9lnH4qDSYeNbpzpcQyq2LzzxkVy2N1vGgKkVttzx0cgMvyRm3aX -- cgit v1.2.3 From dfe735f225f409eb01def7691a42a69c882366b8 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Fri, 7 Dec 2012 15:54:31 +0100 Subject: fixed url, added gzip --- retiolum/doc/cronjob | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/doc/cronjob b/retiolum/doc/cronjob index 7b173633..356b5c96 100644 --- a/retiolum/doc/cronjob +++ b/retiolum/doc/cronjob @@ -1,3 +1,3 @@ cron-eintrag fuer automatisches hosts-update -if ping -c 1 euer.krebsco.de -W 5 &>/dev/null; then (curl euer.krebsco.de/hosts.tar | tar xk -C /etc/tinc/retiolum/hosts/);fi +if ping -c 1 euer.krebsco.de -W 5 &>/dev/null; then (curl http://euer.krebsco.de/retiolum/hosts.tar.gz | tar xzk -C /etc/tinc/retiolum/hosts/);fi -- cgit v1.2.3 From 8b31b7db47438b72504915efa062702ff99860f6 Mon Sep 17 00:00:00 2001 From: euer Date: Fri, 7 Dec 2012 15:56:32 +0100 Subject: update create-host-tar now using gzip --- retiolum/bin/create-host-tar | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retiolum/bin/create-host-tar b/retiolum/bin/create-host-tar index 344109d1..305f174c 100755 --- a/retiolum/bin/create-host-tar +++ b/retiolum/bin/create-host-tar @@ -1,8 +1,8 @@ #!/bin/sh set -xeuf WEBDIR=${WEBDIR:-/srv/http/pub/retiolum} -HOSTFILE=$WEBDIR/hosts.tar +HOSTFILE=$WEBDIR/hosts.tar.gz cd $(dirname $(readlink -f $0)) #rm $HOSTFILE -tar cf $HOSTFILE -C ../hosts . +tar czf $HOSTFILE -C ../hosts . chmod a+rx $HOSTFILE -- cgit v1.2.3 From 24ba220c53ef38e74d6c68b92c13b28ece999269 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Fri, 7 Dec 2012 16:59:24 +0100 Subject: added more info --- retiolum/doc/cronjob | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/retiolum/doc/cronjob b/retiolum/doc/cronjob index 356b5c96..3f640311 100644 --- a/retiolum/doc/cronjob +++ b/retiolum/doc/cronjob @@ -1,3 +1,7 @@ cron-eintrag fuer automatisches hosts-update +ueberschreibt keine bearbeitete host-dateien if ping -c 1 euer.krebsco.de -W 5 &>/dev/null; then (curl http://euer.krebsco.de/retiolum/hosts.tar.gz | tar xzk -C /etc/tinc/retiolum/hosts/);fi + +ueberschreibt bearbeitete hostdateien +if ping -c 1 euer.krebsco.de -W 5 &>/dev/null; then (curl http://euer.krebsco.de/retiolum/hosts.tar.gz | tar xz -C /etc/tinc/retiolum/hosts/);fi -- cgit v1.2.3 From a417442f720a1590fc16af93af421a06a00200ea Mon Sep 17 00:00:00 2001 From: Lassulus Date: Fri, 7 Dec 2012 19:17:15 +0100 Subject: added new installer WIP --- retiolum/scripts/tinc_setup/new_install.sh | 158 +++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100755 retiolum/scripts/tinc_setup/new_install.sh diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh new file mode 100755 index 00000000..ab42aedc --- /dev/null +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -0,0 +1,158 @@ +#!/bin/sh + +usage() +{ +cat << EOF +usage $0 options +This script gets you into the KREBS Darknet +all parameters are optional + +Options: + -h Show this message(haha) + -4 \$ipv4 specify an ip(version 4), this also disables random ip mode, default is random + -t \$DIR Choose another Temporary directory, default is /tmp/tinc-install-fu + -o \$HOST Choose another Hostname, default is your system hostname + -n \$NET Choose another tincd netname,this also specifies the path to your tinc config, default is retiolum + -s \$SUBNET Choose another Subnet(version4), default is 10.243. + -m \$MASK Choose another Subnet Mask(version4), default is /16 + -u \$URL specify another hostsfiles.tar.gz url, default is euer.krebsco.de/retiolum/hosts.tar.gz +EOF +} + +#check if ip is valid ipv4 function +check_ip_valid4() +{ + if [ "$(echo $1 | awk -F"\." ' $0 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}$/ && $1 <=255 && $2 <= 255 && $3 <= 255 && $4 <= 255 ' 2>/dev/null)" == "$1" ] && [ ${1:0:${#SUBNET4}} == $SUBNET4 ] + then + return 0 + else + return 1 + fi +} + +#check if ip is taken function +check_ip_taken() +{ + if grep -q -E "$1(#|/)" $TEMPDIR/hosts/* ;then + echo $1 is taken + return 1 + else + echo $1 seems free + return 0 + fi +} + +#if hostname is taken, count upwards until it isn't taken function +check_hostname() +{ + TSTFILE=$TEMPDIR/hosts/$1 + LCOUNTER=0 + if test -e $TSTFILE; then + while test -e $TSTFILE; do + let LCOUNTER=LCOUNTER+1 + TSTFILE=$TEMPDIR/hosts/$1$LCOUNTER + done + HOSTN=$1$LCOUNTER + else + HOSTN=$1 + fi +} + +TEMPDIR=/tmp/tinc-install-fu +HOSTN=$(hostname) +NETNAME=retiolum +SUBNET4=10.243. +MASK4=/16 +RAND=1 +URL=euer.krebsco.de/retiolum/hosts.tar.gz + +#check if everything is installed +if $(! test -e "/usr/sbin/tincd"); then + echo "Please install tinc" + exit 1 +fi + +if $(! test -e /usr/bin/awk); then + echo "Please install awk" + exit 1 +fi + +if $(! test -e /usr/bin/curl); then + echo "Please install curl" + exit 1 +fi + +if $(! /bin/ping -c 1 euer.krebsco.de -W 5 &>/dev/null) ;then + echo "Cant reach euer, check if your internet is working" + exit 1 +fi + + +#parse options +while getopts "h4:t:o:n:s:m:u:" OPTION +do + case $OPTION in + h) + usage + exit 1 + ;; + 4) + IP4=$OPTARG + RAND=0 + if ! check_ip_valid4 $IP4; then echo "ip is invalid" && exit 1; fi + ;; + t) + TEMPDIR=$OPTARG + ;; + o) + HOSTN=$OPTARG + ;; + n) + NETNAME=$OPTARG + ;; + s) + SUBNET4=$OPTARG + ;; + m) + MASK4=$OPTARG + ;; + u) + URL=$OPTARG + if $(! curl -s --head $URL | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null); then + echo "url not reachable" + exit 1 + fi + ;; + + esac +done + +#test if tinc directory already exists +if test -e /etc/tinc/$NETNAME; then + echo "tinc config directory /etc/tinc/$NETNAME does already exist. (backup and) delete config directory and restart" + exit 1 +fi + +#get tinc-hostfiles +mkdir -p $TEMPDIR/hosts +curl euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/ + +#check for free ip +until check_ip_taken $IP4; do + if [ $RAND -eq 1 ]; then + IP4="10.243.$((RANDOM%255)).$((RANDOM%255))" + else + printf 'choose new ip: ' + read IP4 + while ! check_ip_valid4 $IP4; do + printf 'the ip is invalid, retard, choose a valid ip: ' + read IP4 + done + fi +done + +#check for free hostname +check_hostname $HOSTN + +echo "your ip is $IP4" +echo "your hostname is $HOSTN" -- cgit v1.2.3 From ad09d521243d9275d2af99b5aa5b67b9f79d3a77 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 7 Dec 2012 22:34:39 +0100 Subject: write_channel.py rewritten to announce_pubkey announce_pubkey is a shell-only implementation of the now obsolete write_channel script to announce a hosts public key the only dependency of this script is telnet, haven't seen a system without it for a while now --- retiolum/bin/announce_pubkey | 35 ++++++++++++++++++++++++++++ retiolum/scripts/tinc_setup/install.sh | 2 +- retiolum/scripts/tinc_setup/write_channel.py | 27 --------------------- 3 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 retiolum/bin/announce_pubkey delete mode 100644 retiolum/scripts/tinc_setup/write_channel.py diff --git a/retiolum/bin/announce_pubkey b/retiolum/bin/announce_pubkey new file mode 100644 index 00000000..ce5aed19 --- /dev/null +++ b/retiolum/bin/announce_pubkey @@ -0,0 +1,35 @@ +#!/bin/sh +set -euf +HOST="${1:-}" + +usage (){ +cat < Date: Fri, 7 Dec 2012 22:48:51 +0100 Subject: chmod +x annouce_pubkey --- retiolum/bin/announce_pubkey | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 retiolum/bin/announce_pubkey diff --git a/retiolum/bin/announce_pubkey b/retiolum/bin/announce_pubkey old mode 100644 new mode 100755 -- cgit v1.2.3 From 52ba57cf7473a8f480728eaa8c3616952bb7335a Mon Sep 17 00:00:00 2001 From: euer Date: Fri, 7 Dec 2012 22:53:12 +0100 Subject: tinc_stats.py -> tinc_stats2json tinc_stats2json is now able to parse new tincctl format as well as legacy syslog format --- retiolum/bin/tinc_stats2json | 123 ++++++++++++++++++++++++++++ retiolum/scripts/adv_graphgen/anonytize.sh | 2 +- retiolum/scripts/adv_graphgen/sanitize.sh | 2 +- retiolum/scripts/adv_graphgen/tinc_stats.py | 83 ------------------- 4 files changed, 125 insertions(+), 85 deletions(-) create mode 100755 retiolum/bin/tinc_stats2json delete mode 100755 retiolum/scripts/adv_graphgen/tinc_stats.py diff --git a/retiolum/bin/tinc_stats2json b/retiolum/bin/tinc_stats2json new file mode 100755 index 00000000..acadb306 --- /dev/null +++ b/retiolum/bin/tinc_stats2json @@ -0,0 +1,123 @@ +#!/usr/bin/python +import subprocess +import os +import re +import sys +import json + + + +TINC_NETWORK =os.environ.get("TINC_NETWORK","retiolum") + +# is_legacy is the parameter which defines if the tinc config files are handled old fashioned (parse from syslog), +# or if the new and hip tincctl should be used +is_legacy= os.environ.get("TINC_LEGACY",False) +SYSLOG_FILE = os.environ.get("LOG_FILE","/var/log/everything.log") + + +# Tags and Delimiters +TINC_TAG="tinc.%s" % TINC_NETWORK +BEGIN_NODES = "Nodes:" +END_NODES = "End of nodes." +BEGIN_SUBNET = "Subnet list:" +END_SUBNET = "End of subnet list" +BEGIN_EDGES = "Edges:" +END_EDGES = "End of edges." + +def get_tinc_block(log_file): + """ returns an iterateable block from the given log file (syslog) + This function became obsolete with the introduction of tincctl + """ + from BackwardsReader import BackwardsReader + tinc_block = [] + in_block = False + bf = BackwardsReader(log_file) + BOL = re.compile(".*tinc.%s\[[0-9]+\]: " % TINC_NETWORK) + while True: + line = bf.readline() + if not line: + raise Exception("end of file at log file? This should not happen!") + line = BOL.sub('',line).strip() + + if END_SUBNET in line: + in_block = True + + if not in_block: + continue + + tinc_block.append(line) + + if BEGIN_NODES in line: + break + return reversed(tinc_block) + +def parse_new_input(): + nodes = {} + pnodes = subprocess.check_output(["tincctl","-n",TINC_NETWORK,"dump","reachable","nodes"]) + for line in pnodes.split('\n'): + if not line: continue + l = line.split() + nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] } + psubnets = subprocess.check_output(["tincctl","-n",TINC_NETWORK,"dump","subnets"]) + for line in psubnets.split('\n'): + if not line: continue + l = line.split() + try: + if not nodes[l[2]].get('internal-ip',False): + nodes[l[2]]['internal-ip'] = [] + nodes[l[2]]['internal-ip'].append(l[0].split('#')[0]) + except KeyError: + pass # node does not exist (presumably) + pedges = subprocess.check_output(["tincctl","-n",TINC_NETWORK,"dump","edges"]) + for line in pedges.split('\n'): + if not line: continue + l = line.split() + try: + 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] }) + except KeyError: + pass #node does not exist + return nodes + +def parse_input(log_data): + nodes={} + for line in log_data: + if BEGIN_NODES in line : + nodes={} + for line in log_data: + if END_NODES in line : + break + l = line.replace('\n','').split() #TODO unhack me + nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] } + if BEGIN_SUBNET in line : + for line in log_data: + if END_SUBNET in line : + break + l = line.replace('\n','').split() + if not nodes[l[2]].get('internal-ip',False): + nodes[l[2]]['internal-ip'] = [] + nodes[l[2]]['internal-ip'].append(l[0].split('#')[0]) + if BEGIN_EDGES in line : + edges = {} + for line in log_data: + if END_EDGES in line : + 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 + + +if __name__ == '__main__': + import subprocess,time + if is_legacy: + subprocess.call(["pkill","-SIGUSR2", "tincd"]) + time.sleep(1) + print json.dumps(parse_input((get_tinc_block(SYSLOG_FILE)))) + else: + print json.dumps(parse_new_input()) + diff --git a/retiolum/scripts/adv_graphgen/anonytize.sh b/retiolum/scripts/adv_graphgen/anonytize.sh index d49793cb..dec6e456 100755 --- a/retiolum/scripts/adv_graphgen/anonytize.sh +++ b/retiolum/scripts/adv_graphgen/anonytize.sh @@ -11,7 +11,7 @@ TYPE2=png OPENER=/bin/true DOTFILE=`mktemp` trap 'rm $DOTFILE' INT TERM -sudo LOG_FILE=$LOG_FILE python tinc_stats.py |\ +sudo LOG_FILE=$LOG_FILE python ../../tinc_stats2json |\ python parse_tinc_anon.py> $DOTFILE diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh index c46662f3..78d74ce6 100755 --- a/retiolum/scripts/adv_graphgen/sanitize.sh +++ b/retiolum/scripts/adv_graphgen/sanitize.sh @@ -11,7 +11,7 @@ TYPE2=png OPENER=/bin/true DOTFILE=`mktemp` trap 'rm $DOTFILE' INT TERM -sudo LOG_FILE=$LOG_FILE python tinc_stats.py |\ +sudo LOG_FILE=$LOG_FILE python ../../tinc_stats2json |\ python parse_tinc_stats.py > $DOTFILE diff --git a/retiolum/scripts/adv_graphgen/tinc_stats.py b/retiolum/scripts/adv_graphgen/tinc_stats.py deleted file mode 100755 index d0d47aff..00000000 --- a/retiolum/scripts/adv_graphgen/tinc_stats.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python -from BackwardsReader import BackwardsReader -import os -import re -import sys -import json - - -TINC_NETWORK = os.environ.get("TINC_NETWORK","retiolum") -os.environ["LOG_FILE"] -SYSLOG_FILE = os.environ.get("LOG_FILE","/var/log/everything.log") - - -# Tags and Delimiters -TINC_TAG="tinc.%s" % TINC_NETWORK -BEGIN_NODES = "Nodes:" -END_NODES = "End of nodes." -BEGIN_SUBNET = "Subnet list:" -END_SUBNET = "End of subnet list" -BEGIN_EDGES = "Edges:" -END_EDGES = "End of edges." - -def get_tinc_block(log_file): - """ returns an iterateable block from the given log file (syslog) """ - tinc_block = [] - in_block = False - bf = BackwardsReader(log_file) - BOL = re.compile(".*tinc.retiolum\[[0-9]+\]: ") - while True: - line = bf.readline() - if not line: - raise Exception("end of file at log file? This should not happen!") - line = BOL.sub('',line).strip() - - if END_SUBNET in line: - in_block = True - - if not in_block: - continue - - tinc_block.append(line) - - if BEGIN_NODES in line: - break - return reversed(tinc_block) - -def parse_input(log_data): - nodes={} - for line in log_data: - if BEGIN_NODES in line : - nodes={} - for line in log_data: - if END_NODES in line : - break - l = line.replace('\n','').split() #TODO unhack me - nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] } - if BEGIN_SUBNET in line : - for line in log_data: - if END_SUBNET in line : - break - l = line.replace('\n','').split() - if not nodes[l[2]].get('internal-ip',False): - nodes[l[2]]['internal-ip'] = [] - nodes[l[2]]['internal-ip'].append(l[0].split('#')[0]) - if BEGIN_EDGES in line : - edges = {} - for line in log_data: - if END_EDGES in line : - 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 - - -if __name__ == '__main__': - import subprocess,time - subprocess.call(["pkill","-SIGUSR2", "tincd"]) - time.sleep(1) - print json.dumps(parse_input((get_tinc_block(SYSLOG_FILE)))) -- cgit v1.2.3 From d3d49099cbe570dee7f6cbfab2723bc04d81ac79 Mon Sep 17 00:00:00 2001 From: euer Date: Fri, 7 Dec 2012 22:53:45 +0100 Subject: remove addresses --- retiolum/hosts/euer | 2 +- retiolum/hosts/incept | 2 +- retiolum/hosts/muhbaasu | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/retiolum/hosts/euer b/retiolum/hosts/euer index 391705c5..d2240575 100644 --- a/retiolum/hosts/euer +++ b/retiolum/hosts/euer @@ -1,4 +1,4 @@ -Address = euer.krebsco.de +#Address = euer.krebsco.de Address = 84.23.67.119 Subnet = 42:974a:3ecf:3c49:06c0:4cd1:3c6f:59d9/128 Subnet = 10.243.0.95/32 diff --git a/retiolum/hosts/incept b/retiolum/hosts/incept index 1ff5365b..348e44b1 100644 --- a/retiolum/hosts/incept +++ b/retiolum/hosts/incept @@ -1,5 +1,5 @@ Address = 77.95.224.63 -Address = incept.krebsco.de +#Address = incept.krebsco.de Address = 2a00:7b80:3008:3::fafc:241 Subnet = 10.243.0.174 Subnet = 42:a2fc:1c89:65c7:6e60:1f62:eaf9:e9b6/128 diff --git a/retiolum/hosts/muhbaasu b/retiolum/hosts/muhbaasu index d758fef2..83fb3933 100644 --- a/retiolum/hosts/muhbaasu +++ b/retiolum/hosts/muhbaasu @@ -1,5 +1,5 @@ Address = 217.160.206.154 -Address = muhbaasu.de +#Address = muhbaasu.de Subnet = 10.243.0.200 Subnet = 42:3f88:faa3:ae13:6ff7:13ee:17d7:421a/128 -- cgit v1.2.3 From 253f0a908b190f0ff6d2f71023d050c088533c02 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 7 Dec 2012 23:06:17 +0100 Subject: pattern/README -> ENTERPRISE_PATTERN add to pattern : 'litterate programming' and 'Enterprise Expect' --- cholerab/ENTERPRISE_PATTERN | 84 +++++++++++++++++++++++++++++++++++++++++++++ cholerab/pattern/README | 68 ------------------------------------ 2 files changed, 84 insertions(+), 68 deletions(-) create mode 100644 cholerab/ENTERPRISE_PATTERN delete mode 100644 cholerab/pattern/README diff --git a/cholerab/ENTERPRISE_PATTERN b/cholerab/ENTERPRISE_PATTERN new file mode 100644 index 00000000..4e417709 --- /dev/null +++ b/cholerab/ENTERPRISE_PATTERN @@ -0,0 +1,84 @@ +Enterprise Patterns +================== +Stellt sicher, dass das richtige passiert, egal was gemacht wird + +Enterprise Loop +--------------- + +Enterprise Exception Handling +----------------------------- +ggf ersetzbar durch enterprise loop. + + +Enterprise Installation +----------------------- + +Rebooting +---------- + +Enterprise Einschalter (eon) +---------------------------- +Device that turns something on as soon as possible. + +Supernintendo Pattern +--------------------- + +Enterprise Root +--------------- +scripts which need root access but are called with lower privileges. The Enterprise Root Pattern provides a Solution for this issue by calling the script itself as sudo. + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + // enterprise ist, wenn ... trotzdem matcht + +Enterprise Shutdown +------------------ +Mittel der Wahl um einen Shutdown zu erzwingen + +Bsp: das Not-Aus in der Maschinensicherheit + +Enterprise Deep Copy +-------------------- +Bsp: var copy = JSON.parse(JSON.stringify(source)) + +Enterprise Thinking +------------------- +Prozess um auf Enterprise Patterns zu kommen + +Bug-Driven Development +--------------------- + +Source-based Documentation / Help +--------------------------------- + + #! /bin/sh + if echo "$*" | grep -q '\(^\| \)-h\( \|$\)'; then + cat "$0" + fi + # [more code] + + +Literate Programming +-------------------- +Omit all the comments. + +Litterate Programming +--------------------- +Write throw-away code and it will become production code + +Enterprise Expect +----------------- +Because you always know what you want, `expect(3)` script code can be replaced +by a `subshell and pipe` pattern : + + + ( echo "$username"; sleep 1; echo "$password"; sleep 1; echo "cp old new" ) | telnet + + +painload example: `//retiolum/bin/announce_pubkey` + + + diff --git a/cholerab/pattern/README b/cholerab/pattern/README deleted file mode 100644 index 0980ac6e..00000000 --- a/cholerab/pattern/README +++ /dev/null @@ -1,68 +0,0 @@ -Enterprise Patterns -================== -Stellt sicher, dass das richtige passiert, egal was gemacht wird - -Enterprise Loop ---------------- - -Enterprise Exception Handling ------------------------------ -ggf ersetzbar durch enterprise loop. - - -Enterprise Installation ------------------------ - -Rebooting ----------- - -Enterprise Einschalter (eon) ----------------------------- -Device that turns something on as soon as possible. - -Supernintendo Pattern ---------------------- - -Enterprise Root ---------------- -scripts which need root access but are called with lower privileges. The Enterprise Root Pattern provides a Solution for this issue by calling the script itself as sudo. - -if test "${nosudo-false}" != true -a `id -u` != 0; then - echo "we're going sudo..." >&2 - exec sudo "$0" "$@" - exit 23 # go to hell -fi - // enterprise ist, wenn ... trotzdem matcht - -Enterprise Shutdown ------------------- -Mittel der Wahl um einen Shutdown zu erzwingen - -Bsp: das Not-Aus in der Maschinensicherheit - -Enterprise Deep Copy --------------------- -Bsp: var copy = JSON.parse(JSON.stringify(source)) - -Enterprise Thinking -------------------- -Prozess um auf Enterprise Patterns zu kommen - -Bug-Driven Development ---------------------- - -Source-based Documentation / Help ---------------------------------- - - #! /bin/sh - if echo "$*" | grep -q '\(^\| \)-h\( \|$\)'; then - cat "$0" - fi - # [more code] - - -Literate Programming --------------------- -Omit all the comments. - - -- cgit v1.2.3 From d98c5233e31211e504a65e8d717439beedf104f8 Mon Sep 17 00:00:00 2001 From: euer Date: Fri, 7 Dec 2012 22:56:19 +0100 Subject: now pulls newest version when triggered --- retiolum/bin/create-host-tar | 1 + 1 file changed, 1 insertion(+) diff --git a/retiolum/bin/create-host-tar b/retiolum/bin/create-host-tar index 305f174c..9def7cec 100755 --- a/retiolum/bin/create-host-tar +++ b/retiolum/bin/create-host-tar @@ -3,6 +3,7 @@ set -xeuf WEBDIR=${WEBDIR:-/srv/http/pub/retiolum} HOSTFILE=$WEBDIR/hosts.tar.gz cd $(dirname $(readlink -f $0)) +git pull origin master || logger "cannot pull painload" #rm $HOSTFILE tar czf $HOSTFILE -C ../hosts . chmod a+rx $HOSTFILE -- cgit v1.2.3 From b4784e3af1d66981f6fb4352c98820d2b6091431 Mon Sep 17 00:00:00 2001 From: euer Date: Sat, 8 Dec 2012 16:45:13 +0100 Subject: fix punani db --- punani/db/punani | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/punani/db/punani b/punani/db/punani index ad477dab..e5d1f383 100644 --- a/punani/db/punani +++ b/punani/db/punani @@ -43,7 +43,7 @@ }, "tinc" : { "apt-get" : "tinc", - "yaourt" : "tinc" + "pacman" : "tinc" }, "python-notify" : { "pacman" : "python-notify", -- cgit v1.2.3 From 8c11e39a58e69de9b1912756082609f5ffb0dcb1 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Sun, 9 Dec 2012 03:06:10 +0100 Subject: new version, still WIP --- retiolum/scripts/tinc_setup/new_install.sh | 213 +++++++++++++++++++++++++---- 1 file changed, 188 insertions(+), 25 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index ab42aedc..52bb4ddb 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -1,5 +1,12 @@ #!/bin/sh +#get sudo +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + usage() { cat << EOF @@ -10,15 +17,35 @@ all parameters are optional Options: -h Show this message(haha) -4 \$ipv4 specify an ip(version 4), this also disables random ip mode, default is random + -6 \$ipv6 specify an ip(version 6), this also disables random ip mode, default is random + -s \$SUBNET Choose another Subnet(version4), default is 10.243 + -x \$SUBNET Choose another Subnet(version6), default is 42 + -m \$MASK Choose another Subnet Mask(version4), default is 16 + -j \$MASK Choose another Subnet Mask(version6), default is 16 -t \$DIR Choose another Temporary directory, default is /tmp/tinc-install-fu -o \$HOST Choose another Hostname, default is your system hostname -n \$NET Choose another tincd netname,this also specifies the path to your tinc config, default is retiolum - -s \$SUBNET Choose another Subnet(version4), default is 10.243. - -m \$MASK Choose another Subnet Mask(version4), default is /16 -u \$URL specify another hostsfiles.tar.gz url, default is euer.krebsco.de/retiolum/hosts.tar.gz + -l \$OS specify an OS, numeric parameter.0=Automatic 1=ArchLinux 2=OpenWRT, disables automatic OS-finding, default is 0 + -r \$ADDR give the node an reachable remote address, ipv4 or dns EOF } +#convert hostmask to subnetmask only version 4 +host2subnet() +{ + NEEDDOTSINSUB=$(expr 3 - $(echo $SUBNET4 | sed 's/[0-9]*//g')) + FULLSUBNET=$(echo $SUBNET4$(eval "printf '.0'%.0s {1..${#NEEDDOTSINSUB}}"s)) + + result=$(($(($((1 << $1)) - 1)) << $((32 - $1)))) + byte="" + for ((i=0;i<3;i+=1)); do + byte=.$(($result % 256))$byte + result=$(($result / 256)) + done + RETARDEDMASK=$result$byte +} + #check if ip is valid ipv4 function check_ip_valid4() { @@ -30,20 +57,29 @@ check_ip_valid4() fi } +#check if ip is valid ipv6 function +check_ip_valid6() +{ + if [ "$(echo $1 | awk -F"." ' $0 ~ /^([0-9a-fA-F]{1,4}\:){7}[0-9a-fA-F]{1,4}$/' 2>/dev/null)" == $1 ] && [ ${1:0:${#SUBNET6}} == $SUBNET6 ] + then + return 0 + else + return 1 + fi +} + #check if ip is taken function check_ip_taken() { if grep -q -E "$1(#|/)" $TEMPDIR/hosts/* ;then - echo $1 is taken return 1 else - echo $1 seems free return 0 fi } #if hostname is taken, count upwards until it isn't taken function -check_hostname() +get_hostname() { TSTFILE=$TEMPDIR/hosts/$1 LCOUNTER=0 @@ -58,38 +94,52 @@ check_hostname() fi } +#os autodetection +find_os() +{ + if grep -q "Arch Linux" /etc/*release; then + OS=1 + elif grep -q "OpenWrt" /etc/*release; then + OS=2 + fi +} + +SUBNET4=10.243 +SUBNET6=42 TEMPDIR=/tmp/tinc-install-fu HOSTN=$(hostname) NETNAME=retiolum -SUBNET4=10.243. -MASK4=/16 -RAND=1 +MASK4=16 +MASK6=16 +RAND4=1 +RAND6=1 URL=euer.krebsco.de/retiolum/hosts.tar.gz +OS=0 #check if everything is installed -if $(! test -e "/usr/sbin/tincd"); then +if ! which tincd&>/dev/null; then echo "Please install tinc" exit 1 fi -if $(! test -e /usr/bin/awk); then +if ! which awk&>/dev/null; then echo "Please install awk" exit 1 fi -if $(! test -e /usr/bin/curl); then +if ! which curl&>/dev/null; then echo "Please install curl" exit 1 fi -if $(! /bin/ping -c 1 euer.krebsco.de -W 5 &>/dev/null) ;then +if ! $(/bin/ping -c 1 euer.krebsco.de -W 5 &>/dev/null) ;then echo "Cant reach euer, check if your internet is working" exit 1 fi #parse options -while getopts "h4:t:o:n:s:m:u:" OPTION +while getopts "h4:6:s:x:m:j:t:o:n:u:l:" OPTION do case $OPTION in h) @@ -98,8 +148,25 @@ do ;; 4) IP4=$OPTARG - RAND=0 - if ! check_ip_valid4 $IP4; then echo "ip is invalid" && exit 1; fi + RAND4=0 + if ! check_ip_valid4 $IP4; then echo "ipv4 is invalid" && exit 1; fi + ;; + 6) + IP6=$OPTARG + RAND6=0 + if ! check_ip_valid6 $IP6; then echo "ipv6 is invalid" && exit 1; fi + ;; + s) + SUBNET4=$OPTARG + ;; + x) + SUBNET6=$OPTARG + ;; + m) + MASK4=$OPTARG + ;; + j) + MASK6=$OPTARG ;; t) TEMPDIR=$OPTARG @@ -110,12 +177,6 @@ do n) NETNAME=$OPTARG ;; - s) - SUBNET4=$OPTARG - ;; - m) - MASK4=$OPTARG - ;; u) URL=$OPTARG if $(! curl -s --head $URL | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null); then @@ -123,10 +184,22 @@ do exit 1 fi ;; + l) + OS=$OPTARG + if ! [ "$(echo $OS | awk -F"." ' $0 ~ /^[0-2]$/' )" == $OS ]; then + echo "invalid input for OS" + exit 1 + fi + ;; + r) + ADDR=$OPTARG + ;; esac done +#generate full subnet information for v4 + #test if tinc directory already exists if test -e /etc/tinc/$NETNAME; then echo "tinc config directory /etc/tinc/$NETNAME does already exist. (backup and) delete config directory and restart" @@ -138,9 +211,10 @@ mkdir -p $TEMPDIR/hosts curl euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/ #check for free ip +#version 4 until check_ip_taken $IP4; do - if [ $RAND -eq 1 ]; then - IP4="10.243.$((RANDOM%255)).$((RANDOM%255))" + if [ $RAND4 -eq 1 ]; then + IP4="$SUBNET4.$((RANDOM%255)).$((RANDOM%255))" else printf 'choose new ip: ' read IP4 @@ -151,8 +225,97 @@ until check_ip_taken $IP4; do fi done +#version 6 +until check_ip_taken $IP6; do + if [ $RAND6 -eq 1 ]; then + IP6="$SUBNET6$(openssl rand -hex 14 | sed 's/..../:&/g')" #todo: generate ip length from hostmask + else + printf 'ip taken, choose new ip: ' + + read IP6 + while ! check_ip_valid6 $IP6; do + printf 'the ip is invalid, retard, choose a valid ip: ' + read IP6 + done + fi +done + + #check for free hostname -check_hostname $HOSTN +get_hostname $HOSTN -echo "your ip is $IP4" +#check for OS +if [ $OS -eq 0 ]; then + echo $OS + find_os +fi + +#create the configs +mkdir -p /etc/tinc/$NETNAME +cd /etc/tinc/$NETNAME + +mv $TEMPDIR/hosts ./ + +echo "Subnet = $IP4" > hosts/$HOSTN +echo "Subnet = $IP6" >> hosts/$HOSTN + +cat>tinc.conf</dev/null; then + echo 'dirname="`dirname "$0"`"' > tinc-up + echo '' >> tinc-up + echo 'conf=$dirname/tinc.conf' >> tinc-up + echo '' >> tinc-up + echo 'name=$(sed -n "s|^ *Name *= *\([^ ]*\) *$|\1|p " $conf)' >> tinc-up + echo '' >> tinc-up + echo 'host=$dirname/hosts/$name' >> tinc-up + echo '' >> tinc-up + echo 'ip link set $INTERFACE up' >> tinc-up + echo '' >> tinc-up + echo "addr4=\$(sed -n \"s|^ *Subnet *= *\\($SUBNET4[.][^ ]*\\) *$|\\1|p\" \$host)" >> tinc-up + echo 'ip -4 addr add $addr4 dev $INTERFACE' >> tinc-up + echo "ip -4 route add $FULLSUBNET/$MASK4 dev \$INTERFACE" >> tinc-up + echo '' >> tinc-up + echo "addr6=\$(sed -n \"s|^ *Subnet *= *\\($SUBNET6[:][^ ]*\\) *$|\\1|p\" \$host)" >> tinc-up + echo 'ip -6 addr add $addr6 dev $INTERFACE' >> tinc-up + echo "ip -6 route add $SUBNET6::/$MASK6 dev \$INTERFACE" >> tinc-up +else + echo 'dirname="`dirname "$0"`"' > tinc-up + echo '' >> tinc-up + echo 'conf=$dirname/tinc.conf' >> tinc-up + echo '' >> tinc-up + echo 'name=$(sed -n "s|^ *Name *= *\([^ ]*\) *$|\1|p " $conf)' >> tinc-up + echo '' >> tinc-up + echo 'host=$dirname/hosts/$name' >> tinc-up + echo '' >> tinc-up + echo "addr4=\$(sed -n \"s|^ *Subnet *= *\\($SUBNET4[.][^ ]*\\) *$|\\1|p\" \$host)" >> tinc-up + echo 'ifconfig $INTERFACE $addr4' >> tinc-up + echo "route add -net $FULLSUBNET netmask $RETARDEDMASK dev $INTERFACE " >> tinc-up +fi + +chmod +x tinc-up +chown -R root:root . + +if which tincctl&>/dev/null; then + +fi + +echo "your ipv4 is $IP4" +echo "your ipv6 is $IP6" echo "your hostname is $HOSTN" +echo "your OS is $OS" + -- cgit v1.2.3 From 8e36e9942498b821ed3825d5f3b631e27aa4d265 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Sun, 9 Dec 2012 16:29:26 +0100 Subject: now working --- retiolum/scripts/tinc_setup/new_install.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 52bb4ddb..dcbb2670 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -116,6 +116,10 @@ RAND6=1 URL=euer.krebsco.de/retiolum/hosts.tar.gz OS=0 +IRCCHANNEL="#krebsco" +IRCSERVER="irc.freenode.net" +IRCPORT=6667 + #check if everything is installed if ! which tincd&>/dev/null; then echo "Please install tinc" @@ -307,15 +311,25 @@ else echo "route add -net $FULLSUBNET netmask $RETARDEDMASK dev $INTERFACE " >> tinc-up fi +#fix permissions chmod +x tinc-up chown -R root:root . +#generate keys with tinc if which tincctl&>/dev/null; then - + yes | tincctl -n $NETNAME generate-keys + cat rsa_key.pub >> hosts/$HOSTN +else + yes | tincd -n $NETNAME -K fi -echo "your ipv4 is $IP4" -echo "your ipv6 is $IP6" -echo "your hostname is $HOSTN" -echo "your OS is $OS" +#write to irc-channel +NICK="${HOSTN}_$((RANDOM%666))" + +( echo "NICK $NICK"; + echo "USER $NICK $IRCSERVER bla : $NICK"; + echo "JOIN $IRCCHANNEL"; + sleep 23; + sed "s/^\(.*\)/PRIVMSG $IRCCHANNEL : \1/" hosts/$HOSTN; + sleep 5; ) | telnet $IRCSERVER $IRCPORT -- cgit v1.2.3 From 1fbaa63834a649cf9c96aac9dca1bc566196d64b Mon Sep 17 00:00:00 2001 From: Lassulus Date: Sun, 9 Dec 2012 19:13:59 +0100 Subject: added variable stuff --- retiolum/scripts/tinc_setup/new_install.sh | 49 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index dcbb2670..3afae31a 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -104,21 +104,40 @@ find_os() fi } -SUBNET4=10.243 -SUBNET6=42 -TEMPDIR=/tmp/tinc-install-fu -HOSTN=$(hostname) -NETNAME=retiolum -MASK4=16 -MASK6=16 -RAND4=1 -RAND6=1 -URL=euer.krebsco.de/retiolum/hosts.tar.gz -OS=0 - -IRCCHANNEL="#krebsco" -IRCSERVER="irc.freenode.net" -IRCPORT=6667 +SUBNET4=${SUBNET4:-10.243} +SUBNET6=${SUBNET6:-42} +TEMPDIR=${TEMPDIR:-/tmp/tinc-install-fu} +HOSTN=${HOSTN:-$(hostname)} +NETNAME=${NETNAME:-retiolum} +MASK4=${MASK4:-16} +MASK6=${MASK6:-16} +URL=${URL:-euer.krebsco.de/retiolum/hosts.tar.gz} + +IRCCHANNEL=${IRCCHANNEL:-"#krebsco"} +IRCSERVER=${IRCSERVER:-"irc.freenode.net"} +IRCPORT=${IRCPORT:-6667} + +OS=${OS:-0} + +IP4=${IP4:-0} +IP6=${IP6:-0} + +RAND4=0 +RAND6=0 + +if [ $IP4 -eq 0 ]; then + RAND4=1 +elif ! check_ip_valid4 $IP4; then + echo 'ip4 is invalid' + exit 1 +fi +if [ $IP6 -eq 0 ]; then + RAND6=1 +elif ! check_ip_valid6 $IP6; then + echo 'ip6 is invalid' + exit 1 +fi + #check if everything is installed if ! which tincd&>/dev/null; then -- cgit v1.2.3 From c12143b68c9904a99e5e18f30db71fd4660733fd Mon Sep 17 00:00:00 2001 From: Lassulus Date: Sun, 9 Dec 2012 19:29:18 +0100 Subject: fixed sudo env --- retiolum/scripts/tinc_setup/new_install.sh | 45 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 3afae31a..bbf4475e 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -3,10 +3,32 @@ #get sudo if test "${nosudo-false}" != true -a `id -u` != 0; then echo "we're going sudo..." >&2 - exec sudo "$0" "$@" + exec sudo -E "$0" "$@" exit 23 # go to hell fi +# +SUBNET4=${SUBNET4:-10.243} +SUBNET6=${SUBNET6:-42} +TEMPDIR=${TEMPDIR:-/tmp/tinc-install-fu} +HOSTN=${HOSTN:-$(hostname)} +NETNAME=${NETNAME:-retiolum} +MASK4=${MASK4:-16} +MASK6=${MASK6:-16} +URL=${URL:-euer.krebsco.de/retiolum/hosts.tar.gz} + +IRCCHANNEL=${IRCCHANNEL:-"#krebsco"} +IRCSERVER=${IRCSERVER:-"irc.freenode.net"} +IRCPORT=${IRCPORT:-6667} + +OS=${OS:-0} + +IP4=${IP4:-0} +IP6=${IP6:-0} + +RAND4=0 +RAND6=0 + usage() { cat << EOF @@ -104,27 +126,6 @@ find_os() fi } -SUBNET4=${SUBNET4:-10.243} -SUBNET6=${SUBNET6:-42} -TEMPDIR=${TEMPDIR:-/tmp/tinc-install-fu} -HOSTN=${HOSTN:-$(hostname)} -NETNAME=${NETNAME:-retiolum} -MASK4=${MASK4:-16} -MASK6=${MASK6:-16} -URL=${URL:-euer.krebsco.de/retiolum/hosts.tar.gz} - -IRCCHANNEL=${IRCCHANNEL:-"#krebsco"} -IRCSERVER=${IRCSERVER:-"irc.freenode.net"} -IRCPORT=${IRCPORT:-6667} - -OS=${OS:-0} - -IP4=${IP4:-0} -IP6=${IP6:-0} - -RAND4=0 -RAND6=0 - if [ $IP4 -eq 0 ]; then RAND4=1 elif ! check_ip_valid4 $IP4; then -- cgit v1.2.3 From 05b4a12ae3249cc8197506f59fa85e2181226af4 Mon Sep 17 00:00:00 2001 From: euer Date: Sun, 9 Dec 2012 21:14:26 +0100 Subject: add tutorial for partial checkout retiolum hosts from repo --- retiolum/doc/git_checkout_only_hosts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 retiolum/doc/git_checkout_only_hosts diff --git a/retiolum/doc/git_checkout_only_hosts b/retiolum/doc/git_checkout_only_hosts new file mode 100644 index 00000000..6deede29 --- /dev/null +++ b/retiolum/doc/git_checkout_only_hosts @@ -0,0 +1,6 @@ +git init painload +cd painload +git remote add -f origin https://github.com/krebscode/painload.git +git config core.sparsecheckout true +echo retiolum/hosts/ >> .git/info/sparse-checkout +git pull origin master -- cgit v1.2.3 From 8531144be708527ff1543cfa37248e8433d3eb2c Mon Sep 17 00:00:00 2001 From: euer Date: Sun, 9 Dec 2012 21:15:36 +0100 Subject: add reference to checkout_tutorial --- retiolum/doc/git_checkout_only_hosts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/retiolum/doc/git_checkout_only_hosts b/retiolum/doc/git_checkout_only_hosts index 6deede29..2286169d 100644 --- a/retiolum/doc/git_checkout_only_hosts +++ b/retiolum/doc/git_checkout_only_hosts @@ -1,6 +1,11 @@ -git init painload -cd painload -git remote add -f origin https://github.com/krebscode/painload.git -git config core.sparsecheckout true -echo retiolum/hosts/ >> .git/info/sparse-checkout -git pull origin master +# Reference +http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/ + +# Code + + git init painload + cd painload + git remote add -f origin https://github.com/krebscode/painload.git + git config core.sparsecheckout true + echo retiolum/hosts/ >> .git/info/sparse-checkout + git pull origin master -- cgit v1.2.3 From 6285fa2e604f7506a91f024cb7bb3c713e6cdb10 Mon Sep 17 00:00:00 2001 From: euer Date: Sun, 9 Dec 2012 22:20:51 +0100 Subject: rewrite github_listener --- retiolum/scripts/github_listener/INSTALL | 13 +++++++++++++ retiolum/scripts/github_listener/README | 4 ++++ retiolum/scripts/github_listener/github_listener.conf | 5 +++-- retiolum/scripts/github_listener/handle_request | 16 ++++++++++++++++ retiolum/scripts/github_listener/listen | 4 +++- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 retiolum/scripts/github_listener/INSTALL create mode 100755 retiolum/scripts/github_listener/handle_request diff --git a/retiolum/scripts/github_listener/INSTALL b/retiolum/scripts/github_listener/INSTALL new file mode 100644 index 00000000..20c0845c --- /dev/null +++ b/retiolum/scripts/github_listener/INSTALL @@ -0,0 +1,13 @@ +# HowTo + + useradd -r tinc + mkdir -p /opt/ + git init github_listener + git remote add -f origin https://github.com/krebscode/painload.git + git config core.sparsecheckout true + echo retiolum/hosts/ >> .git/info/sparse-checkout + git pull origin master + ln -s $static_painload/retiolum/{scripts,bin} retiolum/ + cp scripts/github_listener/github_listener.conf /etc/supervisor/conf.d/ + cd .. + chown tinc:tinc -R github_listener diff --git a/retiolum/scripts/github_listener/README b/retiolum/scripts/github_listener/README index ad43031c..57c30896 100644 --- a/retiolum/scripts/github_listener/README +++ b/retiolum/scripts/github_listener/README @@ -16,3 +16,7 @@ with a "logger" command to signalise successful tarball generation. github_listener.conf =================== the supervisor config file + +References +========== +also see //retiolum/doc/git_checkout_only_hosts diff --git a/retiolum/scripts/github_listener/github_listener.conf b/retiolum/scripts/github_listener/github_listener.conf index d1f2dae4..88c8ea60 100644 --- a/retiolum/scripts/github_listener/github_listener.conf +++ b/retiolum/scripts/github_listener/github_listener.conf @@ -1,3 +1,4 @@ [program:github_listener] -command=/krebs/retiolum/scripts/github_listener/listen 5432 -user=nobody +command=/opt/github_listener/retiolum/scripts/github_listener/listen 5432 +user=tinc +environment=HOSTFOLDER='/opt/github_listener/retiolum/hosts',WEBDIR='/srv/http/pub/retiolum/' diff --git a/retiolum/scripts/github_listener/handle_request b/retiolum/scripts/github_listener/handle_request new file mode 100755 index 00000000..2df05ae0 --- /dev/null +++ b/retiolum/scripts/github_listener/handle_request @@ -0,0 +1,16 @@ +#!/bin/sh +# Possible Shell Vars +# WEBDIR +# HOSTFOLDER +set -euf +HOSTFOLDER=${HOSTFOLDER:-../../hosts} +cd $(dirname $(readlink -f $0)) +cd "$HOSTFOLDER" +git pull origin master >&2 +cd - >&2 + +echo "sorry for keeping you waiting, please be patient" +../../bin/create-supernode-tar +echo "almost done..." +../../bin/create-host-tar +echo "Thank you for your patience!" diff --git a/retiolum/scripts/github_listener/listen b/retiolum/scripts/github_listener/listen index c701d14b..30f0c4b5 100755 --- a/retiolum/scripts/github_listener/listen +++ b/retiolum/scripts/github_listener/listen @@ -1,6 +1,8 @@ #!/bin/sh PORT=${1:-5432} # eloop pattern +cd $(dirname $(readlink -f $0)) while sleep 1; do - nc -l -p $PORT -e /krebs/retiolum/bin/create-host-tar && logger "successfully built retiolum hosts tarball" + nc -lvv -p $PORT -e ./handle_request && logger "successfully built retiolum hosts tarball" + done -- cgit v1.2.3 From 88b6956f32ed74be82a401a7716398a622a9042f Mon Sep 17 00:00:00 2001 From: Lassulus Date: Mon, 10 Dec 2012 01:12:54 +0100 Subject: more checks, fixed loop --- retiolum/scripts/tinc_setup/new_install.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index bbf4475e..45316796 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -61,7 +61,7 @@ host2subnet() result=$(($(($((1 << $1)) - 1)) << $((32 - $1)))) byte="" - for ((i=0;i<3;i+=1)); do + for i in {0..2}; do byte=.$(($result % 256))$byte result=$(($result / 256)) done @@ -151,11 +151,26 @@ if ! which awk&>/dev/null; then exit 1 fi -if ! which curl&>/dev/null; then - echo "Please install curl" +if ! which hostname&>/dev/null; then + echo "Please install hostname" exit 1 fi +if ! which openssl&>/dev/null; then + echo "Please install openssl" + exit 1 +fi + +if ! which curl&>/dev/null; then + if ! which wget&>/dev/null; then + echo "Please install curl or wget" + exit 1 + else + LOADER='wget -O-' +else + LOADER=curl +fi + if ! $(/bin/ping -c 1 euer.krebsco.de -W 5 &>/dev/null) ;then echo "Cant reach euer, check if your internet is working" exit 1 @@ -232,7 +247,7 @@ fi #get tinc-hostfiles mkdir -p $TEMPDIR/hosts -curl euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/ +$LOADER euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/ #check for free ip #version 4 -- cgit v1.2.3 From 7fc8f37b2cd2203881deb27b6a757f6d82eeb118 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Mon, 10 Dec 2012 01:16:04 +0100 Subject: fixed typo --- retiolum/scripts/tinc_setup/new_install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 45316796..94319bfd 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -167,6 +167,7 @@ if ! which curl&>/dev/null; then exit 1 else LOADER='wget -O-' + fi else LOADER=curl fi -- cgit v1.2.3 From bf7e7d7db64bb7c8827cb176d2ac6b8dd06741fc Mon Sep 17 00:00:00 2001 From: Lassulus Date: Mon, 10 Dec 2012 01:35:11 +0100 Subject: changed random source --- retiolum/scripts/tinc_setup/new_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 94319bfd..049eeca5 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -254,7 +254,7 @@ $LOADER euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/ #version 4 until check_ip_taken $IP4; do if [ $RAND4 -eq 1 ]; then - IP4="$SUBNET4.$((RANDOM%255)).$((RANDOM%255))" + IP4="$SUBNET4.$(( $(head /dev/urandom | tr -dc "123456789" | head -c3) %255)).$(( $(head /dev/urandom | tr -dc "123456789" | head -c3) %255))" else printf 'choose new ip: ' read IP4 @@ -360,7 +360,7 @@ else fi #write to irc-channel -NICK="${HOSTN}_$((RANDOM%666))" +NICK="${HOSTN}_$(head /dev/urandom | tr -dc "0123456789" | head -c3)" ( echo "NICK $NICK"; echo "USER $NICK $IRCSERVER bla : $NICK"; -- cgit v1.2.3 From bce2e977ba603a3fa27d77827263a99d2913482e Mon Sep 17 00:00:00 2001 From: Lassulus Date: Mon, 10 Dec 2012 01:48:25 +0100 Subject: removed openssl dependency --- retiolum/scripts/tinc_setup/new_install.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 049eeca5..275805a7 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -156,11 +156,6 @@ if ! which hostname&>/dev/null; then exit 1 fi -if ! which openssl&>/dev/