#!/usr/bin/openrc-run # # /etc/init.d/tor # OpenRC script to run Tor with hardened preferences (for # Parabola GNU/Linux) # # Copyright 2022 nona # Distributed under the terms of the GNU General Public # License version 3 (GPLv3) command=/opt/tor-hardened-scripts/tor-hardened.sh tor_pidfile=/opt/torchroot/run/tor/tor.pid retry=${GRACEFUL_TIMEOUT:-60} stopsig=INT command_progress=yes extra_commands="checkconfig" extra_started_commands="reload" description="Anonymizing overlay network for TCP" description_checkconfig="Check for valid config file" description_reload="Reload the configuration" # checkconfig() { # ${command} --verify-config --hush > /dev/null 2>&1 # if [ $? -ne 0 ] ; then # eerror "Tor configuration (/etc/tor/torrc) is not valid." # eerror "Example is in /etc/tor/torrc.sample" # return 1 # fi # } start_pre() { # tor (from tor-openrc) ---------------------- # checkconfig || return 1 checkpath -d -m 0755 -o tor:tor /run/tor checkpath -d -m 0755 -o tor:tor /opt/torchroot/run checkpath -d -m 0755 -o tor:tor /opt/torchroot/run/tor # --------------------- (from tor-openrc) } stop() { start-stop-daemon -s KILL --pidfile "${tor_pidfile}" eend $? } reload() { checkconfig || return 1 ebegin "Reloading Tor configuration" start-stop-daemon -s HUP --pidfile "${tor_pidfile}" eend $? }