From 1cbb64fd336459a0f798d8685dd2ee232191ef3d Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 14 Jan 2014 03:36:05 +0100 Subject: tinc_setup: remove all the legacy code --- retiolum/scripts/tinc_setup/build_arch.sh | 14 ---- retiolum/scripts/tinc_setup/build_debian.sh | 32 --------- retiolum/scripts/tinc_setup/build_debian_clean.sh | 31 --------- retiolum/scripts/tinc_setup/build_ec2.sh | 16 ----- retiolum/scripts/tinc_setup/build_no.de.sh | 1 - retiolum/scripts/tinc_setup/install.sh | 84 ----------------------- 6 files changed, 178 deletions(-) delete mode 100755 retiolum/scripts/tinc_setup/build_arch.sh delete mode 100755 retiolum/scripts/tinc_setup/build_debian.sh delete mode 100755 retiolum/scripts/tinc_setup/build_debian_clean.sh delete mode 100755 retiolum/scripts/tinc_setup/build_ec2.sh delete mode 100644 retiolum/scripts/tinc_setup/build_no.de.sh delete mode 100755 retiolum/scripts/tinc_setup/install.sh diff --git a/retiolum/scripts/tinc_setup/build_arch.sh b/retiolum/scripts/tinc_setup/build_arch.sh deleted file mode 100755 index 5ef5d765..00000000 --- a/retiolum/scripts/tinc_setup/build_arch.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/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/retiolum/scripts/tinc_setup/build_debian.sh b/retiolum/scripts/tinc_setup/build_debian.sh deleted file mode 100755 index 52e61390..00000000 --- a/retiolum/scripts/tinc_setup/build_debian.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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/retiolum/scripts/tinc_setup/build_debian_clean.sh b/retiolum/scripts/tinc_setup/build_debian_clean.sh deleted file mode 100755 index a7332f4e..00000000 --- a/retiolum/scripts/tinc_setup/build_debian_clean.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/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/retiolum/scripts/tinc_setup/build_ec2.sh b/retiolum/scripts/tinc_setup/build_ec2.sh deleted file mode 100755 index 79f2af28..00000000 --- a/retiolum/scripts/tinc_setup/build_ec2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/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/retiolum/scripts/tinc_setup/build_no.de.sh b/retiolum/scripts/tinc_setup/build_no.de.sh deleted file mode 100644 index 2976d3a2..00000000 --- a/retiolum/scripts/tinc_setup/build_no.de.sh +++ /dev/null @@ -1 +0,0 @@ -pkgin in lzo gcc-tools gcc-compiler gcc34 diff --git a/retiolum/scripts/tinc_setup/install.sh b/retiolum/scripts/tinc_setup/install.sh deleted file mode 100755 index 9efe863c..00000000 --- a/retiolum/scripts/tinc_setup/install.sh +++ /dev/null @@ -1,84 +0,0 @@ -#! /bin/sh -# USE WITH GREAT CAUTION -set -eu - -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 - -#make -C ../../ update -set -e -DIRNAME=`dirname $0` -CURR=`readlink -f ${DIRNAME}` -MYBIN=${CURR}/../../bin -netname=retiolum -# create configuration directory for $netname -mkdir -p /etc/tinc/$netname/hosts -cd /etc/tinc/$netname - -echo "added known hosts:" -ls -1 hosts | LC_ALL=C sort -echo "delete the nodes you do not trust!" - -hostname="${HOSTNAME-`cat /etc/hostname`}" -myname="${1:-}" -if [ ! "$myname" ] -then - printf "select node name [$hostname]: " - read myname - if test -z "$myname"; then - myname="$hostname" - fi -fi -if [ ! -e "hosts/$myname" ] -then - - # TODO eloop until we found a free IPv4 - # myipv4=$(echo 42.$(for i in `seq 1 3`; do echo "ibase=16;`bin/fillxx xx|tr [a-f] [A-F]`" | bc; done)|tr \ .)/32 - - myipv4="${2:-}" - mynet4=10.243.0.0 - - if [ ! "$myipv4" ] - then - printf 'select v4 subnet ip (1-255): ' - read v4num - until $MYBIN/check-free-retiolum-v4 10.243.0.$v4num; do - echo "your're an idiot!" - printf 'select unused v4 subnet ip (1-255): ' - read v4num - done - myipv4="10.243.0.$v4num" - fi - echo "Subnet = $myipv4" > hosts/$myname - - myipv6=`$MYBIN/fillxx 42:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`/128 - echo "Subnet = $myipv6" >> hosts/$myname -else - echo "own host file already exists! will not write again!" -fi - -cat>tinc.conf< Date: Tue, 14 Jan 2014 03:39:18 +0100 Subject: tinc_setup: update README according to what is currently working --- retiolum/scripts/tinc_setup/README | 18 ------------------ retiolum/scripts/tinc_setup/README.md | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 retiolum/scripts/tinc_setup/README create mode 100644 retiolum/scripts/tinc_setup/README.md diff --git a/retiolum/scripts/tinc_setup/README b/retiolum/scripts/tinc_setup/README deleted file mode 100644 index 11d6f6e9..00000000 --- a/retiolum/scripts/tinc_setup/README +++ /dev/null @@ -1,18 +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_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/retiolum/scripts/tinc_setup/README.md b/retiolum/scripts/tinc_setup/README.md new file mode 100644 index 00000000..11d6f6e9 --- /dev/null +++ b/retiolum/scripts/tinc_setup/README.md @@ -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 -- cgit v1.2.3 From 46ed619c2bd334f64e2d0a9eaa43cf73f5fd5bde Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 15 Jan 2014 15:33:00 +0100 Subject: news: control channel now #news --- news/newsbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/newsbot.py b/news/newsbot.py index 5850e4e9..54a2e7d2 100644 --- a/news/newsbot.py +++ b/news/newsbot.py @@ -221,7 +221,7 @@ url_shortener = 'http://wall' init_channels = ['#news'] bots = {} -knews = NewsBot('knews') +knews = NewsBot('knews', init_channels) #config file reading F = open(feedfile, "r") -- cgit v1.2.3 From c04f99d787e56c7eb5db611bcbcef8269e1b3903 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 20 Jan 2014 15:18:52 +0100 Subject: news: removed old sourcefiles --- news/controller.py | 151 ----------------------------------------------------- news/rssbot.py | 116 ---------------------------------------- 2 files changed, 267 deletions(-) delete mode 100755 news/controller.py delete mode 100755 news/rssbot.py diff --git a/news/controller.py b/news/controller.py deleted file mode 100755 index e9e94476..00000000 --- a/news/controller.py +++ /dev/null @@ -1,151 +0,0 @@ -from time import sleep -import irc.bot -import _thread -import rssbot -import os -import subprocess - -class NewsBot(irc.bot.SingleServerIRCBot): - def __init__(self, name, chans=['#news'], server='ire', port=6667, timeout=60): - irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], name, name) - self.name = name - self.server = server - self.port = port - self.chans = chans - self.to = timeout - - def start(self): - self.bot = _thread.start_new_thread(irc.bot.SingleServerIRCBot.start, (self,)) - - def on_welcome(self, connection, event): - for chan in self.chans: - connection.join(chan) - - def send(self, target, string): - for line in string.split('\n'): - self.connection.action(target, line) - sleep(1) - - def on_privmsg(self, connection, event): - args_array = event.arguments[0].split() - answer = self.read_message(args_array) - self.send(event.source.nick, answer) - - def on_pubmsg(self, connection, event): - args_array = event.arguments[0].split() - if len(args_array) > 0 and args_array[0][:-1]==self.name: - answer = self.read_message(args_array[1:]) - self.send(event.target, answer) - - def on_invite(self, connection, event): - for chan in event.arguments: - connection.join(chan) - - def read_message(self, args): - try: - if args[0] in [x for x in commands.__dict__.keys() if x.find('_')]: - func = getattr(commands, args[0]) - return func(args) - else: - return 'command not found' - except: - return "mimimimi" - - - -class commands(): - def add(args): - if args[1] not in bots and not args[1]==knews.name: - bot = rssbot.RssBot(args[2], args[1], url_shortener=url_shortener) - bots[args[1]] = bot - bot.start() - return "bot " + args[1] + " added" - else: - return args[1] + ' does already exist' - - def delete(args): - bots[args[1]].stop() - del bots[args[1]] - return "bot " + args[1] + " deleted" - - def rename(args): - if args[1] in bots: - if args[2] in bots: - return args[2] + ' already taken' - else: - bots[args[1]].connection.nick(args[2]) - bots[args[1]].name = args[2] - bots[args[2]] = bots[args[1]] - del bots[args[1]] - return 'renamed ' + args[1] + ' in ' + args[2] - else: - return args[1] + ' does not exist' - - def save(args): - output_buffer = '' - for bot in bots: - if bots[bot].loop: - output_buffer += bot + '|' + bots[bot].url + '|' + ' '.join(bots[bot].channels) + '\n' - - F = open(feedfile, "w") - F.writelines(output_buffer) - F.close() - - return "bots saved to " + feedfile - - def caps(args): - return ' '.join([x for x in commands.__dict__.keys() if x.find('_')]) - - def list(args): - output_buffer = '' - for bot in bots: - output_buffer += bot + ' url: ' + bots[bot].url + '\n' - return output_buffer - - def info(args): - if args[1] in bots: - output_buffer = '' - for data in ['title', 'link', 'updated']: - if data in bots[args[1]].feed.feed: - output_buffer += data + ': ' + bots[args[1]].feed.feed[data] + '\n' - output_buffer += 'lastnew: ' + bots[args[1]].lastnew.isoformat() + '\n' - output_buffer += 'rssurl: ' + bots[args[1]].url - return output_buffer - else: - return 'bot not found' - - def search(args): - output = subprocess.check_output(['./GfindFeeds4bot', args[1]]).decode() - return output - - def uptime(args): - output = subprocess.check_output(['uptime']).decode() - return output - -feedfile = 'new_feeds' -url_shortener = 'http://wall' -init_channels = ['#news'] - -if 'FEEDFILE' in os.environ: - feedfile = os.environ['FEEDFILE'] - -if 'URLSHORT' in os.environ: - url_shortener = os.environ['URLSHORT'] - -bots = {} -knews = NewsBot('knews') - -#config file reading -F = open(feedfile, "r") -lines = F.readlines() -F.close() - -for line in lines: - line = line.strip('\n') - linear = line.split('|') - bot = rssbot.RssBot(linear[1], linear[0], init_channels + linear[2].split(), url_shortener) - bot.start() - bots[linear[0]] = bot - -knews.start() - diff --git a/news/rssbot.py b/news/rssbot.py deleted file mode 100755 index 87c58781..00000000 --- a/news/rssbot.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/python -import irc.bot -from irc.client import IRC -import feedparser -import threading -import math -import re -import subprocess -from datetime import datetime -from time import sleep - -class RssBot(irc.bot.SingleServerIRCBot): - def __init__(self, rss, name, chans=['#news'], url_shortener="http://localhost", server='ire', port=6667, timeout=60): - irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], name, name) - self.url = rss - self.name = name - self.server = server - self.port = port - self.chans = chans - self.to = timeout - self.oldnews = [] - self.sendqueue = [] - self.loop = True - self.lastnew = datetime.now() - self.url_shortener = url_shortener - - def better_loop(timeout=0.2): - while self.loop: - self.ircobj.process_once(timeout) - self.ircobj.process_forever = better_loop - - - def start(self): - self.upd_loop = threading.Thread(target=self.updateloop) - self.bot = threading.Thread(target=irc.bot.SingleServerIRCBot.start, args=(self,)) - self.upd_loop.start() - self.bot.start() - - def stop(self): - self.ircobj.disconnect_all() - self.loop = False - del self - - def updateloop(self): - failcount=0 - while True: - try: - self.feed = feedparser.parse(self.url) - for entry in self.feed.entries: - self.oldnews.append(entry.link) - break - except: - print(self.name + ': rss timeout occured') - failcount+=1 - if failcount>20: - print(self.name + ' is broken, going to die') - self.stop() - return - while self.loop: - try: - self.feed = feedparser.parse(self.url) - for entry in self.feed.entries: - if not entry.link in self.oldnews: - #try: - # self.send(entry.title + " " + entry.link + " com: " + entry.comments) - #except AttributeError: - shorturl = self.shortenurl(entry.link) - self.sendall(entry.title + ' ' + shorturl) - self.oldnews.append(entry.link) - self.lastnew = datetime.now() - except: - print(self.name + ': rss timeout occured') - sleep(self.to) - - def shortenurl(self, url): - while True: - try: - shorturl = subprocess.check_output(["curl", "-sS", "-F", "uri=" + url, self.url_shortener]).decode().strip('\n').strip('\r') + '#' + url.partition('://')[2].partition('/')[0] - return shorturl - except: - print('url shortener error') - sleep(1) - - def last(self, target, num): - for feed in [x for x in self.feed.entries][:num]: - self.send(target, feed.title + ' ' + self.shortenurl(feed.link)) - - def sendall(self, string): - for chan in self.channels: - self.send(chan, string) - - def send(self, target, string): - if self.connection.connected: - for line in string.split('\n'): - if len(line) < 450: - self.connection.privmsg(target, line) - sleep(1) - else: - space = 0 - for x in range(math.ceil(len(line)/400)): - oldspace = space - space = line.find(" ", (x+1)*400, (x+1)*400+50) - self.connection.privmsg(target, line[oldspace:space]) - sleep(1) - else: - self.connection.reconnect() - sleep(1) - self.send(string) - - def on_invite(self, connection, event): - for chan in event.arguments: - connection.join(chan) - - def on_welcome(self, connection, event): - for chan in self.chans: - connection.join(chan) -- cgit v1.2.3 From 7baee36853d0fae399a951918c2b8ebe4e6da6a8 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 20 Jan 2014 22:43:12 +0100 Subject: refactor vim configuration --- ship/lib/vim | 37 +++++++++++++++++++++++++++++++++++++ ship/src/vim_sane_defaults | 11 +++++++++++ 2 files changed, 48 insertions(+) create mode 100644 ship/lib/vim create mode 100644 ship/src/vim_sane_defaults diff --git a/ship/lib/vim b/ship/lib/vim new file mode 100644 index 00000000..de1ec5b0 --- /dev/null +++ b/ship/lib/vim @@ -0,0 +1,37 @@ +# configure vim + +vimrc=$HOME/.vimrc + +vim_conf_sane_defaults(){ + cat >>$vimrc< +nnoremap +vnoremap +set wildignore=*.o,*.obj,*.bak,*.exe,*.os +colorscheme darkblue +set background=dark +set number +set mouse= +set shiftwidth=2 +set tabstop=2 +set et +set sw=2 +set smarttab +set autoindent +set backspace=indent,eol,start +set nocp +EOF +} diff --git a/ship/src/vim_sane_defaults b/ship/src/vim_sane_defaults new file mode 100644 index 00000000..eb8c4c5d --- /dev/null +++ b/ship/src/vim_sane_defaults @@ -0,0 +1,11 @@ +#!/bin/sh +#@strict +#@include core +#@include vim +#@punani +#@mainifyme +info "installing punani" +punani install vim +touch $vimrc +info "configuring vim" +vim_conf_sane_defaults -- cgit v1.2.3 From a774db6b3d89a106689fb1365f65b4a49c2dedec Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 20 Jan 2014 22:45:54 +0100 Subject: ship fix typo --- ship/lib/vim | 2 ++ ship/src/vim_sane_defaults | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ship/lib/vim b/ship/lib/vim index de1ec5b0..43173585 100644 --- a/ship/lib/vim +++ b/ship/lib/vim @@ -3,6 +3,7 @@ vimrc=$HOME/.vimrc vim_conf_sane_defaults(){ + # TODO - make stuff more modular? cat >>$vimrc< Date: Tue, 21 Jan 2014 19:37:32 +0100 Subject: sites: add task.krebsco.de --- sites/task.krebsco.de/README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sites/task.krebsco.de/README.md diff --git a/sites/task.krebsco.de/README.md b/sites/task.krebsco.de/README.md new file mode 100644 index 00000000..c6fd2b0f --- /dev/null +++ b/sites/task.krebsco.de/README.md @@ -0,0 +1,40 @@ +# task.krebsco.de +a taskd server deployment + +# Installation + + yaourt -S taskd + cp /usr/share/taskd/pki/generate.client /var/lib/taskd + +# configuration +taskd uses pki for login + + systemctl enable taskd + systemctl start taskd + export TASKDDATA=/var/lib/taskd + taskd add org Krebs + taskd config --force pid.file $TASKDDIR/taskd.pid + taskd config --force log $TASKDDIR/taskd.log + taskd config --force client.allow '^task [2-9],^taskd,^libtaskd' + +# add new client +for a new client we need to create certificates: + + # on server + cd /var/lib/taskd + ./generate.client username + # give new certs to user + curl -F'p=username.cert.pem' http://paste + curl -F'p=username.key.pem' http://paste + curl -F'p=ca.cert.pem' http://paste + taskd add user krebs username + # outputs + + # on client + mkdir ~/.task + curl http://paste/abcde > username.cert.pem + curl http://paste/efghi > username.key.pem + curl http://paste/jklmn > ca.cert.pem + task config taskd.server task.krebsco.de:53589 + task config taskd.credentials 'krebs/makefu/' + task sync init -- cgit v1.2.3 From 224433f4b7bffd545f5b74c6a041262487d0f335 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 22 Jan 2014 01:28:54 +0100 Subject: sites: add omo torrent setup --- sites/omo/torrent.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 sites/omo/torrent.md diff --git a/sites/omo/torrent.md b/sites/omo/torrent.md new file mode 100644 index 00000000..61feea94 --- /dev/null +++ b/sites/omo/torrent.md @@ -0,0 +1,25 @@ +# Running torrents through socks +## Prereqs: +- qBittorrent +- winswitch (xpra) or qbittorrent-nox + +## Install +### Winswitch +see http://winswitch.org/downloads/debian-repository.html + +## Autostart (xpra) + + # in startup script: + export DISPLAY=:11 + xpra start $DISPLAY + tmux start-server + tmux new-window -t tools:1 'ssh -q -D1234 ' + tmux new-window -t tools:2 'qbittorrent' + # attach to it: + xpra attach ssh:omo:11 + +## Autostart (nox) +see https://github.com/qbittorrent/qBittorrent/wiki/Running-qBittorrent-without-X-server + +## Lessons learned +- transmission sucks (no proxy support -- cgit v1.2.3 From 3ca518888e9e72f80984dccb8afb1bde31a547dd Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 22 Jan 2014 03:02:55 +0100 Subject: news/ircasy: handle kick correctly --- Reaktor/IRC/ircasy.py | 13 ++++++++++--- news/newsbot.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index 7821305f..e32179bb 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -107,6 +107,9 @@ class asybot(asychat): elif command == 'INVITE': self.on_invite(prefix, command, params, rest) + elif command == 'KICK': + self.on_kick(prefix, command, params, rest) + elif command == '433': # ERR_NICKNAMEINUSE, retry with another name _, nickname, int, _ = split('^.*[^0-9]([0-9]+)$', self.nickname) \ @@ -158,11 +161,15 @@ class asybot(asychat): def ME(self, target, text): self.PRIVMSG(target, ('ACTION ' + text + '')) - def on_privmsg(self, prefix, command, params, rest): - pass - def on_welcome(self, prefix, command, params, rest): self.push('JOIN %s' % ','.join(self.channels)) + def on_kick(self, prefix, command, params, rest): + for chan in params: + self.channels.remove(chan) + + def on_privmsg(self, prefix, command, params, rest): + pass + def on_invite(self, prefix, command, params, rest): pass diff --git a/news/newsbot.py b/news/newsbot.py index 54a2e7d2..f1ab9ce5 100644 --- a/news/newsbot.py +++ b/news/newsbot.py @@ -231,7 +231,7 @@ F.close() for line in lines: line = line.strip('\n') linear = line.split('|') - bot = RssBot(linear[1], linear[0], init_channels + linear[2].split(), url_shortener=url_shortener) + bot = RssBot(linear[1], linear[0], linear[2].split(), url_shortener=url_shortener) bot.start_rss() bots[linear[0]] = bot -- cgit v1.2.3 From 37d5c80ab68f28b453aaf38fce8aa944e010d360 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 22 Jan 2014 03:14:55 +0100 Subject: ircasy: fix on_kick --- Reaktor/IRC/ircasy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index e32179bb..150498dd 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -165,8 +165,10 @@ class asybot(asychat): self.push('JOIN %s' % ','.join(self.channels)) def on_kick(self, prefix, command, params, rest): - for chan in params: - self.channels.remove(chan) + self.log.debug(params) + if params[-1] == self.nickname: + for chan in params[:-1]: + self.channels.remove(chan) def on_privmsg(self, prefix, command, params, rest): pass -- cgit v1.2.3 From 7c579f4692198045e9fe4d6957eaaa210df76c75 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 22 Jan 2014 03:19:58 +0100 Subject: news: add chan to channels on invite --- news/newsbot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/news/newsbot.py b/news/newsbot.py index f1ab9ce5..40f2c385 100644 --- a/news/newsbot.py +++ b/news/newsbot.py @@ -39,6 +39,7 @@ class NewsBot(asybot): def on_invite(self, prefix, command, params, rest): for chan in rest.split(): self.push('JOIN ' + chan) + self.channels.append(chan) def read_message(self, args): try: -- cgit v1.2.3 From 07a3ca010414bf249a8e865eca9e597c9013a986 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 22 Jan 2014 03:22:24 +0100 Subject: news: rssbot same --- news/newsbot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/news/newsbot.py b/news/newsbot.py index 40f2c385..899c5dd2 100644 --- a/news/newsbot.py +++ b/news/newsbot.py @@ -216,6 +216,7 @@ class RssBot(asybot): def on_invite(self, prefix, command, params, rest): for chan in rest.split(): self.push('JOIN ' + chan) + self.channels.append(chan) feedfile = 'new_feeds' url_shortener = 'http://wall' -- cgit v1.2.3 From 9e66fd62cf9038d38e1642790c74daa7fa292589 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 22 Jan 2014 15:58:12 +0100 Subject: tinc_setup: remove legacy documentation --- retiolum/scripts/tinc_setup/README.md | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/retiolum/scripts/tinc_setup/README.md b/retiolum/scripts/tinc_setup/README.md index 11d6f6e9..c4892474 100644 --- a/retiolum/scripts/tinc_setup/README.md +++ b/retiolum/scripts/tinc_setup/README.md @@ -1,18 +1,10 @@ -This directory contains the build and install scripts for shack-retiolum +# Description +new_install.sh is the script fur bootstrapping tinc. +We use irc for the initial key exchange, specifically +irc.freenode.com#krebs_incoming . -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 +# Usage + + curl tinc.krebsco.de | HOSTN=bobkhan sh + # or + HOSTN=wrryyyyy ./new_install.sh -- cgit v1.2.3 From 2b4a7b09a5ea90cde39747f503ddc3cf030eb2aa Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 22 Jan 2014 15:58:59 +0100 Subject: buildbot: Installation.md - Fix installation pseudo script --- sites/buildbot.krebsco.de/INSTALLATION.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sites/buildbot.krebsco.de/INSTALLATION.md b/sites/buildbot.krebsco.de/INSTALLATION.md index b31a3989..83ffc9c3 100644 --- a/sites/buildbot.krebsco.de/INSTALLATION.md +++ b/sites/buildbot.krebsco.de/INSTALLATION.md @@ -1,11 +1,12 @@ #?/bin/sh # something like this -useradd ci -punani install python-virtualenv +useradd ci -m +punani install python2-virtualenv su ci -virtualenv buildbot -echo ". $HOME/buildbot/bin/activate" >~/.bashrc +virtualenv2 buildbot +echo ". $HOME/buildbot/bin/activate" >>~/.bashrc +. ~/.bashrc pip install buildbot-slave buildbot buildbot create-master master # tahoe cp krebs:master.conf master/master.conf -- cgit v1.2.3 From 94d08d0c36a954dfec45fba80eae71bb198ccf80 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 22 Jan 2014 16:00:49 +0100 Subject: fix broken 'strict' in ship/build --- ship/build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ship/build b/ship/build index 3f96cfe1..730f72ee 100755 --- a/ship/build +++ b/ship/build @@ -43,8 +43,7 @@ EOF ## usage: #@strict -> build_strict_mode \1 build_strict_mode() { cat< Date: Thu, 23 Jan 2014 12:03:44 +0100 Subject: hosts: linuxatom (rtjure) --- retiolum/hosts/linuxatom | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/linuxatom diff --git a/retiolum/hosts/linuxatom b/retiolum/hosts/linuxatom new file mode 100644 index 00000000..dfd09b51 --- /dev/null +++ b/retiolum/hosts/linuxatom @@ -0,0 +1,11 @@ +Subnet = 10.243.173.58 +Subnet = 42:1c07:1a24:1a26:c799:3b44:a8f5:59ea + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAvGy172meTuwHfGZLVHi04+7jb+GRumqNRowffrmMOxFAq6wiL1E6 +7NfJFSc2/wmLZdTCnAtScVicVFZ8UEK2Uv/WMdevJWP63LxUOXpSFtoxNAlpSk9e +rzwxWj3VxHru7EZA6gu45ff4/seApy/jDy+hceOmOiG5z8VudoRYWe98IoO1ua0E +rtz415WP0xN+Mb4mGU48JSLYZkOHVIvkf+VVF5jXFbbnH+w0kkTuRMMp6Z7ETvdZ +RU9nKJ55sflkPhs1/ttU4cYkci55YPVGl7GCCr6Xw4oerIz/jHnzBGroh/wDpEXm +6RxpsC6DnVQUW3zw0DXuSKoAy0UoQPYqQwIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From cafc0073d91f8d1c17d3f61631122b65483a3be3 Mon Sep 17 00:00:00 2001 From: momo Date: Sun, 26 Jan 2014 21:34:19 +0100 Subject: removeing links from svg --- cholerab/bling/krebs_plain.svg | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/cholerab/bling/krebs_plain.svg b/cholerab/bling/krebs_plain.svg index 59e21f60..349d7e6e 100644 --- a/cholerab/bling/krebs_plain.svg +++ b/cholerab/bling/krebs_plain.svg @@ -68,36 +68,25 @@ inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)"> - - - - - - -- cgit v1.2.3 From 880f025d789b3752107efd4e26fc6305f0ed484e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 Jan 2014 16:48:45 +0100 Subject: hosts: rtjure_ras (rtjure) --- retiolum/hosts/rtjure_ras | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/rtjure_ras diff --git a/retiolum/hosts/rtjure_ras b/retiolum/hosts/rtjure_ras new file mode 100644 index 00000000..ba44cb02 --- /dev/null +++ b/retiolum/hosts/rtjure_ras @@ -0,0 +1,11 @@ +Subnet = 10.243.212.68 +Subnet = 42:627f:6f2a:b631:26f7:8d69:4c3a:23b0 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAvu1ZjElrPpJ/ery0BAYxWPtb/ZLio+PuhrsOy9BBq6b7/FHw/1yf +GOCDa2fkdE1/pVLhI62KL+j/nDCgpHtVxzupVYKSyKOuZXnNGAS7vAHNM27jaYHp +3DTI0Npu13v2r5rgraPOm6eGrd/D0u2gr3T9Zq8PRtg5JrXBWMU4Ugt+Kfv0V+xL +v0lX21xZrUjvhtd0/vTcNkYLWZK5ftfU18/i3D6CimlG+AsKyeAnYe9Nkcmet84s +65SbgQ6SBr2YyN5c7wC9j1/Ney3k+aTbxsvHqDyQ8bq8WnsDQR2B8JPZGPLd7VHD +hdPGzus2PmJa84oB7smuUdt/5oAjzgghkQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 9784aab17ab76440057aaa3b7508762ee2ea1fdd Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 30 Jan 2014 12:34:34 +0100 Subject: ship/build: set -o posix may crash the shell if it is not existing --- ship/build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ship/build b/ship/build index 3f96cfe1..730f72ee 100755 --- a/ship/build +++ b/ship/build @@ -43,8 +43,7 @@ EOF ## usage: #@strict -> build_strict_mode \1 build_strict_mode() { cat< Date: Sun, 2 Feb 2014 18:00:49 +0100 Subject: bling: lcd version of krebs --- cholerab/bling/krebs_lcd.png | Bin 0 -> 1628 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 cholerab/bling/krebs_lcd.png diff --git a/cholerab/bling/krebs_lcd.png b/cholerab/bling/krebs_lcd.png new file mode 100644 index 00000000..268e61dd Binary files /dev/null and b/cholerab/bling/krebs_lcd.png differ -- cgit v1.2.3 From 58b704c470751e453ecc6e22dafec86efb9819ce Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 2 Feb 2014 18:05:12 +0100 Subject: bling: resize lcd to 256x256 --- cholerab/bling/krebs_lcd.png | Bin 1628 -> 2105 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/cholerab/bling/krebs_lcd.png b/cholerab/bling/krebs_lcd.png index 268e61dd..046ba90f 100644 Binary files a/cholerab/bling/krebs_lcd.png and b/cholerab/bling/krebs_lcd.png differ -- cgit v1.2.3 From 24157e8747fc1ddf4172cb94ac11d6dd93632349 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 4 Feb 2014 22:50:59 +0100 Subject: add pike --- retiolum/hosts/pike | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/pike diff --git a/retiolum/hosts/pike b/retiolum/hosts/pike new file mode 100644 index 00000000..1d47a614 --- /dev/null +++ b/retiolum/hosts/pike @@ -0,0 +1,11 @@ +Subnet = 10.243.97.232 +Subnet = 42:4d6d:8699:99c2:0de9:ea78:8d50:f53a + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEA0CS28CMhqeUuJxY+JEISeEDzP2I5T5ILFn4/3loEagEtS90QAm/K +rbMDbvJENrNCnaaOcHuOsG3vS8s31ffY9RM89Na2zjcV9l0QBhBkNebUr/Ol0nQp +ONWXEgmXV2mCGfFnC4uOHhELkZhnkwJduWfR5kyGPPApjxlBVIbI8pkAV4GFqjoF +WTTm9qp80G26sD4O2q+Ldv9eIKquPAHN/zMFk0TzhgmAylgQUcc84HdUDZ+g9n1Q +Ap62VwM8lGcnRy+f03cBaPyWQEEdnA3hG2mMfaaAoVYw4eruBbAz8GGUPMT3UH/E +rGGNmyVzzUQOKvnOjB4qvyseSI+/mPzGJQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 166650f12b805ca45e7ad5c64b852bc4afb71f68 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Feb 2014 23:35:53 +0100 Subject: ship build: refix broken 'strict' --- ship/build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ship/build b/ship/build index 730f72ee..bcb1f504 100755 --- a/ship/build +++ b/ship/build @@ -43,7 +43,8 @@ EOF ## usage: #@strict -> build_strict_mode \1 build_strict_mode() { cat</dev/null) && set -o posix EOF } -- cgit v1.2.3 From c34e9d3f15a12fb52cfa691c6cb8fd9062a36580 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Feb 2014 23:38:21 +0100 Subject: ship build: refix harder --- ship/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ship/build b/ship/build index bcb1f504..0e8e1013 100755 --- a/ship/build +++ b/ship/build @@ -44,7 +44,7 @@ EOF build_strict_mode() { cat</dev/null) && set -o posix +(set -o posix 2>/dev/null) && set -o posix || : EOF } -- cgit v1.2.3 From 131fdec0538abda5d068c57cb2daf30fd82871aa Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 10 Feb 2014 18:26:34 +0100 Subject: hosts: new supernode fastpoke --- retiolum/hosts/fastpoke | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 retiolum/hosts/fastpoke diff --git a/retiolum/hosts/fastpoke b/retiolum/hosts/fastpoke new file mode 100644 index 00000000..e3c0bf52 --- /dev/null +++ b/retiolum/hosts/fastpoke @@ -0,0 +1,12 @@ +Address = aidsballs.de +Subnet = 10.243.253.152 +Subnet = 42:422a:194f:ff3b:e196:2f82:5cf5:bc00 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAs4p5xsQYx06v+OkUbc09K6voFAbkvO66QdFoM71E10XyCeLP6iuq +DaIOFN4GrPR36pgyjqtJ+62G9uR+WsB/y14eio1p1ivDWgcpt5soOZAH5zVRRD9O +FBDlgVNwIJ6stMHy6OenEKWsfEiZRN3XstnqAqyykzjddglth1tJntn6kbZehzNQ +ezfIyN4XgaX2fhSu+UnAyLcV8wWnF9cMABjz7eKcSmRJgtG4ZiuDkbgiiEew7+pB +EPqOVQ80lJvzQKgO4PmVoAjD9A+AHnmLJNPDQQi8nIVilGCT60IX+XT1rt85Zpdy +rEaeriw/qsVJnberAhDAdQYYuM1ai2H5swIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From d03fc4c7fdc316504f71689269b2886fc4394644 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 11 Feb 2014 23:41:54 +0100 Subject: hosts: reimae added --- retiolum/hosts/reimae | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/reimae diff --git a/retiolum/hosts/reimae b/retiolum/hosts/reimae new file mode 100644 index 00000000..bcdd0f1e --- /dev/null +++ b/retiolum/hosts/reimae @@ -0,0 +1,11 @@ +Subnet = 10.243.177.212 +Subnet = 42:5965:bb44:aed3:9d3d:29f6:201d:7adf + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEA37lXlJpfT4pgxV1XB3VzUiALVjOexrHezJZ3YxgZTVUtTTxOnydl +urN7S4WaRgFkRPlwATGrp+KzJ6fz5/zeryYwbBUY66kcTEfJBP3+zKgWu3NIqOll +SCcnpjlEm46FcstJ5dnnuYqhpnp98z8QkTiXHZKMI4rB+yf5NdKnMetAUsSUe2wI +bXSxJ9lNrSm/IFToaVZ3KPYZwQ0HgzUxSWb5grkCuK5iWtGhqdf0/pqEzMpI1Y1c +QKepcJkRCUcd2InKb9AdpwT/xygNwbPkvjxIAKj7vK/4rr5LApJAOcFL+HJRz4CT +lDrM5LDeGtsIr+mIUbSTR6R0onWCn543LQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 8923831a4e794e5ccd6c485da71d8a18add789e0 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 11 Feb 2014 23:46:13 +0100 Subject: hosts: reimae now supernode --- retiolum/hosts/reimae | 1 + 1 file changed, 1 insertion(+) diff --git a/retiolum/hosts/reimae b/retiolum/hosts/reimae index bcdd0f1e..696c3442 100644 --- a/retiolum/hosts/reimae +++ b/retiolum/hosts/reimae @@ -1,3 +1,4 @@ +Address = reimae.de Subnet = 10.243.177.212 Subnet = 42:5965:bb44:aed3:9d3d:29f6:201d:7adf -- cgit v1.2.3 From cd0483f44a720e7f33cd75a7c9eeb454f5f2328d Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 13 Feb 2014 20:29:08 +0100 Subject: add ufo --- retiolum/hosts/ufo | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/ufo diff --git a/retiolum/hosts/ufo b/retiolum/hosts/ufo new file mode 100644 index 00000000..8ccdb2c7 --- /dev/null +++ b/retiolum/hosts/ufo @@ -0,0 +1,11 @@ +Subnet = 10.243.191.183 +Subnet = 42:1349:b0ea:b4ca:a9ef:1086:5718:3ca2 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAmrDbqG+TzMsKLlaf7VzFmzPvR1d19r7O12ldEdgT29bJJ+bqYqaq +3KMITOgK6gZVP416gR74/JqD+CRE1ZU6DjVoAoMIB4mzPVgy65SJwHabXOTMYknb +qzAIhg6cN+6cfNrUTWynBT0kDX5241f2YHmJiRCV1WjzTS9DadGbLp7f6C7YruVo +cKbC60uaESCm+gfL/fql/NlLKGxP4tAqwHqta8CkYWfUjXEAhzonxJ7zI8FZOvxj +tLUBhKj4roWPN5CvzPwW+5ZRheAZezj+tmU3nCmlSufXLoFwu+2rqv60esTpZT4k +DjCRbHhvHVb3/xwQHxLWp4emINcGV2k9SQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 5d956536e08757641d75ca63c80f1b8d2d66b50d Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 16 Feb 2014 22:30:15 +0100 Subject: retiolum/hosts: add irvis --- retiolum/hosts/irvis | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/irvis diff --git a/retiolum/hosts/irvis b/retiolum/hosts/irvis new file mode 100644 index 00000000..923a0dd7 --- /dev/null +++ b/retiolum/hosts/irvis @@ -0,0 +1,11 @@ +Subnet = 10.243.159.20 +Subnet = 42:db9b:ea89:dca4:fc6e:309b:23f0:ec09 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAr9EwWsVkeNqkFIvMYt/QalEGhKYTpM1MxR4DCG7hhZJcXOpigSC0 +fsB61FM/LkvG32/OTt7vPXSRfPW8RnRL0lxedNbMnax3pjgzP4yl4BAvEQW7AW/A +silSYFAr+4Br9ng99kQniXg+RJ9QHLq4Rg0V1/aOZWNWmSk4PmAzQfzINpTXZC3G +dUidZRIWJPTE1lJQfEpML1OI0UfiaYIAOE7Jhx+3vpzsePLF9s6iiw66ANg8mfFC +fb8OHP4zPrnoR/NSNLGjrhyXxiq2EMUmcG38xn769cMEvElzPd0pHYuEzTeYxlk5 +0YEqAsjMYIdaxVDMczRmP+BFH/+sdUcjAwIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 2ece835fcffbd14f63ae0654d58713d4047c8a25 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Feb 2014 12:46:49 +0100 Subject: whatweb: add firefox 25 user agent to whatweb --- Reaktor/commands/whatweb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Reaktor/commands/whatweb b/Reaktor/commands/whatweb index afe20360..68f8aa38 100755 --- a/Reaktor/commands/whatweb +++ b/Reaktor/commands/whatweb @@ -4,4 +4,4 @@ here=$(dirname `readlink -f $0`) whatweb_bin="$here/../repos/whatweb/whatweb" [ ! -e "$whatweb_bin" ] && echo "!! Whatweb app does not exist" && exit 1 [ -z "${1:-}" ] && echo "!! no host given" && exit 1 -exec $whatweb_bin -a 3 "$1" 2>&1 +exec $whatweb_bin --user-agent="Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0" -a 3 "$1" 2>&1 -- cgit v1.2.3 From fac7133f6dcc2aeb7083ad2971c1e7836b4a2453 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 18 Feb 2014 23:01:21 +0100 Subject: fix py2 py3 issue in supernodes script --- retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py b/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py index 7bb79708..7e1f4dae 100755 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 def find_potential_super(path="/etc/tinc/retiolum/hosts"): import os @@ -56,4 +56,4 @@ if __name__ == "__main__": usage """ for host,addrs in check_all_the_super(): - print(host,addrs) + print("%s %s" %(host,str(addrs))) -- cgit v1.2.3 From bcc7aefa1c6fb999992c07327e1df9456814a283 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 13:41:11 +0100 Subject: retiolum github hosts sync: initial commit --- retiolum/scripts/github_hosts_sync/index | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 retiolum/scripts/github_hosts_sync/index diff --git a/retiolum/scripts/github_hosts_sync/index b/retiolum/scripts/github_hosts_sync/index new file mode 100755 index 00000000..31cbc763 --- /dev/null +++ b/retiolum/scripts/github_hosts_sync/index @@ -0,0 +1,62 @@ +#! /bin/sh +# TODO do_work should retry until success +set -euf + +port=1028 +local_painload=/krebs; remote_painload="git@github.com:krebscode/painload.git" +local_hosts=/tmp/hosts; remote_hosts="git@github.com:krebscode/hosts.git" + +main() { + ensure_local_painload + ensure_local_hosts + is_worker && do_work || become_server +} + +ensure_local_painload() { + test -d "$local_painload" || git clone "$remote_painload" "$local_painload" +} + +ensure_local_hosts() { + test -d "$local_hosts" || git clone "$remote_hosts" "$local_hosts" +} + +become_server() { + exec socat "TCP-LISTEN:$port,reuseaddr,fork" "EXEC:$0" +} + +is_worker() { + test "${SOCAT_SOCKPORT-}" = "$port" +} + +do_work() { + # read request + req_line="$(read line && echo "$line")" + req_hdrs="$(sed -n '/^\r$/q;p')" + + set -x + + cd "$local_hosts" + git pull >&2 + + cd "$local_hosts" + find . -name .git -prune -o -type f -exec git rm \{\} \; >/dev/null + + cd "$local_painload" + git pull >&2 + + find "$local_painload/retiolum/hosts" -type f -exec cp \{\} "$local_hosts" \; + + cd "$local_hosts" + find . -name .git -prune -o -type f -exec git add \{\} \; >&2 + if git status --porcelain | grep -q .; then + git commit -m bump >&2 + git push >&2 + fi + + echo "HTTP/1.1 200 OK" + echo + echo "https://github.com/krebscode/hosts/archive/master.tar.gz" + echo "https://github.com/krebscode/hosts/archive/master.zip" +} + +main "$@" -- cgit v1.2.3 From 2ce39803bf71bd49503ee8a6d81d73091883b465 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 13:48:03 +0100 Subject: hosts sync: add systemd files --- retiolum/scripts/github_hosts_sync/index | 2 +- .../scripts/github_hosts_sync/systemd/hosts-sync.conf | 1 + .../scripts/github_hosts_sync/systemd/hosts-sync.service | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 retiolum/scripts/github_hosts_sync/systemd/hosts-sync.conf create mode 100644 retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service diff --git a/retiolum/scripts/github_hosts_sync/index b/retiolum/scripts/github_hosts_sync/index index 31cbc763..7b444ea4 100755 --- a/retiolum/scripts/github_hosts_sync/index +++ b/retiolum/scripts/github_hosts_sync/index @@ -2,7 +2,7 @@ # TODO do_work should retry until success set -euf -port=1028 +port=${port-1028} local_painload=/krebs; remote_painload="git@github.com:krebscode/painload.git" local_hosts=/tmp/hosts; remote_hosts="git@github.com:krebscode/hosts.git" diff --git a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.conf b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.conf new file mode 100644 index 00000000..606f17b4 --- /dev/null +++ b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.conf @@ -0,0 +1 @@ +port=1028 diff --git a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service new file mode 100644 index 00000000..60d4799f --- /dev/null +++ b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service @@ -0,0 +1,15 @@ +[Unit] +Description=retiolum github hosts sync +After=network.target + +[Service] +EnvironmentFile=/etc/conf.d/retiolum-github-hosts-sync.conf +ExecStart=/krebs/retiolum/scripts/github_hosts_sync/index +KillMode=process +User=hosts-sync +Group=hosts-sync +Restart=yes + +[Install] +WantedBy=multi-user.target + -- cgit v1.2.3 From 69afd37b41d04b25a868da7d8fd2241b2a3aaa03 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 13:58:09 +0100 Subject: hosts sync: fix pasto --- retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service index 60d4799f..16235a6d 100644 --- a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service +++ b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service @@ -3,7 +3,7 @@ Description=retiolum github hosts sync After=network.target [Service] -EnvironmentFile=/etc/conf.d/retiolum-github-hosts-sync.conf +EnvironmentFile=/etc/conf.d/hosts-sync.conf ExecStart=/krebs/retiolum/scripts/github_hosts_sync/index KillMode=process User=hosts-sync -- cgit v1.2.3 From fabc9fa4705f4d1ae08468957a5bf4a0ecae672a Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 14:02:51 +0100 Subject: hosts sync: fix remote painload uri --- retiolum/scripts/github_hosts_sync/index | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/scripts/github_hosts_sync/index b/retiolum/scripts/github_hosts_sync/index index 7b444ea4..e4da9305 100755 --- a/retiolum/scripts/github_hosts_sync/index +++ b/retiolum/scripts/github_hosts_sync/index @@ -3,7 +3,7 @@ set -euf port=${port-1028} -local_painload=/krebs; remote_painload="git@github.com:krebscode/painload.git" +local_painload=/krebs; remote_painload="https://github.com/krebscode/painload" local_hosts=/tmp/hosts; remote_hosts="git@github.com:krebscode/hosts.git" main() { -- cgit v1.2.3 From 023e449de9e0f5731d9a88f7a9eacc18e1f9af96 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 14:03:04 +0100 Subject: hosts sync: fix service parse error --- retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service | 1 - 1 file changed, 1 deletion(-) diff --git a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service index 16235a6d..83609740 100644 --- a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service +++ b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service @@ -8,7 +8,6 @@ ExecStart=/krebs/retiolum/scripts/github_hosts_sync/index KillMode=process User=hosts-sync Group=hosts-sync -Restart=yes [Install] WantedBy=multi-user.target -- cgit v1.2.3 From 93c56cedd11be673176f1519fd17d05f67844e34 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 14:08:47 +0100 Subject: hosts sync: fix local repo uris --- retiolum/scripts/github_hosts_sync/index | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/retiolum/scripts/github_hosts_sync/index b/retiolum/scripts/github_hosts_sync/index index e4da9305..53c96efd 100755 --- a/retiolum/scripts/github_hosts_sync/index +++ b/retiolum/scripts/github_hosts_sync/index @@ -3,8 +3,10 @@ set -euf port=${port-1028} -local_painload=/krebs; remote_painload="https://github.com/krebscode/painload" -local_hosts=/tmp/hosts; remote_hosts="git@github.com:krebscode/hosts.git" +local_painload=$HOME/painload +remote_painload="https://github.com/krebscode/painload" +local_hosts=$HOME/hosts +remote_hosts="git@github.com:krebscode/hosts.git" main() { ensure_local_painload -- cgit v1.2.3 From a265ea9d0693a25fffa2ed0eaa9622b91758f51a Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 14:10:56 +0100 Subject: hosts sync: rename index for nicer journal --- retiolum/scripts/github_hosts_sync/hosts-sync | 64 ++++++++++++++++++++++ retiolum/scripts/github_hosts_sync/index | 64 ---------------------- .../github_hosts_sync/systemd/hosts-sync.service | 2 +- 3 files changed, 65 insertions(+), 65 deletions(-) create mode 100755 retiolum/scripts/github_hosts_sync/hosts-sync delete mode 100755 retiolum/scripts/github_hosts_sync/index diff --git a/retiolum/scripts/github_hosts_sync/hosts-sync b/retiolum/scripts/github_hosts_sync/hosts-sync new file mode 100755 index 00000000..53c96efd --- /dev/null +++ b/retiolum/scripts/github_hosts_sync/hosts-sync @@ -0,0 +1,64 @@ +#! /bin/sh +# TODO do_work should retry until success +set -euf + +port=${port-1028} +local_painload=$HOME/painload +remote_painload="https://github.com/krebscode/painload" +local_hosts=$HOME/hosts +remote_hosts="git@github.com:krebscode/hosts.git" + +main() { + ensure_local_painload + ensure_local_hosts + is_worker && do_work || become_server +} + +ensure_local_painload() { + test -d "$local_painload" || git clone "$remote_painload" "$local_painload" +} + +ensure_local_hosts() { + test -d "$local_hosts" || git clone "$remote_hosts" "$local_hosts" +} + +become_server() { + exec socat "TCP-LISTEN:$port,reuseaddr,fork" "EXEC:$0" +} + +is_worker() { + test "${SOCAT_SOCKPORT-}" = "$port" +} + +do_work() { + # read request + req_line="$(read line && echo "$line")" + req_hdrs="$(sed -n '/^\r$/q;p')" + + set -x + + cd "$local_hosts" + git pull >&2 + + cd "$local_hosts" + find . -name .git -prune -o -type f -exec git rm \{\} \; >/dev/null + + cd "$local_painload" + git pull >&2 + + find "$local_painload/retiolum/hosts" -type f -exec cp \{\} "$local_hosts" \; + + cd "$local_hosts" + find . -name .git -prune -o -type f -exec git add \{\} \; >&2 + if git status --porcelain | grep -q .; then + git commit -m bump >&2 + git push >&2 + fi + + echo "HTTP/1.1 200 OK" + echo + echo "https://github.com/krebscode/hosts/archive/master.tar.gz" + echo "https://github.com/krebscode/hosts/archive/master.zip" +} + +main "$@" diff --git a/retiolum/scripts/github_hosts_sync/index b/retiolum/scripts/github_hosts_sync/index deleted file mode 100755 index 53c96efd..00000000 --- a/retiolum/scripts/github_hosts_sync/index +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -# TODO do_work should retry until success -set -euf - -port=${port-1028} -local_painload=$HOME/painload -remote_painload="https://github.com/krebscode/painload" -local_hosts=$HOME/hosts -remote_hosts="git@github.com:krebscode/hosts.git" - -main() { - ensure_local_painload - ensure_local_hosts - is_worker && do_work || become_server -} - -ensure_local_painload() { - test -d "$local_painload" || git clone "$remote_painload" "$local_painload" -} - -ensure_local_hosts() { - test -d "$local_hosts" || git clone "$remote_hosts" "$local_hosts" -} - -become_server() { - exec socat "TCP-LISTEN:$port,reuseaddr,fork" "EXEC:$0" -} - -is_worker() { - test "${SOCAT_SOCKPORT-}" = "$port" -} - -do_work() { - # read request - req_line="$(read line && echo "$line")" - req_hdrs="$(sed -n '/^\r$/q;p')" - - set -x - - cd "$local_hosts" - git pull >&2 - - cd "$local_hosts" - find . -name .git -prune -o -type f -exec git rm \{\} \; >/dev/null - - cd "$local_painload" - git pull >&2 - - find "$local_painload/retiolum/hosts" -type f -exec cp \{\} "$local_hosts" \; - - cd "$local_hosts" - find . -name .git -prune -o -type f -exec git add \{\} \; >&2 - if git status --porcelain | grep -q .; then - git commit -m bump >&2 - git push >&2 - fi - - echo "HTTP/1.1 200 OK" - echo - echo "https://github.com/krebscode/hosts/archive/master.tar.gz" - echo "https://github.com/krebscode/hosts/archive/master.zip" -} - -main "$@" diff --git a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service index 83609740..5fb9ed41 100644 --- a/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service +++ b/retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service @@ -4,7 +4,7 @@ After=network.target [Service] EnvironmentFile=/etc/conf.d/hosts-sync.conf -ExecStart=/krebs/retiolum/scripts/github_hosts_sync/index +ExecStart=/krebs/retiolum/scripts/github_hosts_sync/hosts-sync KillMode=process User=hosts-sync Group=hosts-sync -- cgit v1.2.3 From 180f3dd6c9cf6ea3a0d150c8a85d300dd09b177b Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 14:13:49 +0100 Subject: retiolum/hosts: rip UTART --- retiolum/hosts/UTART | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 retiolum/hosts/UTART diff --git a/retiolum/hosts/UTART b/retiolum/hosts/UTART deleted file mode 100644 index 3c8628cf..00000000 --- a/retiolum/hosts/UTART +++ /dev/null @@ -1,9 +0,0 @@ -Subnet = 42.227.239.205/32 ------BEGIN RSA PUBLIC KEY----- -MIIBCgKCAQEA1tFgR6xxNZavtG44QEAEzKQixJqO9MuO5hUcklH87Sml+Mz+Ptz/ -r8Vhmvc1NhL0d8h1VJSrzjAyYuBR0LKSGRYxHby/M9AqBjUHUhDM83ogV/CbSifs -TlBcKuvPkGVALN6LYcPXjzKzBI7X1ictqts9K3CoCWgjRld63noczvNnwVdHNawX -ckQdjzxMAgwtJW0hWfDr1Uhq3sVEFnHLzFJuLsnc6gDzKvP/ETQ6KINv43B9UerS -HzFK3ntViohW4K/p6i4gBNxFfYnuNLqnY+O/hc0/fFdKE36eLD8ngPURo3/As6Le -KlPEMBwIIJQpS7GP4BIUK/qPE9J7McU6wQIDAQAB ------END RSA PUBLIC KEY----- -- cgit v1.2.3 From 1cd304b57bc2ad725fa074d4537c2bdefa821085 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 19 Feb 2014 14:23:13 +0100 Subject: hosts-sync: add #?-doc --- retiolum/scripts/github_hosts_sync/README | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 retiolum/scripts/github_hosts_sync/README diff --git a/retiolum/scripts/github_hosts_sync/README b/retiolum/scripts/github_hosts_sync/README new file mode 100644 index 00000000..12aa8dfe --- /dev/null +++ b/retiolum/scripts/github_hosts_sync/README @@ -0,0 +1,26 @@ +#? /bin/sh + +useradd -m hosts-sync +cp systemd/hosts-sync.service /etc/systemd/system/ +cp systemd/hosts-sync.conf /etc/conf.d/ + +sudo -u hosts-sync -i ssh-keygen +add /home/hosts-sync/.ssh/id_rsa.pub as github/krebscode/hosts deploy key +sudo -u hosts-sync -i git clone git@github.com:krebscode/hosts.git ~hosts-sync/hosts # to accept the remote key (and have an initial copy) + +sudo -u hosts-sync -i git config --global user.email hosts-sync@ire.retiolum +sudo -u hosts-sync -i git config --global user.name hosts-sync +sudo -u hosts-sync -i git config --global push.default simple + +systemctl start hosts-sync +systemctl enable hosts-sync + +TODO firewall setup + +#? /bin/sh (update service) +git pull +cp retiolum/scripts/github_hosts_sync/systemd/hosts-sync.service /etc/systemd/system/ +systemctl daemon-reload +systemctl restart hosts-sync + + -- cgit v1.2.3 From 7c97efffbfe54dd4eee78e3ace2d4819a354ebe1 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 19 Feb 2014 17:43:33 +0100 Subject: hosts: new host sokrates --- retiolum/hosts/sokrates | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/sokrates diff --git a/retiolum/hosts/sokrates b/retiolum/hosts/sokrates new file mode 100644 index 00000000..97cf1b47 --- /dev/null +++ b/retiolum/hosts/sokrates @@ -0,0 +1,11 @@ +Subnet = 10.243.97.126 +Subnet = 42:28be:6907:ab4b:5c79:99f5:a4a1:2a25 + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEA0emA0JAong4wHSAEUrLrkh21n8I/+pLtpS4uGTcMHn9ZrS8Tg101 +S2poRE0jZUZu868mDeOwwxZRLmCE+bL0q1OrAUDY7+ricQSAz3CNQAAQB0Sjp7ju +YXKqLZQEYyOV3M8IJOALS72q4g1VTv5jQrLhGzMsv9vzuRSZV0pEV8tZwb187wLi +n27rwB6SPZv7uhC3R060x8Ze/pLmfmVfrxb9DwZS3d8X1PwygTrTjSAUTeMaDa69 +NSOzvKLx25fhZ0Gm3BA3pUQDEOiGOze3oT/0l3QJMvZ48TbG1KlSBOVwtL3+f5yM +gJZLF/JoTsYL0aZM+zHL6NAUmciy9dNXEQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 3ed35ed3e1efa4f741c0913efc90c9c36eb32d01 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 19 Feb 2014 22:44:32 +0100 Subject: hosts cleanup, bye pico and slowpoke --- retiolum/hosts/pico | 11 ----------- retiolum/hosts/slowpoke | 14 -------------- 2 files changed, 25 deletions(-) delete mode 100644 retiolum/hosts/pico delete mode 100644 retiolum/hosts/slowpoke diff --git a/retiolum/hosts/pico b/retiolum/hosts/pico deleted file mode 100644 index b08b450d..00000000 --- a/retiolum/hosts/pico +++ /dev/null @@ -1,11 +0,0 @@ -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----- -MIIBCgKCAQEAsbe4wzTOHHLyuPO/AsfDqQHyV41qgs3dqt6uWcDcdiEsUvbCK9Ch -MQNkTktlrMRyvz6Qm/3DKptp80R648j0nWi/c3aLDkZq8weEnR9SFYfNaUp/GN4s -+Qhb+836d8Hu2+3jZWlr5Zb/p8hyhcx3NUH/skuH6Hu+piWczlN1NGksf5f7N/bp -ZBCXnCLLUYVM/0RIS8mcAIX44Zx8YFDXpByePUdyrzn+mRln6VFDnt5uGsmNw6G/ -Azn3grpidcyrW2cs3b7rysKsxOvyGBdu2zGXp+pquZq1l3f06IN+fzCtnyLTPL1K -UUEJlQa1Gsl2pVi5+HPcAj3U2yp42WJYNwIDAQAB ------END RSA PUBLIC KEY----- diff --git a/retiolum/hosts/slowpoke b/retiolum/hosts/slowpoke deleted file mode 100644 index 27b1e57c..00000000 --- a/retiolum/hosts/slowpoke +++ /dev/null @@ -1,14 +0,0 @@ -Address = 62.113.241.235 -Subnet = 10.243.232.121 -Subnet = 42:7d8f:9e3a:dcc7:9b22:d1ca:7e28:fe9c -Subnet = 172.22.0.0/15 - ------BEGIN RSA PUBLIC KEY----- -MIIBCgKCAQEA9EtaOHLa0CyOGpX3rzMLqi9HqrjzVe3XdSfcb9QPYwcbxpPYNLLk -/1+4vxOI/TEh1QCu0bzPLy8tAwKF2DwnCH72yae17I0jVMW29Ng3Fdjzb3SmWJbf -C87X7c+Nx5+Yc7OIdvTi/BGPNpDEp7nJugubH1whSFfulCDbsGU3rX5IsDUiw4ha -B+5wH1coQl+Yp+M1ws5+PoHgYQ/ApYPBKEn+H7JAdnOTLbo0eI3B1PuDUrsMakMq -s4f74d2Z405xUGHhRRcerF0h5VD58TADxx7RSRd7oR06KlXM/RaqOkw9vzvA2vBq -CC+LdtIV7wWxF3uRAnk6odeFvqZTHvR4WQIDAQAB ------END RSA PUBLIC KEY----- - -- cgit v1.2.3 From f46851de1af7c044471523c40e0fe88579b8a997 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 20 Feb 2014 18:50:20 +0100 Subject: add proposal for find-supers this script may be used when bootstrapping new retiolum nodes --- ship/lib/retiolum | 76 +++++++++++++++++++++++++++++++++++++++++++++++ ship/src/find-supers-tinc | 6 ++++ 2 files changed, 82 insertions(+) create mode 100644 ship/lib/retiolum create mode 100644 ship/src/find-supers-tinc diff --git a/ship/lib/retiolum b/ship/lib/retiolum new file mode 100644 index 00000000..015537bd --- /dev/null +++ b/ship/lib/retiolum @@ -0,0 +1,76 @@ +#!/bin/sh +# retiolum host functions +#@include core +netname=${netname:-retiolum} + + +check_free_v4(){ + myipv4=${1-10.243.0.-1} + v4num=${myipv4##*.} + printf "Retard check: " + if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; + then + info "No retard detected\n" + cd /etc/tinc/$netname/hosts + info "Check if ip is still free: " + for i in `ls -1`; do + if grep -q -e $myipv4\$ $i ;then + warn "Host IP already taken by $i! " + return 1 + fi + done + info "Passed\n" + return 0 + else + error "you are made of stupid. bailing out\n" + return 1 + fi + cd - >/dev/null +} + +find_active_nodes(){ + # TODO this function currently only supports a single address for a host + cd /etc/tinc/retiolum/hosts + # posix grep does not support [[:space:]] + for name in ` + grep '^[ ]*Address[ ]*=' * | + cut -d: -f1 | sort | uniq + `; do + if eval "`sed -n ' + s/[ ]\+//g + s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p + ' $name`"; then + port=${Port-655} + for host in $Address; do + if nc -zw 2 $host $port 2>/dev/null; then + echo "$name [('$host', $port)]" + fi & + done + wait + fi & + done + wait + cd - >/dev/null +} +find_supernodes(){ + cd /etc/tinc/retiolum/hosts + for name in ` + grep '^[ ]*Address[ ]*=' * | + cut -d: -f1 | sort | uniq + `; do + if eval "`sed -n ' + s/[ ]\+//g + s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p + ' $name`"; then + port=${Port-655} + for host in $Address; do + if nc -zw 2 $host $port 2>/dev/null; then + echo "$name [('$host', $port)]" + fi & + done + wait + fi & + done + wait + cd - >/dev/null +}