summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/github_listener
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-01-14 14:46:22 +0100
committermakefu <github@syntax-fehler.de>2013-01-14 14:46:22 +0100
commitdbe2d838ba6834788265029162b2dd7d82473335 (patch)
treea4eb38f7fc91d91269b6f83453de62242c6ddc23 /retiolum/scripts/github_listener
parent5a782f6c8f7923f9f415afd504ce6e71acbc7fef (diff)
parentabf9916bc1add17888308877fa4eb9da330297ef (diff)
Merge branch 'master' of github.com:krebscode/painload
Conflicts: god/temper/Makefile god/temper/collectd-temper.sh
Diffstat (limited to 'retiolum/scripts/github_listener')
-rw-r--r--retiolum/scripts/github_listener/INSTALL13
-rw-r--r--retiolum/scripts/github_listener/README22
-rw-r--r--retiolum/scripts/github_listener/github_listener.conf5
-rwxr-xr-xretiolum/scripts/github_listener/handle_request23
4 files changed, 63 insertions, 0 deletions
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
new file mode 100644
index 00000000..57c30896
--- /dev/null
+++ b/retiolum/scripts/github_listener/README
@@ -0,0 +1,22 @@
+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
+
+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
new file mode 100644
index 00000000..c4f0a8b6
--- /dev/null
+++ b/retiolum/scripts/github_listener/github_listener.conf
@@ -0,0 +1,5 @@
+[program:github_listener]
+command=nc -lvv -p 5432 -c "./handle_request /opt/github_listener/retiolum/hosts /var/www/euer.krebsco.de/retiolum/"
+user=tinc
+directory=/krebs/retiolum/scripts/github_listener/
+autorestart=true
diff --git a/retiolum/scripts/github_listener/handle_request b/retiolum/scripts/github_listener/handle_request
new file mode 100755
index 00000000..5b42524a
--- /dev/null
+++ b/retiolum/scripts/github_listener/handle_request
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Possible Shell Vars
+# WEBDIR
+# HOSTFOLDER
+set -euf
+if [ "x${2:-}" = x ];then
+ echo "usage: $0 HOSTDIRECTORY WEBDIRECTORY"
+ exit 1
+fi
+export HOSTDIR=${1:-../../hosts}
+WEBDIR=${2:-/var/www/euer.krebsco.de/retiolum/}
+echo "sorry for keeping you waiting, please be patient"
+
+cd $(dirname $(readlink -f $0))
+
+cd "$HOSTDIR"
+git pull origin master >&2
+echo "First step done"
+cd - >&2
+../../bin/create-supernode-tar $WEBDIR
+echo "almost done..."
+../../bin/create-host-tar $WEBDIR
+echo "Thank you for your patience!"