freebsd-ports/security/trans-proxy-tor/files/trans-proxy-tor.in
Martin Wilke 3a02664880 Add trans-proxy-tor, transparent proxy used to redirect TCP
connections into Tor.

trans-proxy-tor is a transparent proxy
that uses PF to redirect TCP connections
through Tor (http://tor.eff.org/).

Programs that aren't aware of Tor
will use it without their knowledge,
and their traffic no longer leaves the
system unencrypted.

PR:		ports/99034
Submitted by:	Fabian Keil <fk at fabiankeil.de>
2006-07-22 09:56:26 +00:00

49 lines
1.9 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: trans-proxy-tor
# REQUIRE: tor dns-proxy-tor
# BEFORE: LOGIN
#
# Add the following lines to /etc/rc.conf to enable dns-proxy-tor
#
# trans_proxy_tor_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable trans-proxy-tor
# trans_proxy_tor_user (str): trans-proxy-tor Daemon user. Default _trans-proxy-tor
# trans_proxy_tor_group (str): trans-proxy-tor Daemon group. Default _trans-proxy-tor
# trans_proxy_tor_bind_port (str): Set to 1112 by default.
# trans_proxy_tor_logfile (str): Default is "/var/log/trans-proxy-tor.log". Created if necessary.
# trans_proxy_tor_loglevel (str): Default is "info". For other values read perldoc trans-proxy-tor.
#
# trans_proxy_tor_socks_addr_and_port (str): Tor's IP and socks port. Default is "127.0.0.1:9050".
. %%RC_SUBR%%
name="trans_proxy_tor"
rcvar=${name}_enable
load_rc_config ${name}
command_interpreter="/usr/bin/perl"
: ${trans_proxy_tor_enable="NO"}
: ${trans_proxy_tor_user="_trans-proxy-tor"}
: ${trans_proxy_tor_group="_trans-proxy-tor"}
: ${trans_proxy_tor_bind_addr="127.0.0.1"}
: ${trans_proxy_tor_bind_port="1112"}
: ${trans_proxy_tor_logfile="/var/log/trans-proxy-tor.log"}
: ${trans_proxy_tor_loglevel="debug"}
: ${trans_proxy_tor_socks_resolve="NO"}
: ${trans_proxy_tor_socks_addr_and_port="127.0.0.1:9050"}
: ${pidfile="%%PREFIX%%/var/run/trans-proxy-tor/trans-proxy-tor.pid"}
start_precmd="if [ ! -e ${trans_proxy_tor_logfile} ]; then\
echo Creating ${trans_proxy_tor_logfile};\
touch ${trans_proxy_tor_logfile};\
chown ${trans_proxy_tor_user}:${trans_proxy_tor_group} ${trans_proxy_tor_logfile};\
fi"
command="%%PREFIX%%/bin/trans-proxy-tor"
command_args="-b ${trans_proxy_tor_bind_addr}:${trans_proxy_tor_bind_port} -p ${pidfile}\
-v ${trans_proxy_tor_loglevel} -l ${trans_proxy_tor_logfile} -s ${trans_proxy_tor_socks_addr_and_port}"
run_rc_command "$1"