diff options
author | Jacob Appelbaum <jacob@appelbaum.net> | 2009-04-29 14:35:06 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-04-29 19:04:05 -0400 |
commit | 9043932789c516a263c16729f53773d8ef0121a4 (patch) | |
tree | 9b30376930caa0c12e5d1b3d909f63f90872c04c /contrib/torify.in | |
parent | 6ac3a8b0cd1946e90a4c997e8fad1bfc63890abd (diff) | |
download | tor-9043932789c516a263c16729f53773d8ef0121a4.tar.gz tor-9043932789c516a263c16729f53773d8ef0121a4.zip |
Make the torify script use torify when available.
Update Torify to use torsocks by default and to warn when the user is
using the older tsocks program. Update torify and the torify man page
to refelect changes to torify. Add warnings in both.
Diffstat (limited to 'contrib/torify.in')
-rwxr-xr-x | contrib/torify.in | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/contrib/torify.in b/contrib/torify.in index 05645fd07c..6b1e440dc1 100755 --- a/contrib/torify.in +++ b/contrib/torify.in @@ -10,36 +10,67 @@ # Define and ensure we have tsocks # XXX: what if we don't have which? +TORSOCKS="`which torsocks`" TSOCKS="`which tsocks`" +PROG="" if [ ! -x "$TSOCKS" ] then - echo "$0: Can't find tsocks in PATH. Perhaps you haven't installed it?" >&2 - exit 1 + echo "$0: Can't find tsocks in PATH. Perhaps you haven't installed it?" >&2 +else + PROG=$TSOCKS +fi +if [ ! -x "$TORSOCKS" ] +then + echo "$0: Can't find torsocks in PATH. Perhaps you haven't installed it?" >&2 +else + PROG=$TORSOCKS +fi + +if [ ! -x "$PROG" ] +then + echo "$0: Can't find the required tor helpers in our PATH. Perhaps you haven't installed them?" >&2 + exit 1; fi # Check for any argument list if [ "$#" = 0 ] then - echo "Usage: $0 <command> [<options>...]" >&2 - exit 1 + echo "Usage: $0 [-hv] <command> [<options>...]" >&2 + exit 1 fi if [ "$#" = 1 ] && ( [ "$1" = "-h" ] || [ "$1" = "--help" ] ) then - echo "Usage: $0 <command> [<options>...]" - exit 0 + echo "Usage: $0 [-hv] <command> [<options>...]" + exit 0 fi -# Define our tsocks config file -TSOCKS_CONF_FILE="@CONFDIR@/tor-tsocks.conf" -export TSOCKS_CONF_FILE +if [ "$1" = "-v" ] || [ "$1" = "--verbose" ] +then + echo "We're armed with the following tsocks: $TSOCKS" + echo "We're armed with the following torsocks: $TORSOCKS" + echo "We're attempting to use $PROG for all tor action." + shift 1 +fi -# Check that we've got a tsocks config file -if [ -r "$TSOCKS_CONF_FILE" ] +if [ "$PROG" == "$TSOCKS" ] then - exec tsocks "$@" - echo "$0: Failed to exec tsocks $@" >&2 - exit 1 -else - echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2 - exit 1 + # Define our tsocks config file + TSOCKS_CONF_FILE="/etc/tor/tor-tsocks.conf" + export TSOCKS_CONF_FILE + + # Check that we've got a tsocks config file + if [ -r "$TSOCKS_CONF_FILE" ] + then + echo "WARNING: tsocks is known to leak DNS and UDP data." >&2 + exec tsocks "$@" + echo "$0: Failed to exec tsocks $@" >&2 + exit 1 + else + echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2 + exit 1 + fi +fi +if [ "$PROG" == "$TORSOCKS" ] +then + exec torsocks "$@" fi |