3 # Wrapper script for use of the tsocks(8) transparent socksification library
4 # See the tsocks(1) and torify(1) manpages.
6 # Copyright (c) 2004, 2006 Peter Palfrader
7 # Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006
8 # May be distributed under the same terms as Tor itself
11 # Define and ensure we have tsocks
12 # XXX: what if we don't have which?
13 TORSOCKS
="`which torsocks`"
14 TSOCKS
="`which tsocks`"
18 echo "$0: Can't find tsocks in PATH. Perhaps you haven't installed it?" >&2
22 if [ ! -x "$TORSOCKS" ]
24 echo "$0: Can't find torsocks in PATH. Perhaps you haven't installed it?" >&2
31 echo "$0: Can't find the required tor helpers in our PATH. Perhaps you haven't installed them?" >&2
35 # Check for any argument list
38 echo "Usage: $0 [-hv] <command> [<options>...]" >&2
41 if [ "$#" = 1 ] && ( [ "$1" = "-h" ] ||
[ "$1" = "--help" ] )
43 echo "Usage: $0 [-hv] <command> [<options>...]"
47 if [ "$1" = "-v" ] ||
[ "$1" = "--verbose" ]
49 echo "We're armed with the following tsocks: $TSOCKS"
50 echo "We're armed with the following torsocks: $TORSOCKS"
51 echo "We're attempting to use $PROG for all tor action."
55 if [ "$PROG" = "$TSOCKS" ]
57 # Define our tsocks config file
58 TSOCKS_CONF_FILE
="/etc/tor/tor-tsocks.conf"
59 export TSOCKS_CONF_FILE
61 # Check that we've got a tsocks config file
62 if [ -r "$TSOCKS_CONF_FILE" ]
64 echo "WARNING: tsocks is known to leak DNS and UDP data." >&2
66 echo "$0: Failed to exec tsocks $@" >&2
69 echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2
73 if [ "$PROG" = "$TORSOCKS" ]