summaryrefslogtreecommitdiff
path: root/nonprism/tor-hardened-preferences/tor-hardened.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nonprism/tor-hardened-preferences/tor-hardened.sh')
-rw-r--r--nonprism/tor-hardened-preferences/tor-hardened.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/nonprism/tor-hardened-preferences/tor-hardened.sh b/nonprism/tor-hardened-preferences/tor-hardened.sh
new file mode 100644
index 000000000..c9fe36795
--- /dev/null
+++ b/nonprism/tor-hardened-preferences/tor-hardened.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+##############################################
+# Tor-Hardened Cleaner & Startup Script #
+##############################################
+# Clean left over files
+echo "Cleaning any files left over from a previous run..."
+rm /opt/torchroot/var/lib/tor/*
+# Detect old version and upgrade
+Torchroothash=$(sha256sum /opt/torchroot/usr/bin/tor | awk '{print $1}')
+Toroutsidehash=$(sha256sum /usr/bin/tor | awk '{print $1}')
+if [ "$Torchroothash" != "$Toroutsidehash" ]
+then
+ echo "New version of Tor detected! Updating chroot before running."
+ rm -rf /opt/torchroot
+ wait
+ /usr/bin/sh -c "/opt/tor-hardened-scripts/torchroot.sh"
+ wait
+fi
+
+# Start Tor inside of our chroot
+echo "Running Tor..."
+chroot --userspec=tor:tor /opt/torchroot /usr/bin/tor -f /etc/tor/torrc \ No newline at end of file