2006-04-17 00:48:41 +02:00
|
|
|
#! /bin/sh
|
2006-04-17 04:46:14 +02:00
|
|
|
|
2004-02-17 01:46:59 +01:00
|
|
|
# Wrapper script for use of the tsocks(8) transparent socksification library
|
|
|
|
# See the tsocks(1) and torify(1) manpages.
|
2006-04-17 04:46:14 +02:00
|
|
|
|
|
|
|
# Copyright (c) 2004, 2006 Peter Palfrader
|
2006-04-17 00:44:08 +02:00
|
|
|
# Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006
|
2006-04-17 04:46:14 +02:00
|
|
|
# May be distributed under the same terms as Tor itself
|
|
|
|
|
2004-02-17 01:46:59 +01:00
|
|
|
|
2006-04-17 00:44:08 +02:00
|
|
|
# Define and ensure we have tsocks
|
2006-04-17 04:46:14 +02:00
|
|
|
# XXX: what if we don't have which?
|
|
|
|
TSOCKS="`which tsocks`"
|
|
|
|
if [ ! -x "$TSOCKS" ]
|
2006-04-17 00:44:08 +02:00
|
|
|
then
|
2006-04-17 04:46:14 +02:00
|
|
|
echo "$0: Can't find tsocks in PATH. Perhaps you haven't installed it?" >&2
|
|
|
|
exit 1
|
2006-04-17 00:44:08 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for any argument list
|
2006-04-17 04:46:14 +02:00
|
|
|
if [ "$#" = 0 ]
|
2006-04-17 00:44:08 +02:00
|
|
|
then
|
2006-04-17 04:46:14 +02:00
|
|
|
echo "Usage: $0 <command> [<options>...]" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ "$#" = 1 ] && ( [ "$1" = "-h" ] || [ "$1" = "--help" ] )
|
|
|
|
then
|
|
|
|
echo "Usage: $0 <command> [<options>...]"
|
|
|
|
exit 0
|
2006-04-17 00:44:08 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Define our tsocks config file
|
2006-04-17 04:46:14 +02:00
|
|
|
TSOCKS_CONF_FILE="@CONFDIR@/tor-tsocks.conf"
|
2004-02-17 01:46:59 +01:00
|
|
|
export TSOCKS_CONF_FILE
|
2006-04-17 00:44:08 +02:00
|
|
|
|
|
|
|
# Check that we've got a tsocks config file
|
2006-04-17 04:46:14 +02:00
|
|
|
if [ -r "$TSOCKS_CONF_FILE" ]
|
2006-04-17 00:44:08 +02:00
|
|
|
then
|
|
|
|
exec tsocks "$@"
|
2006-04-17 04:46:14 +02:00
|
|
|
echo "$0: Failed to exec tsocks $@" >&2
|
|
|
|
exit 1
|
2006-04-17 00:44:08 +02:00
|
|
|
else
|
2006-04-17 04:46:14 +02:00
|
|
|
echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2
|
|
|
|
exit 1
|
2006-04-17 00:44:08 +02:00
|
|
|
fi
|