]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/init.d/tor
2 ########################################################################
3 # Begin $rc_base/init.d/tor
5 # Description : Anonymizing overlay network for TCP
7 ########################################################################
12 FILEDESCRIPTORS
="65535"
14 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/tor
/settings
)
16 function tor_is_enabled
() {
17 [ "${TOR_ENABLED}" = "on" ] ||
[ "${TOR_RELAY_ENABLED}" = "on" ]
20 function setup_firewall
() {
24 if [ "${TOR_RELAY_ENABLED}" = "on" -a -n "${TOR_RELAY_PORT}" ]; then
25 iptables
-A TOR_INPUT
-p tcp
--dport "${TOR_RELAY_PORT}" -j ACCEPT
28 if [ "${TOR_RELAY_ENABLED}" = "on" -a -n "${TOR_RELAY_DIRPORT}" ] && [ "${TOR_RELAY_DIRPORT}" -ne 0 ]; then
29 iptables
-A TOR_INPUT
-p tcp
--dport "${TOR_RELAY_DIRPORT}" -j ACCEPT
33 function flush_firewall
() {
40 tor_is_enabled ||
exit 0
45 # Increasing open file descriptors.
46 if [ -n "${FILEDESCRIPTORS}" ]; then
47 ulimit -n "${FILEDESCRIPTORS}"
50 boot_mesg
"Starting tor..."
51 loadproc
/usr
/bin
/tor \
53 --defaults-torrc /usr
/share
/tor
/defaults-torrc \
62 boot_mesg
"Stopping tor..."
70 boot_mesg
"Reloading tor..."
71 reloadproc
/usr
/bin
/tor
81 # Reload the process if it is already running. Otherwise, restart.
82 if pidofproc
-s /usr
/bin
/tor
; then
90 statusproc
/usr
/bin
/tor
94 echo "Usage: ${0} {start|stop|reload|restart|reload-or-restart|status}"
99 # End $rc_base/init.d/tor