summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-05-20 16:49:23 +0200
committertv <tv@shackspace.de>2015-05-20 16:49:23 +0200
commit3cd71ef8189dc9226dfa01a91617d81ad4d429d6 (patch)
treeb4bda0b3b7a09daca5f16f52c1148c1dacce4b86
parenta628b68dab6408ede1f695e9aa55c5df7b110e3b (diff)
parentc5a4be51df09659d9bbf7da573b4568ce56b7514 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
-rw-r--r--retiolum/hosts/cloudkrebs12
-rw-r--r--retiolum/hosts/serenity11
-rwxr-xr-xretiolum/scripts/tinc_setup/propagate-config61
-rw-r--r--sites/reaktor-nag/setup-reaktor-nag.journal1
-rwxr-xr-xutil/bin/galileo3
-rwxr-xr-xutil/bin/google.currency2
-rwxr-xr-xutil/bin/google.text2speech1
-rwxr-xr-xutil/bin/google.translate1
-rwxr-xr-xutil/bin/paste26
-rwxr-xr-xutil/bin/pigbin5
-rwxr-xr-xutil/bin/untilport15
-rwxr-xr-xutil/bin/urgent2
12 files changed, 125 insertions, 15 deletions
diff --git a/retiolum/hosts/cloudkrebs b/retiolum/hosts/cloudkrebs
index a6783d0b..43d35d1f 100644
--- a/retiolum/hosts/cloudkrebs
+++ b/retiolum/hosts/cloudkrebs
@@ -3,10 +3,10 @@ Subnet = 10.243.206.102
Subnet = 42:941e:2816:35f4:5c5e:206b:3f0b:f762
-----BEGIN RSA PUBLIC KEY-----
-MIIBCgKCAQEAoXp4UXctvHQRiJps4CzURNBsZE8mC8emtXK6pjfq73Pg4R94ayx4
-+JtgEFY+VZeNIKHlaAqfNm8+RfHS7AFgMkiA4WBK2PI8Vpj64wUHz+EcySIInIdx
-9J00KRUYA9w8pC8qxjZlxsFlDb4i/kzk1Qt4izV++itzICRolHcuHCeWN3ceok1O
-gckSSi+zSyGiukRlIHqFkHRCJzt2LV06BV+8ARvLBsF/N9imfVxlfNpEcJCjwgFY
-E5kcr7HpywYA3myphmvrGTPV/xy0m1tfNsWNMWXdk75K2Pl8h3h8b2ViHgcWjmNY
-jDeTVvaoGgFRzfu+3cA1TiHwDcQKKZodBQIDAQAB
+MIIBCgKCAQEA33RbuP2zPuZx/fakOsekIJPln4AKsIVYT5nt+Xk1y8MiIX2y3NAj
+ovmWMJF1hxHyInA+FuInOWH6fgxF7Slluz8dNdtciaACZDOQv0NWMliukYKoYYGP
+qFc8TEQPknmQpWW25naaT9m/69iQ3mxUm/IncxxyFxgtWfrlLvUqF0h57iEDZUZi
+EXf0lE1iYXNZlGB9ZOS0+s9Y3uQIBNJWCGyup5b3S0aUKnIkCrZ9zMVAQoipXIWb
+ANBIQe0fp9hbhS//TslTGnVEoBW3cFEdrvAyZKdcuu4wF/hOvuFGMz41hORPjLZd
+Mk57k0Xt9IlcvVdXq+FYZ1Bt727HCAgJFwIDAQAB
-----END RSA PUBLIC KEY-----
diff --git a/retiolum/hosts/serenity b/retiolum/hosts/serenity
new file mode 100644
index 00000000..09c519a0
--- /dev/null
+++ b/retiolum/hosts/serenity
@@ -0,0 +1,11 @@
+Subnet = 10.243.137.182
+Subnet = 42:7538:6f17:220f:bcc0:2d2d:d6f6:911f
+
+-----BEGIN RSA PUBLIC KEY-----
+MIIBCgKCAQEAvVxASw+8nrkQisvliqjYXASQ8O0v4KGlQDHQWx4eBKOfPyQbgJpU
+LOF1nikZTz56SyJAwZY1r7JXpvzycWKXkLK/deqJrHkm83lRbwbzKrExzW8hNaVD
+nO+P4X19uG/gcfxc9+CdPbHxtUPCNQKUhtYfnXrzTu9jiz7WibkJRYMvY1bd4SK1
+rkKGwIfQiWGvA2cLyWZH2XnFptl0YVHulGnIIVp/bvTuPDsba4mTWeuJhi+16ZzP
+PwsR5taxB+dxygESp+kwu00Xmwv5MnmL6QWDlTHYZX19FXkeAV+sHxEO0K4YLFQn
+pucTzUBNiZX68HF3R5SdH7wsg9jsvE8c3wIDAQAB
+-----END RSA PUBLIC KEY-----
diff --git a/retiolum/scripts/tinc_setup/propagate-config b/retiolum/scripts/tinc_setup/propagate-config
new file mode 100755
index 00000000..27a9880a
--- /dev/null
+++ b/retiolum/scripts/tinc_setup/propagate-config
@@ -0,0 +1,61 @@
+#!/bin/sh -x
+set -euf
+
+main() {
+
+ if [ $# -ne 1 ]; then
+ usage
+ exit 1
+ fi
+
+ TINCDIR=$1
+
+ HOSTN=$(cat $TINCDIR/tinc.conf | awk '/Name ?=/ {gsub(/Name ?= ?/, ""); print}')
+ NICK="${HOSTN}_$(head /dev/urandom | tr -dc "0123456789" | head -c3)"
+
+ IRCCHANNEL=${IRCCHANNEL:-"#krebs_incoming"}
+ IRCSERVER=${IRCSERVER:-"irc.freenode.net"}
+ IRCPORT=${IRCPORT:-6667}
+
+ test -z ${HOSTSDIR+x} && find_hostdir
+
+ test -z ${TELNET+x} && find_telnet
+
+ ( echo "NICK $NICK";
+ echo "USER $NICK $IRCSERVER bla : $NICK";
+ echo "JOIN $IRCCHANNEL";
+ sleep 23;
+ echo "PRIVMSG $IRCCHANNEL : This is $HOSTN";
+ sed "s/^\(.*\)/PRIVMSG $IRCCHANNEL : \1/" $HOSTSDIR/$HOSTN;
+ sleep 5; ) | $TELNET $IRCSERVER $IRCPORT
+}
+
+exists() {
+ type "$1" >/dev/null 2>/dev/null;
+}
+
+find_hostdir() {
+ if [ -e "$TINCDIR/hosts" ]; then
+ HOSTSDIR="$TINCDIR/hosts"
+ else
+ echo 'cannot find hostsdir of tinc, please specify with HOSTSDIR=...'
+ exit 1
+ fi
+}
+
+find_telnet() {
+ if exists telnet >/dev/null; then
+ TELNET=$(command -v telnet)
+ else
+ echo "cannot find telnet binary, please install telnet-client"
+ echo "bailing out!"
+ exit 1
+ fi
+}
+
+usage() {
+ echo './propagate-config $TINCDIR'
+ echo 'If the hosts dir is not in $TINC_DIR you have to specify it using HOSTSDIR=$path_to_hostsdir ./propagate $TINCDIR.'
+}
+
+main "$@"
diff --git a/sites/reaktor-nag/setup-reaktor-nag.journal b/sites/reaktor-nag/setup-reaktor-nag.journal
index 6227aa37..452396e1 100644
--- a/sites/reaktor-nag/setup-reaktor-nag.journal
+++ b/sites/reaktor-nag/setup-reaktor-nag.journal
@@ -5,6 +5,7 @@
cd krebs/painload/Reaktor
$EDITOR config.py
# edit on_ping to point to some valid services_repo
+ # make sure to ssh as the user before to avoid 'unknown host' issue
# edit anything else relevant
# deploy Reaktor's pubkey to services_repo-host
sudo -u Reaktor -i $PWD/index
diff --git a/util/bin/galileo b/util/bin/galileo
deleted file mode 100755
index 854f1302..00000000
--- a/util/bin/galileo
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-export voice=klara
-./wiki.firstpar http://de.m.wikipedia.org/wiki/::Random | xargs ./naturalvoices.att
diff --git a/util/bin/google.currency b/util/bin/google.currency
index 8219a866..8a3f708f 100755
--- a/util/bin/google.currency
+++ b/util/bin/google.currency
@@ -6,7 +6,7 @@ sc=${SC:="eur"}
usage(){
echo 'TC= targetcurrency, valid strings are in the style of "usd", "eur" or "sgd". default "usd"'
- echo 'SC= sourcecurrency, same TC, default is eur'
+ echo 'SC= sourcecurrency, same as TC, default is eur'
echo 'Example: TC="sgd" ./currency.google 11'
exit 0
diff --git a/util/bin/google.text2speech b/util/bin/google.text2speech
index 061bb1c8..cd387cc0 100755
--- a/util/bin/google.text2speech
+++ b/util/bin/google.text2speech
@@ -5,6 +5,7 @@ TL=${TL:="en"}
usage(){
echo 'TL= can specifiy which language to use, default is "en"'
+ echo 'valid languages: https://cloud.google.com/translate/v2/using_rest#language-params'
echo 'Example: TL="de" ./text2speech.google "whats up?" | mpv -'
exit 0
}
diff --git a/util/bin/google.translate b/util/bin/google.translate
index 06c6a5a8..a8ccd8cc 100755
--- a/util/bin/google.translate
+++ b/util/bin/google.translate
@@ -7,6 +7,7 @@ tl=${TL:="en"}
usage(){
echo 'TL= targetlanguage, valid strings are in the style of "en", "pl" or "de". default "en"'
echo 'SL= sourcelanguage, same TL, default is auto'
+ echo 'valid languages: https://cloud.google.com/translate/v2/using_rest#language-params'
echo 'Example: TL="de" ./translate.google "whats up?"'
exit 0
diff --git a/util/bin/paste b/util/bin/paste
new file mode 100755
index 00000000..b7cc6c99
--- /dev/null
+++ b/util/bin/paste
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -euf
+
+usage() {
+ echo 'paste reads from stdin and pastes to the specified paste service'
+ echo 'currently ix.io and paste.retiolum are supported'
+ echo 'default is paste.retiolum'
+ echo 'ex:'
+ echo 'cat somefile | paste ix.io'
+}
+
+hoster=${1:-paste.retiolum}
+
+case $hoster in
+ paste.retiolum|paste)
+ curl -sS -F 'file=@-;type=text/plain' \
+ http://paste.retiolum:5000/+upload \
+ | sed -n 's|.*href="\([^#]*\).*|http://paste.retiolum\1\n|p'
+ ;;
+ ix.io)
+ curl -sS -F 'f:1=<-' ix.io
+ ;;
+ *)
+ usage
+ ;;
+esac
diff --git a/util/bin/pigbin b/util/bin/pigbin
deleted file mode 100755
index ae0b270f..00000000
--- a/util/bin/pigbin
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-#usage:
-#echo aidsballs | pigbin
-
-curl -F 'p=<-' paste
diff --git a/util/bin/untilport b/util/bin/untilport
new file mode 100755
index 00000000..b815cb19
--- /dev/null
+++ b/util/bin/untilport
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -euf
+
+usage() {
+ echo 'untiport $target $port'
+ echo 'Sleeps until the destinated port is reachable.'
+ echo 'ex: untilport google.de 80 && echo 'google is now reachable''
+}
+
+if [ $# -ne 2 ]; then
+ usage
+else
+ until nc -z "$@"; do sleep 1; done
+fi
+
diff --git a/util/bin/urgent b/util/bin/urgent
new file mode 100755
index 00000000..33593551
--- /dev/null
+++ b/util/bin/urgent
@@ -0,0 +1,2 @@
+#!/bin/sh
+printf '\a'