From 2925d6cb15b5df594dde296624389ae201392101 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 22 Feb 2014 15:47:22 +0100 Subject: hosts: kiosk v6 Address --- retiolum/hosts/kiosk | 1 + 1 file changed, 1 insertion(+) diff --git a/retiolum/hosts/kiosk b/retiolum/hosts/kiosk index b490e8cd..8f53a08f 100644 --- a/retiolum/hosts/kiosk +++ b/retiolum/hosts/kiosk @@ -1,3 +1,4 @@ +Address = 2003:6a:674e:1001:211:25ff:fe05:a54d/64 Subnet = 10.243.232.122 Subnet = 42:1ad1:b481:00f5:aab8:f8cc:51fe:4b87 -- cgit v1.2.3 From 411ee049d557fc22e6f3959f866d59ec2dd32443 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 22 Feb 2014 17:06:32 +0100 Subject: news: timeout bug fix --- news/newsbot.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/news/newsbot.py b/news/newsbot.py index 899c5dd2..b24a86e4 100644 --- a/news/newsbot.py +++ b/news/newsbot.py @@ -175,8 +175,8 @@ class RssBot(asybot): self.sendall(entry.title + ' ' + shorturl) self.oldnews.append(entry.link) self.lastnew = datetime.now() - except: - print(self.nickname + ': rss timeout occured') + except Exception as e: + print(str(datetime.now().hour) + ':' + str(datetime.now().minute) + ' ' + self.nickname + ': ' + str(e)) sleep(self.to) def shortenurl(self, url): @@ -193,7 +193,10 @@ class RssBot(asybot): self.send_msg(target, feed.title + ' ' + self.shortenurl(feed.link)) def sendall(self, string): - self.send_msg(self.channels, string) + try: + self.send_msg(self.channels, string) + except Exception as e: + print(self.nickname + ': failed sending all to ' + str(self.channels) + ' because of ' + str(e)); def send_msg(self, target, string): if self.connected: @@ -209,9 +212,9 @@ class RssBot(asybot): else: self.reconnect() while not self.connected: - sleep(3) - print('waiting for reconnect') - self.send_msg(string) + sleep(10) + print(self.nickname + ' waiting for reconnect') + self.send_msg(target, string) def on_invite(self, prefix, command, params, rest): for chan in rest.split(): @@ -237,5 +240,12 @@ for line in lines: bot.start_rss() bots[linear[0]] = bot -th = threading.Thread(target=loop) +def thread_handler(): + while True: + try: + loop() + except Exception as e: + print('ohoh ' + e) + +th = threading.Thread(target=thread_handler) th.start() -- cgit v1.2.3 From a9a659f9b5aa46e2486c9171270d2b18e28e81f4 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 22 Feb 2014 17:07:39 +0100 Subject: news: harder retry --- news/newsbot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/news/newsbot.py b/news/newsbot.py index b24a86e4..8834851d 100644 --- a/news/newsbot.py +++ b/news/newsbot.py @@ -139,6 +139,8 @@ class RssBot(asybot): self.loop = True self.lastnew = datetime.now() self.url_shortener = url_shortener + self.retry = True + self.on_nickinuse = lambda: None def start_rss(self): self.upd_loop = threading.Thread(target=self.updateloop) -- cgit v1.2.3 From f81f2f75d7fd19680a21b7d4d2b54d1e16559ab8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 22 Feb 2014 17:08:27 +0100 Subject: reaktor: ircasy abstraction --- Reaktor/IRC/ircasy.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index 150498dd..fd261ae9 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -112,11 +112,7 @@ class asybot(asychat): elif command == '433': # ERR_NICKNAMEINUSE, retry with another name - _, nickname, int, _ = split('^.*[^0-9]([0-9]+)$', self.nickname) \ - if search('[0-9]$', self.nickname) \ - else ['', self.nickname, 0, ''] - self.nickname = nickname + str(int + 1) - self.handle_connect() + self.on_nickinuse(prefix, command, params, rest) elif command == '376': self.on_welcome(prefix, command, params, rest) @@ -175,3 +171,10 @@ class asybot(asychat): def on_invite(self, prefix, command, params, rest): pass + + def on_nickinuse(self, prefix, command, params, rest): + _, nickname, int, _ = split('^.*[^0-9]([0-9]+)$', self.nickname) \ + if search('[0-9]$', self.nickname) \ + else ['', self.nickname, 0, ''] + self.nickname = nickname + str(int + 1) + self.handle_connect() -- cgit v1.2.3 From be4d573b21895449e57a8263a5a9ca292500a74b Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 26 Feb 2014 17:04:54 +0100 Subject: sort //ship/lib/retiolum --- ship/lib/retiolum | 56 ++++++++++++++++++++++-------------------- sites/tahoe.retiolum/README.md | 13 +++++++++- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/ship/lib/retiolum b/ship/lib/retiolum index 2a5c7338..3956a200 100644 --- a/ship/lib/retiolum +++ b/ship/lib/retiolum @@ -5,34 +5,9 @@ tinc_path=${tinc_path:-/etc/tinc} netname=${netname:-retiolum} hosts_dir=${hosts_dir:-$tinc_path/$netname/hosts} -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 $hosts_dir - 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 +find_supernodes(){ cd $hosts_dir - # posix grep does not support [[:space:]] set +f for name in ` grep '^[ ]*Address[ ]*=' * | @@ -54,8 +29,11 @@ find_active_nodes(){ wait cd - >/dev/null } -find_supernodes(){ + +find_active_nodes(){ + # TODO this function currently only supports a single address for a host cd $hosts_dir + # posix grep does not support [[:space:]] set +f for name in ` grep '^[ ]*Address[ ]*=' * | @@ -77,3 +55,27 @@ find_supernodes(){ wait cd - >/dev/null } + +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 $hosts_dir + 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 +} diff --git a/sites/tahoe.retiolum/README.md b/sites/tahoe.retiolum/README.md index 01e8ed03..2d3b3e12 100644 --- a/sites/tahoe.retiolum/README.md +++ b/sites/tahoe.retiolum/README.md @@ -5,6 +5,17 @@ introducer and a number of tahoe bricks. # Adding new bricks & clients see //cholerab/tahoe/{brick,client}\_installation + +# Migration of the Introducer +At some point it is necessary to migrate the tahoe introducer. +To keep everything running just take the tahoe introducer configuration from +the old host or from krebs:tahoe/introducer AND the original tinc configuration +of the tahoe host. +After that, set the tahoe.krebsco.de ip in the krebs zone. + + +If you need to re + # Replacing the introducer if the introducer may die off, all crypto material is saved in krebs:tahoe/introducer. There will be a backup somewhere, but bootstrapping @@ -13,4 +24,4 @@ always sucks. Follow the generic brick installation, use the configuration file at conf/tahoe.cfg and copy the crypto material in the private folder of the installation. -autostart that shit +autostart that shit. -- cgit v1.2.3 From d818d26256380d1be91cb3d449271da96adb2105 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 26 Feb 2014 22:53:35 +0100 Subject: implement IRC proposal to refresh supernodes //ship/src/refresh-supers is the script which will update your tinc config and choose 5 working supernodes for you to connect to. This proposal may become part of the tinc.krebsco.de install script --- ship/lib/retiolum | 20 +++++++++++++++++++- ship/src/refresh-super-keys | 5 +++++ ship/src/refresh-supers | 9 ++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 ship/src/refresh-super-keys diff --git a/ship/lib/retiolum b/ship/lib/retiolum index 3956a200..1e55041c 100644 --- a/ship/lib/retiolum +++ b/ship/lib/retiolum @@ -1,10 +1,28 @@ #!/bin/sh # retiolum host functions #@include core +#@include network tinc_path=${tinc_path:-/etc/tinc} netname=${netname:-retiolum} hosts_dir=${hosts_dir:-$tinc_path/$netname/hosts} +supernode_urls="http://euer.krebsco.de/retiolum/supernodes.tar.gz" +reload_tinc(){ + info "reloading tinc configuration" + pkill -HUP tincd || tinc -n $netname reload; +} +refresh_supernode_keys(){ + for url in $supernode_urls;do + info "Trying $url to retrieve supernodes" + if http_get "$url" \ + | tar xvz -C $hosts_dir | xargs -n1 echo "refreshed:" ;then + info "refreshed supernode keys" + return 0 + else + error "$url unusable for retrieving supernode host files" + fi + done && return 1 +} find_supernodes(){ cd $hosts_dir @@ -67,7 +85,7 @@ check_free_v4(){ 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! " + error "Host IP already taken by $i! " return 1 fi done diff --git a/ship/src/refresh-super-keys b/ship/src/refresh-super-keys new file mode 100644 index 00000000..dddbe846 --- /dev/null +++ b/ship/src/refresh-super-keys @@ -0,0 +1,5 @@ +#!/bin/sh +#@info +#@include retiolum +#@mainifyme +refresh_supernode_keys diff --git a/ship/src/refresh-supers b/ship/src/refresh-supers index 26909a94..af31a5df 100644 --- a/ship/src/refresh-supers +++ b/ship/src/refresh-supers @@ -1,6 +1,9 @@ #!/bin/sh #@info # usage: [DEBUG=1] [tincconf=/not/tinc/retiolum/tinc.conf] $0 +# This is the implementation of the proposal how to update tinc supernode +# connections + #@include core #@include retiolum # using find_supernodes @@ -10,12 +13,14 @@ #@strict #@mainifyme +refresh_supernode_keys + max_connect_to=${max_connect_to:-5} tincconf=${tincconf:-$tinc_path/$netname/tinc.conf} tmp_tincconf=$(mktemp) defer "rm -f $tmp_tincconf" -sed '/[ ]*ConnectTo=/d' "$tincconf" > "$tmp_tincconf" +sed '/^[ ]*ConnectTo/d' "$tincconf" > "$tmp_tincconf" find_supernodes | cut -d\ -f 1 | shuf \ | head -n "${max_connect_to}" \ @@ -24,3 +29,5 @@ find_supernodes | cut -d\ -f 1 | shuf \ info "replacing old tinc.conf with one" test "${DEBUG:-}" && diff "$tincconf" "$tmp_tincconf" mv "$tmp_tincconf" "$tincconf" + +tinc_reload -- cgit v1.2.3