summaryrefslogtreecommitdiffstats
path: root/retiolum/bin
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2012-12-07 22:34:39 +0100
committermakefu <github@syntax-fehler.de>2012-12-07 22:34:39 +0100
commitad09d521243d9275d2af99b5aa5b67b9f79d3a77 (patch)
treee0d2b03045b62fbda60f9fb59d8e7be12d4a2e43 /retiolum/bin
parentbedf7d79f297e3584757e8ebf3995aafd46daf7a (diff)
write_channel.py rewritten to announce_pubkey
announce_pubkey is a shell-only implementation of the now obsolete write_channel script to announce a hosts public key the only dependency of this script is telnet, haven't seen a system without it for a while now
Diffstat (limited to 'retiolum/bin')
-rw-r--r--retiolum/bin/announce_pubkey35
1 files changed, 35 insertions, 0 deletions
diff --git a/retiolum/bin/announce_pubkey b/retiolum/bin/announce_pubkey
new file mode 100644
index 00000000..ce5aed19
--- /dev/null
+++ b/retiolum/bin/announce_pubkey
@@ -0,0 +1,35 @@
+#!/bin/sh
+set -euf
+HOST="${1:-}"
+
+usage (){
+cat <<EOF
+usage: $0 HOSTNAME
+
+also, you are made of stupid
+EOF
+exit 23
+}
+
+[ "x$HOST" = "x" ] && usage
+
+CHANNEL="#krebsco"
+IRCHOST="irc.freenode.net"
+PORT=6667
+RETIOLUM="/etc/tinc/retiolum"
+PUBFILE="$RETIOLUM/hosts/$HOST"
+
+if [ ! -e $PUBFILE ] ;then
+ echo "cannot find $PUBFILE - host $HOST wrong?" ;
+ echo
+ usage
+fi
+
+NICK="${HOST}_$((RANDOM%666))"
+
+( echo "NICK $NICK";
+ echo "USER $NICK $IRCHOST bla : $NICK";
+ echo "JOIN $CHANNEL";
+ sleep 23;
+ sed "s/^\(.*\)/PRIVMSG $CHANNEL : \1/" $PUBFILE;
+ sleep 5; ) | telnet $IRCHOST $PORT