1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

new port: net/tsocks

Allow non SOCKS aware applications to use SOCKS without modification.

PR:		ports/56534
Submitted by:	YazzY <yazzy@yazzy.org>
This commit is contained in:
Edwin Groothuis 2003-10-08 01:20:50 +00:00
parent 5040b61a32
commit d4f1520cee
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=90580
11 changed files with 542 additions and 0 deletions

View File

@ -673,6 +673,7 @@
SUBDIR += trickle SUBDIR += trickle
SUBDIR += tridiavnc SUBDIR += tridiavnc
SUBDIR += tsclient SUBDIR += tsclient
SUBDIR += tsocks
SUBDIR += ttcp SUBDIR += ttcp
SUBDIR += ttlscan SUBDIR += ttlscan
SUBDIR += ttt SUBDIR += ttt

107
net/tsocks/Makefile Normal file
View File

@ -0,0 +1,107 @@
# New ports collection makefile for: tsocks
# Date created: 5th September 2003
# Whom: Marcin Jessa <freebsd@yazzy.org>
#
# $FreeBSD$
PORTNAME= tsocks
PORTVERSION= 1.8.b5
PORTREVISION= 1
CATEGORIES= net security
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
http://ftp1.sourceforge.net/tsocks/ \
http://www.yazzy.org/ports/tsocks/
MASTER_SITE_SUBDIR= tsocks
DISTNAME=${PORTNAME}-${PORTVERSION:C/.b/beta/}
MAINTAINER= yazzy@yazzy.org
COMMENT= Allow non SOCKS aware applications to use SOCKS without modification
GNU_CONFIGURE= yes
USE_GMAKE= yes
INSTALLS_SHLIB= yes
LDCONFIG_DIRS= ${PREFIX}/lib/tsocks
USE_REINPLACE= yes
WRKSRC=${WRKDIR}/${PORTNAME}-${PORTVERSION:C/.b.*//}
CONFIGURE_ARGS= --with-conf=${PREFIX}/etc/tsocks.conf \
--libdir=${LOCALBASE}/lib/tsocks
MAN1= tsocks.1
MAN5= tsocks.conf.5
MAN8= tsocks.8
.if defined(WITH_SOCKSDNS)
CONFIGURE_ARGS+= --enable-socksdns
.endif
.if defined(WITH_OLDMETHOD)
CONFIGURE_ARGS+= --enable-oldmethod
.endif
.if defined(WITH_NODEBUG)
CONFIGURE_ARGS+= --disable-debug
.endif
.if defined(WITH_NOHOSTNAMES)
CONFIGURE_ARGS+= --disable-hostnames
.endif
.include <bsd.port.pre.mk>
pre-everything::
.if !defined(WITH_SOCKSDNS)
@${ECHO_MSG}
@${ECHO_MSG} "You can use the WITH_SOCKSDNS=yes knob."
@${ECHO_MSG} "This option causes tsocks to intercept"
@${ECHO_MSG} "DNS lookups and attempt to force them"
@${ECHO_MSG} "to use TCP instead of UDP and thus"
@${ECHO_MSG} "be proxied through the socks server."
@${ECHO_MSG}
.endif
.if !defined(WITH_OLDMETHOD)
@${ECHO_MSG}
@${ECHO_MSG} "You can use the make WITH_OLDMETHOD=yes knob."
@${ECHO_MSG} "This forces tsocks not to use the"
@${ECHO_MSG} "RTLD_NEXT parameter to dlsym to get the"
@${ECHO_MSG} "address of the connect() method tsocks"
@${ECHO_MSG} "overrides, instead it loads a reference"
@${ECHO_MSG} "to the libc shared library and then uses dlsym()."
@${ECHO_MSG}
.endif
.if !defined(WITH_NODEBUG)
@${ECHO_MSG}
@${ECHO_MSG} "You can use the make WITH_NODEBUG=yes knob."
@${ECHO_MSG} "This configuration option tells tsocks"
@${ECHO_MSG} "to never output error messages to stderr."
@${ECHO_MSG}
.endif
.if !defined(WITH_NOHOSTNAMES)
@${ECHO_MSG}
@${ECHO_MSG} "You can use the make WITH_NOHOSTNAMES=yes knob."
@${ECHO_MSG} "This disables DNS lookups on names"
@${ECHO_MSG} "provided as socks servers in the config"
@${ECHO_MSG} "file. This option is necessary"
@${ECHO_MSG} "if socks dns is enabled since tsocks"
@${ECHO_MSG} "can't send a socks dns request to resolve"
@${ECHO_MSG} "the location of the socks server."
@${ECHO_MSG}
.endif
post-patch:
@${REINPLACE_CMD} -e 's|ufds|fds|g' ${WRKSRC}/tsocks.c
.if !defined(NOPORTDOCS)
post-install:
@${MKDIR} ${PREFIX}/share/examples/tsocks
${INSTALL_DATA} ${WRKSRC}/*.example ${PREFIX}/share/examples/tsocks
${INSTALL_DATA} ${WRKSRC}/tsocks.conf.simple.example ${PREFIX}/etc/tsocks.conf.sample
${INSTALL_DATA} ${WRKSRC}/INSTALL ${PREFIX}/share/examples/tsocks/README
@${CAT} ${PKGMESSAGE}
.endif
.include <bsd.port.post.mk>

1
net/tsocks/distinfo Normal file
View File

@ -0,0 +1 @@
MD5 (tsocks-1.8beta5.tar.gz) = 51caefd77e5d440d0bbd6443db4fc0f8

View File

@ -0,0 +1,12 @@
--- Makefile.in.orig Tue Oct 7 18:13:47 2003
+++ Makefile.in Tue Oct 7 18:14:24 2003
@@ -67,8 +67,7 @@
installlib:
${MKINSTALLDIRS} "${DESTDIR}${libdir}"
- ${INSTALL} ${SHLIB} ${DESTDIR}${libdir}
- ln -sf ${SHLIB} ${DESTDIR}${libdir}/${LIB_NAME}.so.${SHLIB_MAJOR}
+ ${INSTALL} ${SHLIB} ${DESTDIR}${libdir}/${LIB_NAME}.so.${SHLIB_MAJOR}
ln -sf ${LIB_NAME}.so.${SHLIB_MAJOR} ${DESTDIR}${libdir}/${LIB_NAME}.so
installman:

View File

@ -0,0 +1,38 @@
--- configure.orig Sat Sep 6 00:45:57 2003
+++ configure Sat Sep 6 00:46:07 2003
@@ -1836,14 +1836,14 @@
SIMPLELIBS=${LIBS}
LIBS=
-echo $ac_n "checking for dlsym in -ldl""... $ac_c" 1>&6
-echo "configure:1841: checking for dlsym in -ldl" >&5
+echo $ac_n "checking for dlsym in -lc""... $ac_c" 1>&6
+echo "configure:1841: checking for dlsym in -lc" >&5
ac_lib_var=`echo dl'_'dlsym | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
-LIBS="-ldl $LIBS"
+LIBS="-lc $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1849 "configure"
#include "confdefs.h"
@@ -1877,7 +1877,7 @@
#define $ac_tr_lib 1
EOF
- LIBS="-ldl $LIBS"
+ LIBS="-lc $LIBS"
else
echo "$ac_t""no" 1>&6
@@ -2228,7 +2228,7 @@
echo $ac_n "checking for correct poll prototype""... $ac_c" 1>&6
echo "configure:2230: checking for correct poll prototype" >&5
PROTO=
-for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout'
+for testproto in 'struct pollfd fds[], nfds_t nfds, int timeout'
do
if test "${PROTO}" = ""; then
cat > conftest.$ac_ext <<EOF

View File

@ -0,0 +1,113 @@
--- INSTALL Sat May 18 04:12:30 2002
+++ README Sat Sep 6 18:36:27 2003
@@ -1,12 +1,7 @@
-Quick Installation Instructions
+Quick Instructions
-------------------------------
-1. Unpack the archive (though if you're reading this you've already
-achieved that)
-
- tar -zxvf tsocks-<version>.tar.gx
-
-2. Run ./configure, options which might be of interest (and that are
+1. Explenations of the ./configure options which might be of interest (and that are
specific to tsocks include):
--enable-socksdns This option causes tsocks to intercept
DNS lookups and attempt to force them
@@ -39,55 +34,31 @@
Other standard autoconf options are provided by typing './configure
--help'
-NOTE: The install path for the library is _NOT_ prefixed with --prefix,
-this is because it is strongly recommended that tsocks is installed into
-/lib (and not /usr/lib). This is important if tsocks is put into
-/etc/ld.so.preload since /usr is not mounted on many systems at boot
-time, meaning that programs running before /usr is mounted will try to
-preload tsocks, fail to find it and die, making the machine unusable. If
-you really wish to install the library into some other path use --libdir.
-
-3. Compile the code by typing:
+2. Created files:
- make
-
-This should result in the creation of the following:
- libtsocks.so - the libtsocks library
- validateconf - a utility to verify the tsocks configuration file
- inspectsocks - a utility to determine the version of a socks server
- saveme - a statically linked utility to remove /etc/ld.so.preload
if it becomes corrupt
+ - man pages - tsocks(8), tsocks(1) and tsocks.conf(5)
-4. If you experience any errors at this step and don't know how to fix
-them, seek help using the contacts listed on
-http://tsocks.sourceforge.net/contact.php
-
-5. Install the compiled library. You can skip this step if you only plan
-to use the library for personal use. If you want all users on the machine
-to be able to use it however, su to root then type
-
- make install
+3. Configuration
-This will install the library, the tsocks script and its man pages
-(tsocks(8), tsocks(1) and tsocks.conf(5)) to the paths specified to
-configure.
-
-Note that by default the library is installed to /lib and that the
-configure --prefix is IGNORED. See above for more detail.
-
-6. At this point you'll need to create the tsocks configuration file.
-There are two samples provided in the build directory called
+You'll need to create the tsocks configuration file.
+There are two samples provided in the build directory and
+/usr/local/share/examples/tsocks called
tsocks.conf.simple.example and tsocks.conf.complex.example.
Documentation on the configuration file format is provided in the
tsocks.conf man page ('man tsocks.conf').
-7. Having created the tsocks.conf file you should verify it using
+4. Having created the tsocks.conf file you should verify it using
validateconf (some detail on validateconf can be found in the tsocks.conf
man page). Normally validateconf is run without arguments
('./validateconf'). Any errors which are displayed by validateconf need
to be rectified before tsocks will function correctly.
-8. You can now choose to make the library affect all users or just those
+5. You can now choose to make the library affect all users or just those
who choose to use it. If you want users to use it themselves, they can
simply use the tsocks(1) shell script to run programs (see 'man tsocks')
or do the following in their shell before running applications that need
@@ -97,25 +68,15 @@
(in CSH) setenv LD_PRELOAD <path to library>
- <path to library> = e.g /lib/libtsocks.so.1.8
-
-If you want all users to pick up the library, place the full path to the
-full library in the file /etc/ld.so.preload (e.g "/lib/libtsocks.so"). Be
-EXTREMELY careful if you do this, if you mistype it or in some way get it
-wrong this will make your machine UNUSABLE. Also, if you do this, make
-sure the directory you put the library in is in the root of the
-filesystem, if the library is not available at boot time, again, your
-machine will be UNUSABLE.
+ <path to library> = e.g /usr/local/lib/tsocks/libtsocks.so.1.8
-9. Go ahead and use it! At this point everything should work. Again, if
+6. Go ahead and use it! At this point everything should work. Again, if
you experience any problems, use the contact points listed at
-http://tsocks.sourceforge.net/contact.php. If you do happen to break your
-machine with /etc/ld.so.preload, the build process creates a statically
-linked executable called saveme in the build directory. This executable
-simply unlinks /etc/ld.so.preload, this may or may not save you so give
-it a try. If it fails, you'll need to switch off the machine and get a
-rescue disk (e.g tomsrtbt) mount the disk and remove the file manually.
+http://tsocks.sourceforge.net/contact.php.
Thats it,
Thanks, Shaun Clowes (delius@progsoc.org)
+
+
+Adapted for FreeBSD by Marcin Jessa (yazzy@yazzy.org)

View File

@ -0,0 +1,63 @@
--- tsocks.1.orig Sat Mar 16 11:34:44 2002
+++ tsocks.1 Sat Sep 6 17:54:49 2003
@@ -1,24 +1,24 @@
-.TH TSOCKS 1 "" "TSOCKS"
-
-.SH NAME
+.\"
+.TH "TSOCKS" "1" "" "TSOCKS" ""
+.SH "NAME"
.BR tsocks
\- Shell wrapper to simplify the use of the tsocks(8) library to
transparently allow an application to use a SOCKS proxy
-.SH SYNOPSIS
+.SH "SYNOPSIS"
.B tsocks
.RB [application\ [application's\ arguments]]
-.br
+.br
or
.B tsocks
.RB [on|off]
-.br
+.br
or
.B tsocks
-.SH DESCRIPTION
+.SH "DESCRIPTION"
.B tsocks
is a wrapper between the tsocks library and the application what you
would like to run socksified.
-.SH OPTIONS
+.SH "OPTIONS"
.IP \fB[application\ \fB[application's\ arguments]]
run the application as specified with the environment (LD_PRELOAD) set
such that tsocks(8) will transparently proxy SOCKS connections in
@@ -28,19 +28,19 @@
variable. When tsocks(8) is in this variable all executed
applications are automatically socksified. If you want to
use this function, you HAVE to source the shell script from yours,
-like this: "source /usr/bin/tsocks" or ". /usr/bin/tsocks"
-.br
+like this: "source /usr/local/bin/tsocks" or ". /usr/local/bin/tsocks"
+.br
Example:
-.br
-". tsocks on" -- add the tsocks lib to LD_PRELOAD
-.br
-". tsocks off" -- remove the tsocks lib from LD_PRELOAD
+.br
+". tsocks on" \-\- add the tsocks lib to LD_PRELOAD
+.br
+". tsocks off" \-\- remove the tsocks lib from LD_PRELOAD
.IP \fB[show|sh]
show the current value of the LD_PRELOAD variable
.IP \fB<without\ any\ argument>
create a new shell with LD_PRELOAD including tsocks(8).
-.PP
-.SH AUTHOR
+.PP
+.SH "AUTHOR"
This script was created by Tamas SZERB <toma@rulez.org> for the debian
package of tsocks. It (along with this manual page) have since been
adapted into the main tsocks project and modified.

View File

@ -0,0 +1,168 @@
--- tsocks.8.orig Sat Mar 16 11:20:51 2002
+++ tsocks.8 Sat Sep 6 18:15:08 2003
@@ -1,25 +1,24 @@
-.TH TSOCKS 8 "" "Shaun Clowes" \" -*-
- \" nroff -*
-
-.SH NAME
+.\" \" nroff -*
+.\"
+.TH "TSOCKS" "8" "" "Shaun Clowes" "\""
+.SH "NAME"
.BR tsocks
\- Library for intercepting outgoing network connections and
redirecting them through a SOCKS server.
-.SH SYNOPSIS
-
+.SH "SYNOPSIS"
Set LD_PRELOAD to load the library then use applications as normal
The syntax to force preload of the library for different shells is
specified below:
-Bash, Ksh and Bourne shell -
+Bash, Ksh and Bourne shell \-
-export LD_PRELOAD=/lib/libtsocks.so
+export LD_PRELOAD=/usr/local/lib/tsocks/libtsocks.so
-C Shell -
+C Shell \-
-setenv LD_PRELOAD=/lib/libtsocks.so
+setenv LD_PRELOAD=/usr/local/lib/tsocks/libtsocks.so
This process can be automated (for Bash, Bourne and Korn shell
users) for a single command or for all commands in a shell session
@@ -30,13 +29,12 @@
information on this configuration see the CAVEATS section of this
manual page.
-.SH DESCRIPTION
-
+.SH "DESCRIPTION"
.BR tsocks
is a library to allow transparent SOCKS proxying. It wraps the normal
connect() function. When a connection is attempted, it consults the
configuration file (which is defined at configure time but defaults to
-/etc/tsocks.conf) and determines if the IP address specified is local. If
+/usr/local/etc/tsocks.conf) and determines if the IP address specified is local. If
it is not, the library redirects the connection to a SOCKS server
specified in the configuration file. It then negotiates that connection
with the SOCKS server and passes the connection back to the calling
@@ -52,42 +50,42 @@
Most arguments to
.BR tsocks
are provided in the configuration file (the location of which is defined
-at configure time by the --with-conf=<file> argument but defaults to
-/etc/tsocks.conf). The structure of this file is documented in tsocks.conf(8)
+at configure time by the \-\-with\-conf=<file> argument but defaults to
+/usr/local/etc/tsocks.conf). The structure of this file is documented in tsocks.conf(8)
Some configuration options can be specified at run time using environment
variables as follows:
-.TP
+.TP
.I TSOCKS_CONFFILE
This environment variable overrides the default location of the tsocks
configuration file. This variable is not honored if the program tsocks
is embedded in is setuid. In addition this environment variable can
-be compiled out of tsocks with the --disable-envconf argument to
+be compiled out of tsocks with the \-\-disable\-envconf argument to
configure at build time
-.TP
+.TP
.I TSOCKS_DEBUG
This environment variable sets the level of debug output that should be
generated by tsocks (debug output is generated in the form of output to
standard error). If this variable is not present by default the logging
level is set to 0 which indicates that only error messages should be output.
Setting it to higher values will cause tsocks to generate more messages
-describing what it is doing. If set to -1 tsocks will output absolutely no
+describing what it is doing. If set to \-1 tsocks will output absolutely no
error or debugging messages. This is only needed if tsocks output interferes
with a program it is embedded in. Message output can be permanently compiled
-out of tsocks by specifying the --disable-debug option to configure at
+out of tsocks by specifying the \-\-disable\-debug option to configure at
build time
-.TP
+.TP
.I TSOCKS_DEBUG_FILE
This option can be used to redirect the tsocks output (which would normally
be sent to standard error) to a file. This variable is not honored if the
program tsocks is embedded in is setuid. For programs where tsocks output
interferes with normal operation this option is generally better than
-disabling messages (with TSOCKS_DEBUG = -1)
+disabling messages (with TSOCKS_DEBUG = \-1)
-.TP
+.TP
.I TSOCKS_USERNAME
This environment variable can be used to specify the username to be used when
version 5 SOCKS servers request username/password authentication. This
@@ -95,7 +93,7 @@
file using 'default_user', see tsocks.conf(8) for more information. This
variable is ignored for version 4 SOCKS servers.
-.TP
+.TP
.I TSOCKS_PASSWORD
This environment variable can be used to specify the password to be used when
version 5 SOCKS servers request username/password authentication. This
@@ -115,11 +113,12 @@
.BR tsocks
will generate error messages and print them to stderr when there are
problems with the configuration file or the SOCKS negotiation with the
-server if the TSOCKS_DEBUG environment variable is not set to -1 or and
---disable-debug was not specified at compile time. This output may cause
+server if the TSOCKS_DEBUG environment variable is not set to \-1 or and
+\-\-disable\-debug was not specified at compile time. This output may cause
some problems with programs that redirect standard error.
.SS CAVEATS
+.BR Linux specific:
.BR tsocks
will not in the above configuration be able to provide SOCKS proxying to
setuid applications or applications that are not run from a shell. You can
@@ -132,8 +131,7 @@
careful. Also be sure the library is in the root filesystem as all hell
will break loose if the directory it is in is not available at boot time.
-.SH BUGS
-
+.SH "BUGS"
.BR tsocks
can only proxy outgoing TCP connections
@@ -157,21 +155,21 @@
.BR tsocks
uses ELF dynamic loader features to intercept dynamic function calls from
programs in which it is embedded. As a result, it cannot trace the
-actions of statically linked executables, non-ELF executables, or
+actions of statically linked executables, non\-ELF executables, or
executables that make system calls directly with the system call trap or
through the syscall() routine.
-.SH FILES
-/etc/tsocks.conf - default tsocks configuration file
+.SH "FILES"
+/usr/local/etc/tsocks.conf \- default tsocks configuration file
-.SH SEE ALSO
+.SH "SEE ALSO"
tsocks.conf(5)
tsocks(1)
-.SH AUTHOR
+.SH "AUTHOR"
Shaun Clowes (delius@progsoc.uts.edu.au)
-.SH COPYRIGHT
+.SH "COPYRIGHT"
Copyright 2000 Shaun Clowes
tsocks and its documentation may be freely copied under the terms and

21
net/tsocks/pkg-descr Normal file
View File

@ -0,0 +1,21 @@
SOCKS servers are a form of proxy that are commonly used
in firewalled LAN environments to allow access between networks,
and often to the Internet.
The problem is that most applications don't know how to gain
access through SOCKS servers.
This means that network based applications
that don't understand SOCKS are very limited in networks they can reach.
An example of this is simple 'telnet'.
If you're on a network firewalled from the internet
with a SOCKS server for outside access,
telnet can't use this server and thus can't telnet out to the Internet.
tsocks' role is to allow these non SOCKS aware applications
(e.g telnet, ssh, ftp etc) to use SOCKS without any modification.
It does this by intercepting the
calls that applications make to establish network connections
and negotating them through a SOCKS server as necessary.
WWW: http://tsocks.sourceforge.net
Thanks opet for his help on that port.

9
net/tsocks/pkg-message Normal file
View File

@ -0,0 +1,9 @@
###
Simple setup file was copied to ${PREFIX}/etc/tsocks.conf.sample
An example of a more complex setup file can be found in
${PREFIX}/share/examples/tsocks/
Some more details avaliable in ${PREFIX}/share/examples/tsocks/README
###

9
net/tsocks/pkg-plist Normal file
View File

@ -0,0 +1,9 @@
bin/tsocks
etc/tsocks.conf.sample
lib/tsocks/libtsocks.so.1
lib/tsocks/libtsocks.so
@dirrm lib/tsocks/
%%EXAMPLESDIR%%/tsocks.conf.complex.example
%%EXAMPLESDIR%%/tsocks.conf.simple.example
%%EXAMPLESDIR%%/README
@dirrm %%EXAMPLESDIR%%