summaryrefslogtreecommitdiffstats
path: root/ship/src/tor_publish_ssh
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-11-07 17:14:13 +0100
committermakefu <github@syntax-fehler.de>2013-11-07 17:14:17 +0100
commit9210cdcdd8f9b7cf1bc48dcc01914b1d2530820d (patch)
tree581c292d0d5b3df74cb5368fa0a6ced91bd6acf4 /ship/src/tor_publish_ssh
parenta8abfcd05b5518ddacf5ccdf86bfff6528784eea (diff)
ship: tor -> tor_publish_ssh
Diffstat (limited to 'ship/src/tor_publish_ssh')
-rwxr-xr-xship/src/tor_publish_ssh25
1 files changed, 25 insertions, 0 deletions
diff --git a/ship/src/tor_publish_ssh b/ship/src/tor_publish_ssh
new file mode 100755
index 00000000..df904444
--- /dev/null
+++ b/ship/src/tor_publish_ssh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#@include core
+#@include network
+#@include punani
+# can be set via env:
+# torrc - path to torrc (default: /etc/tor/torrc )
+# hidden_service_dir - path to hidden service (default: /var/lib/tor/hidden_service/ )
+
+torrc=${torrc:-/etc/tor/torrc}
+hidden_service_dir=${hidden_service_dir:-/var/lib/tor/hidden_service/}
+
+punani install tor
+
+test -w "$torrc" || ( error "$torrc is not writable!"; exit 1 ) || exit 1
+if ! grep -q '^HiddenService' "$torrc" ;then
+ info "adding hidden service to $torrc"
+ cat >> "$torrc" << EOF
+HiddenServiceDir ${hidden_service_dir}
+HiddenServicePort 22 127.0.0.1:22
+EOF
+else
+ info "HiddenServiceDir or Port already in $torrc, skipping!"
+fi
+
+cat $hidden_service_dir/hostname | send_irc