summaryrefslogtreecommitdiffstats
path: root/ship/lib/tor
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-12 15:33:49 +0100
committertv <tv@nomic.retiolum>2013-11-12 15:33:49 +0100
commit021dd964ba41665562430e87f75ed53380459a68 (patch)
tree55f88e2391539b40afc2c952a66dcb2c43f2db30 /ship/lib/tor
parenta6012ff33c05593f4c73b7de55ce09915b6327f9 (diff)
parent8b60dff25e85921fe533f621a1b5d0f8149bf38f (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'ship/lib/tor')
-rw-r--r--ship/lib/tor19
1 files changed, 19 insertions, 0 deletions
diff --git a/ship/lib/tor b/ship/lib/tor
new file mode 100644
index 00000000..8d9e33f1
--- /dev/null
+++ b/ship/lib/tor
@@ -0,0 +1,19 @@
+# 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/}
+
+configure_hidden_service(){
+ 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
+}