Project

General

Profile

Feature Request #3413 » tor-hardened.sh

modified script from tor-hardened-preferences to be used with OpenRC - nona, 2023-01-04 12:58 AM

 
1
#!/bin/sh
2

    
3
# /opt/tor-hardened-scripts/tor-hardened.sh
4
# Modified script for Parabola GNU/Linux's
5
# tor-hardened-preferences to work with OpenRC
6

    
7
##############################################
8
# Tor-Hardened Cleaner & Startup Script #
9
##############################################
10
# Clean left over files
11
echo "Cleaning any files left over from a previous run..."
12
rm -fr /opt/torchroot/var/lib/tor/*
13
# Detect old version and upgrade
14
Torchroothash=$(sha256sum /opt/torchroot/usr/bin/tor | awk '{print $1}')
15
Toroutsidehash=$(sha256sum /usr/bin/tor | awk '{print $1}')
16
if [ "$Torchroothash" != "$Toroutsidehash" ]
17
then
18
	echo "New version of Tor detected! Updating chroot before run ning."
19
	rm -rf /opt/torchroot
20
	wait
21
	/usr/bin/sh -c "/opt/tor-hardened-scripts/torchroot.sh"
22
	wait
23
fi
24

    
25
# Start Tor inside of our chroot
26
echo "Running Tor..."
27
chroot --userspec=tor:tor /opt/torchroot /usr/bin/tor -f /etc/tor/torrc --runasdaemon 1 --pidfile /run/tor/tor.pid --hush
(2-2/2)