From 95fbba75246cf1b5115bc5493d3119f9ea91221e Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 27 Apr 2014 18:18:08 +0200 Subject: update things --- Reaktor/config.py | 2 +- Reaktor/repos/whatweb | 2 +- elchos/packages.both | 2 ++ elchos/refresh.sh | 4 ++-- elchos/root-image/krebs/etc/Reaktor/config.py | 4 ++-- elchos/root-image/root/customize_root_image.sh | 4 ++-- ship/lib/filehooker | 6 +++--- ship/lib/network | 11 +++++++++++ ship/lib/retiolum | 16 +++++++++++++--- sites/elchstats.nsupdate.info/graphite.journal.txt | 8 +++++++- 10 files changed, 44 insertions(+), 15 deletions(-) diff --git a/Reaktor/config.py b/Reaktor/config.py index 424019a7..ea00693f 100644 --- a/Reaktor/config.py +++ b/Reaktor/config.py @@ -1,7 +1,7 @@ from os.path import abspath, expanduser import re -debug = True +debug = False name = 'crabmanner' diff --git a/Reaktor/repos/whatweb b/Reaktor/repos/whatweb index f35d0265..0918a0d9 160000 --- a/Reaktor/repos/whatweb +++ b/Reaktor/repos/whatweb @@ -1 +1 @@ -Subproject commit f35d0265c04605dbddec5ea9af418ebd796eef60 +Subproject commit 0918a0d9b75df77f9c3e9eb360b6b22824582a20 diff --git a/elchos/packages.both b/elchos/packages.both index 409abe91..5eaef4e5 100644 --- a/elchos/packages.both +++ b/elchos/packages.both @@ -45,3 +45,5 @@ vim tor tmux pacman-mirrorlist +avahi +nss-mdns diff --git a/elchos/refresh.sh b/elchos/refresh.sh index 2ff1d59c..e707fab7 100755 --- a/elchos/refresh.sh +++ b/elchos/refresh.sh @@ -3,6 +3,6 @@ set -eu cd "$(dirname "$(readlink -f "$0")")" rm -rvf out/ work ./build.sh -N elchos -v -# cp -v out/filehooker* /home/makefu/isos +cp -v out/elchos* /home/makefu/isos # TODO internal -# virsh reset vm1 ||: +virsh reset vm1 ||: diff --git a/elchos/root-image/krebs/etc/Reaktor/config.py b/elchos/root-image/krebs/etc/Reaktor/config.py index a857a0c2..58bc7180 100644 --- a/elchos/root-image/krebs/etc/Reaktor/config.py +++ b/elchos/root-image/krebs/etc/Reaktor/config.py @@ -8,8 +8,8 @@ irc_alarm_timeout = 300 irc_hammer_interval = 10 irc_kill_timeout = 360 irc_nickname = name -#irc_server = 'elchirc.nsupdate.info' -irc_server = 'irc.freenode.net' +irc_server = 'elchirc.nsupdate.info' +#irc_server = 'irc.freenode.net' irc_restart_timeout = 5 irc_port = 6667 irc_channels = [ diff --git a/elchos/root-image/root/customize_root_image.sh b/elchos/root-image/root/customize_root_image.sh index 6c5640c3..1c6abea0 100755 --- a/elchos/root-image/root/customize_root_image.sh +++ b/elchos/root-image/root/customize_root_image.sh @@ -57,8 +57,8 @@ cp /krebs/painload/Reaktor/etc/systemd/system/Reaktor@.service \ /etc/systemd/system # add bonus features for elch cp -a /krebs/etc/Reaktor /krebs/painload -# emergency root passwd +# emergency root passwd printf "!!!!!!\nthe Root PW is '%s'\n!!!!!!\n" "$rootpw" (printf "%s\n%s\n" "$rootpw" "$rootpw" ) | passwd cd /krebs/painload/Reaktor/ @@ -68,7 +68,7 @@ for i in multi-user.target \ pacman-init.service \ choose-mirror.service \ tor-configure-hidden.service \ - Reaktor@${reaktor_user}.service \ + Reaktor.service \ elch-hostname.service \ start-ncdc@${ncdc_user}.service \ sshd.service \ diff --git a/ship/lib/filehooker b/ship/lib/filehooker index 3c881f91..72be751a 100644 --- a/ship/lib/filehooker +++ b/ship/lib/filehooker @@ -13,7 +13,6 @@ ncdc_configure_netshare(){ rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` rnd_name="${2:-share_$rnd}" info "adding share" - (echo "/share $rnd_name $1") | ncdc_config } @@ -32,11 +31,12 @@ ncdc_configure_hub(){ echo "/hset autoconnect true") | ncdc_config } - -ncdc_install(){ +ncdc_download(){ install_dir="$(dirname "${ncdc_bin}")" info "installing ncdc to $install_dir" curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C "$install_dir" +} +ncdc_install(){ useradd -m $ncdc_user ||: } diff --git a/ship/lib/network b/ship/lib/network index bc4d1047..6c8970a0 100644 --- a/ship/lib/network +++ b/ship/lib/network @@ -76,6 +76,17 @@ run_telnet(){ port="$2" $(which_telnet) "$host" "$port" } +port_open(){ + # $1 - host + # $2 - port + # nc -zw 2 $1 $2 + echo | run_telnet "$1" "$2" & pid=$! + { sleep 5; kill $pid;} & wid=$! + wait $pid + RET=$? + kill $wid >/dev/null 2>&1 + return $RET +} send_irc(){ ## reads from stdin, writes to IRC diff --git a/ship/lib/retiolum b/ship/lib/retiolum index 1e55041c..eba2775e 100644 --- a/ship/lib/retiolum +++ b/ship/lib/retiolum @@ -23,7 +23,17 @@ refresh_supernode_keys(){ fi done && return 1 } - +port_open(){ + # $1 - host + # $2 - port + # nc -zw 2 $1 $2 + echo | run_telnet "$1" "$2" & pid=$! + { sleep 5; kill $pid;} & wid=$! + wait $pid + RET=$? + kill $wid >/dev/null 2>&1 + return $RET +} find_supernodes(){ cd $hosts_dir set +f @@ -37,7 +47,7 @@ find_supernodes(){ ' $name`"; then port=${Port-655} for host in $Address; do - if nc -zw 2 $host $port 2>/dev/null; then + if port_open $host $port 2>/dev/null; then echo "$name [('$host', $port)]" fi & done @@ -63,7 +73,7 @@ find_active_nodes(){ ' $name`"; then port=${Port-655} for host in $Address; do - if nc -zw 2 $host $port 2>/dev/null; then + if port_open $host $port 2>/dev/null; then echo "$name [('$host', $port)]" fi & done diff --git a/sites/elchstats.nsupdate.info/graphite.journal.txt b/sites/elchstats.nsupdate.info/graphite.journal.txt index 83e36c93..d3a73433 100644 --- a/sites/elchstats.nsupdate.info/graphite.journal.txt +++ b/sites/elchstats.nsupdate.info/graphite.journal.txt @@ -1,21 +1,27 @@ #?/bin/sh +set -euf # from http://graphite.wikidot.com/installation git clone https://github.com/graphite-project/graphite-web.git git clone https://github.com/graphite-project/carbon.git git clone https://github.com/graphite-project/whisper.git -pacman -S python2 gcc pkg-config cairo +pacman -S python2 gcc pkg-config cairo python2-pip for i in whisper carbon graphite-web;do cd $i pip2 install -r requirements.txt||: python2 setup.py install + cd - done cd /opt/graphite/conf cp carbon.conf.example carbon.conf +# edit carbon.conf, fix max writes per second, max adds per minute cp storage-schemas.conf.example storage-schemas.conf +# edit storage-schemas.conf, fix storage time + cd /opt/graphite/webapp/graphite cp local_settings.py.example local_settings.py +# change SECRET_KEY PYTHONPATH=/opt/graphite/webapp django-admin.py syncdb --settings=graphite.settings # push in the texts -- cgit v1.2.3