pre_install() { echo "Cleaning any old chroots before installing a new one..." if [ -d '/opt/torchroot' ]; then rm -rf /opt/torchroot fi if [ -d '/srv/torchroot' ]; then rm -rf /srv/torchroot fi } post_install() { echo "Installing a new chroot ... " /bin/sh -c "/usr/libexec/tor-hardened-scripts/torchroot.sh" wait echo "Done!" echo "=====" echo "To use this service please disable tor," echo "then enable tor-hardened via HyperRC or runit." echo "----" echo "You may now use stream isolated ports for added security." echo "Please configure your applications as follows:" echo "Default Port: 9050" echo "Mail Client isolated port: 9061" echo "Browser isolated port: 9150" echo "Other applications you want isolated: 9062" echo "----" echo "To request new IP from TOR:" echo "killall -HUP tor" echo "---" echo "WARNING: UDP traffic may still leak! All traffic goes through single port." echo "=====" } post_upgrade() { echo "Stopping chrooted tor..." if [ -x /etc/init.d/tor-hardened ]; then /etc/init.d/tor-hardened stop fi echo "Cleaning old chroot and putting in a new one..." if [ -d '/opt/torchroot' ]; then rm -rf /opt/torchroot fi if [ -d '/srv/torchroot' ]; then rm -rf /srv/torchroot fi wait /bin/sh -c "/usr/libexec/tor-hardened-scripts/torchroot.sh" wait echo "Done!" echo "=====" echo "To use this service please disable tor," echo "then enable tor-hardened via HyperRC or runit." echo "----" echo "You may now use stream isolated ports for added security." echo "Please configure your applications as follows:" echo "Default Port: 9050" echo "Mail Client isolated port: 9061" echo "Browser isolated port: 9150" echo "Other applications you want isolated: 9062" echo "----" echo "To request new IP from TOR:" echo "killall -HUP tor" echo "---" echo "WARNING: UDP traffic may still leak! All traffic goes through single port." echo "=====" } pre_remove() { echo "Stopping chrooted tor..." if [ -x /etc/init.d/tor-hardened ]; then /etc/init.d/tor-hardened stop fi } post_remove() { echo "Deleting chroot..." if [ -d '/opt/torchroot' ]; then rm -rf /opt/torchroot fi if [ -d '/srv/torchroot' ]; then rm -rf /srv/torchroot fi wait echo "Done!" }