ports/131653: [NEW PORT] net/torsocks: Most SOCKS-friendly applications way with Tor

Andrei Lavreniyuk andy.lavr at gmail.com
Fri Feb 13 18:10:02 UTC 2009


>Number:         131653
>Category:       ports
>Synopsis:       [NEW PORT] net/torsocks: Most SOCKS-friendly applications way with Tor
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 13 18:10:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Andrei Lavreniyuk
>Release:        FreeBSD 7.1-STABLE
>Organization:
"Technica-03, Inc." Ukraine, Kiev.
>Environment:
FreeBSD datacenter.technica-03.local 7.1-STABLE FreeBSD 7.1-STABLE #1: Mon Jan  5 17:35:27 EET 2009     root at datacenter.technica-03.local:/usr/obj/usr/src/sys/SMP-DATACENTER  i386
>Description:
 It is new generation TSOCKS.

 Torsocks allows you to use most socks-friendly applications in
a safe way with Tor. It ensures that DNS requests are handled
safely and explicitly rejects UDP traffic from the application
you're using.

 The first release of torsocks contained the following enhancements:

    -Torifying reverse dns requests through gethostbyaddr()
    -Blocking of UDP traffic from sendto() and its variants.
    -Use of Tor-friendly defaults if no configuration file available.
    -The addition of all RFC defined private address ranges to the
    -default configuration.


WWW: http://code.google.com/p/torsocks/
AUTHOR: Robert Hogan <robert at roberthogan.net>


>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	torsocks
#	torsocks/pkg-descr
#	torsocks/Makefile
#	torsocks/files
#	torsocks/files/patch-usewithtor.in
#	torsocks/files/patch-Makefile.am
#	torsocks/files/patch-tsocks.c
#	torsocks/files/patch-dead_pool.c
#	torsocks/files/patch-configure.in
#	torsocks/distinfo
#	torsocks/pkg-plist
#	torsocks/pkg-message
#
echo c - torsocks
mkdir -p torsocks > /dev/null 2>&1
echo x - torsocks/pkg-descr
sed 's/^X//' >torsocks/pkg-descr << 'd6e9d608b3a2a616320c54433acf8060'
X It is new generation tsocks.
X
X Torsocks allows you to use most socks-friendly applications in
Xa safe way with Tor. It ensures that DNS requests are handled
Xsafely and explicitly rejects UDP traffic from the application
Xyou're using.
X
X The first release of torsocks contained the following enhancements: 
X
X    -Torifying reverse dns requests through gethostbyaddr() 
X    -Blocking of UDP traffic from sendto() and its variants. 
X    -Use of Tor-friendly defaults if no configuration file available. 
X    -The addition of all RFC defined private address ranges to the
X    -default configuration.
X
X
XWWW: http://code.google.com/p/torsocks/
XAUTHOR:	Robert Hogan <robert at roberthogan.net>
X
X	- Andrei V. Lavreniyuk
X	andy.lavr at reactor-xg.kiev.ua
d6e9d608b3a2a616320c54433acf8060
echo x - torsocks/Makefile
sed 's/^X//' >torsocks/Makefile << 'ef4798915525efa4f3898912a1d4b1f7'
X# New ports collection makefile for:	torsocks
X# Date created:				13Fri February 2009
X# Whom:					Andrei Lavreniyuk <andy.lavr at gmail.com>
X#
X# $FreeBSD$
X
XPORTNAME=	torsocks
XPORTVERSION=	1.0
XPORTREVISION=	1
XCATEGORIES=	net security
XMASTER_SITES=	${MASTER_SITE_GOOGLE_CODE} \
X		http://tor.reactor-xg.kiev.ua/files/
XDISTNAME=${PORTNAME}-${PORTVERSION}-gamma
X
XMAINTAINER=	andy.lavr at gmail.com
XCOMMENT=	Most SOCKS-friendly applications way with Tor
X
XCONFLICTS=	tsocks-[0-9]*
X
XUSE_AUTOTOOLS=	${LIBTOOL} aclocal:110 autoheader:262 autoconf:262 automake:110
XACLOCAL_ARGS=	-I ${LOCALBASE}/share/aclocal
XAUTOMAKE_ARGS=	--add-missing
X
XCONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
XCPPFLAGS=	-I${LOCALBASE}/include
XLDFLAGS=	-L${LOCALBASE}/lib
X
XGNU_CONFIGURE=	yes
XUSE_GMAKE=	yes
XUSE_LDCONFIG=	yes
XUSE_GZIP=	yes
X
XWRKSRC=${WRKDIR}/${PORTNAME}-${PORTVERSION}-gamma
X
XCONFIGURE_ARGS+=--libdir=${PREFIX}/lib
X
XMAN1=		torsocks.1
XMAN5=		torsocks.conf.5
XMAN8=		torsocks.8
X
X.if defined(WITHOUT_TORDNS)
XCONFIGURE_ARGS+=	--disable-tordns
X.endif
X
X.if defined(WITH_SOCKSDNS)
XCONFIGURE_ARGS+=	--enable-socksdns
X.endif
X
X.if defined(WITH_OLDMETHOD)
XCONFIGURE_ARGS+=	--enable-oldmethod
X.endif
X
X.if defined(WITH_NODEBUG)
XCONFIGURE_ARGS+=	--disable-debug
X.endif
X
X.if defined(WITH_HOSTNAMES)
XCONFIGURE_ARGS+=	--enable-hostnames
X.endif
X
X.include <bsd.port.pre.mk>
X
Xpre-everything::
X.if !defined(WITHOUT_TORDNS)
X	@${ECHO_MSG}
X	@${ECHO_MSG} "You can use the WITHOUT_TORDNS=yes knob."
X	@${ECHO_MSG} "This option disables tordns, which causes"
X	@${ECHO_MSG} "names to be looked up in a way designed to"
X	@${ECHO_MSG} "work well with Tor."
X	@${ECHO_MSG}
X.endif
X
X.if !defined(WITH_SOCKSDNS)
X	@${ECHO_MSG}
X	@${ECHO_MSG} "You can use the WITH_SOCKSDNS=yes knob."
X	@${ECHO_MSG} "This option causes torsocks to intercept"
X	@${ECHO_MSG} "DNS lookups and attempt to force them"
X	@${ECHO_MSG} "to use TCP instead of UDP and thus"
X	@${ECHO_MSG} "be proxied through the socks server."
X	@${ECHO_MSG}
X.endif
X
X.if !defined(WITH_OLDMETHOD)
X	@${ECHO_MSG}
X	@${ECHO_MSG} "You can use the make WITH_OLDMETHOD=yes knob."
X	@${ECHO_MSG} "This forces torsocks not to use the"
X	@${ECHO_MSG} "RTLD_NEXT parameter to dlsym to get the"
X	@${ECHO_MSG} "address of the connect() method torsocks"
X	@${ECHO_MSG} "overrides, instead it loads a reference"
X	@${ECHO_MSG} "to the libc shared library and then uses dlsym()."
X	@${ECHO_MSG}
X.endif
X
X.if !defined(WITH_NODEBUG)
X	@${ECHO_MSG}
X	@${ECHO_MSG} "You can use the make WITH_NODEBUG=yes knob."
X	@${ECHO_MSG} "This configuration option tells torsocks"
X	@${ECHO_MSG} "to never output error messages to stderr."
X	@${ECHO_MSG}
X.endif
X
X.if !defined(WITH_HOSTNAMES)
X	@${ECHO_MSG}
X	@${ECHO_MSG} "You can use the make WITH_HOSTNAMES=yes knob."
X	@${ECHO_MSG} "This disables DNS lookups on names"
X	@${ECHO_MSG} "provided as socks servers in the config"
X	@${ECHO_MSG} "file. This option is necessary"
X	@${ECHO_MSG} "if socks dns is enabled since torsocks"
X	@${ECHO_MSG} "can't send a socks dns request to resolve"
X	@${ECHO_MSG} "the location of the socks server."
X	@${ECHO_MSG}
X.endif
X
Xpost-patch:
X	@${REINPLACE_CMD} -e 's|@prefix@|${PREFIX}|' ${WRKSRC}/src/torsocks.in
X	@${LN} ${WRKSRC}/src/torsocks.conf ${WRKSRC}/src/torsocks.conf.sample
X
Xpost-install:
X	@${LN} -s ${PREFIX}/bin/torsocks ${PREFIX}/bin/tsocks
X	@${LN} -s ${PREFIX}/lib/torsocks/libtorsocks.a ${PREFIX}/lib/libtorsocks.a
X	@${LN} -s ${PREFIX}/lib/torsocks/libtorsocks.la ${PREFIX}/lib/libtorsocks.la
X	@${LN} -s ${PREFIX}/lib/torsocks/libtorsocks.so.1 ${PREFIX}/lib/libtorsocks.so
X	@${LN} -s ${PREFIX}/lib/torsocks/libtorsocks.so.1 ${PREFIX}/lib/libtsocks.so
X
X.if !defined(NOPORTEXAMPLES)
X	@${MKDIR} ${EXAMPLESDIR}
X	${INSTALL_DATA} ${WRKSRC}/src/*.example ${EXAMPLESDIR}
X.endif
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR}/README
X.endif
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
ef4798915525efa4f3898912a1d4b1f7
echo c - torsocks/files
mkdir -p torsocks/files > /dev/null 2>&1
echo x - torsocks/files/patch-usewithtor.in
sed 's/^X//' >torsocks/files/patch-usewithtor.in << '7e2437d4065537893960f1204c37ff70'
X--- src/usewithtor.in.orig	2009-02-12 15:59:50.000000000 +0200
X+++ src/usewithtor.in	2009-02-12 19:49:41.000000000 +0200
X@@ -1,3 +1,5 @@
X+#!/bin/sh
X+#
X # ***************************************************************************
X # *                                                                         *
X # * $Id: usewithtor.in,v 1.3 2008-07-06 15:17:35 hoganrobert Exp $*
X@@ -26,7 +28,6 @@
X # ***************************************************************************
X 
X 
X-#! /bin/sh
X 
X # Wrapper script for use of the torsocks(8) transparent socksification library
X # See the torsocks(1) and usewithtor(1) manpages.
7e2437d4065537893960f1204c37ff70
echo x - torsocks/files/patch-Makefile.am
sed 's/^X//' >torsocks/files/patch-Makefile.am << 'c15ae1c37c2bf8c505d80f0439adf068'
X--- src/Makefile.am.orig	2009-02-07 12:48:12.000000000 +0200
X+++ src/Makefile.am	2009-02-13 15:44:54.000000000 +0200
X@@ -1,6 +1,6 @@
X # Makefile used by configure to create real Makefile
X 
X-LIBS = -ldl -lc -lresolv
X+LIBS = -lc
X libdir = @prefix@/lib/torsocks
X 
X # Install helper programs
X@@ -16,7 +16,7 @@
X 
X # Install configuration file
X usewithtorconfdir = $(CONFDIR)/
X-usewithtorconf_DATA = torsocks.conf
X+usewithtorconf_DATA = torsocks.conf.sample
X 
X # Install invocation scripts
X bin_SCRIPTS = torsocks usewithtor
c15ae1c37c2bf8c505d80f0439adf068
echo x - torsocks/files/patch-tsocks.c
sed 's/^X//' >torsocks/files/patch-tsocks.c << '562546270ba6253b7dce35431f73ffce'
X--- src/tsocks.c.orig	2009-02-12 15:59:50.000000000 +0200
X+++ src/tsocks.c	2009-02-12 23:18:14.870533468 +0200
X@@ -164,7 +164,7 @@
X void tsocks_init(void) {
X 
X #define LOAD_ERROR(s,l) { \
X-    char *error; \
X+    const char *error; \
X     error = dlerror(); \
X     show_msg(l, "The symbol %s() was not found in any shared " \
X                      "library. The error reported was: %s!\n", s, \
562546270ba6253b7dce35431f73ffce
echo x - torsocks/files/patch-dead_pool.c
sed 's/^X//' >torsocks/files/patch-dead_pool.c << '908c68ca20dae3cd8428f3e1f6098dd8'
X--- src/dead_pool.c.orig	2009-02-12 15:59:50.000000000 +0200
X+++ src/dead_pool.c	2009-02-12 17:19:10.000000000 +0200
X@@ -100,7 +100,7 @@
X     /* Allocate space for the dead_pool structure */
X     newpool = (dead_pool *) mmap(0, sizeof(dead_pool), 
X                    PROT_READ | PROT_WRITE, 
X-                   MAP_SHARED | MAP_ANONYMOUS, -1, 0); 
X+                   MAP_SHARED | MAP_ANON, -1, 0); 
X     if(!newpool) {
X         show_msg(MSGERR, "init_pool: unable to mmap deadpool "
X                  "(tried to map %d bytes)\n", sizeof(dead_pool));
X@@ -127,7 +127,7 @@
X     /* Allocate space for the entries */
X     newpool->entries = (pool_ent *) mmap(0, newpool->n_entries * sizeof(pool_ent), 
X                             PROT_READ | PROT_WRITE, 
X-                            MAP_SHARED | MAP_ANONYMOUS, -1, 0); 
X+                            MAP_SHARED | MAP_ANON, -1, 0); 
X     if(!newpool->entries) {
X         munmap((void *)newpool, sizeof(dead_pool));
X         show_msg(MSGERR, "init_pool: unable to mmap deadpool entries "
908c68ca20dae3cd8428f3e1f6098dd8
echo x - torsocks/files/patch-configure.in
sed 's/^X//' >torsocks/files/patch-configure.in << '9aa12cd95cef9318f1a22a6399c83927'
X--- configure.in.orig	2009-02-12 15:59:50.000000000 +0200
X+++ configure.in	2009-02-12 17:27:16.000000000 +0200
X@@ -123,11 +123,9 @@
X dnl Checks for libraries.
X dnl Replace `main' with a function in -ldl:
X 
X-AC_CHECK_LIB(dl, dlsym, [ tempdso="yes" ],tempdso="no")
X-if test "$tempdso" = "no"; then
X-  AC_CHECK_LIB(c, dlsym,,AC_MSG_ERROR("dlsym() not found in libc or libdl." \
X-               "Check your system for libc.so and/or libdl.so."))
X-fi
X+dnl Checks for libraries.
X+AC_CHECK_LIB(c, dlsym,,AC_MSG_ERROR(""dlsym() not found in libc." \
X+               "Check your system for libc.so."))
X 
X AC_CHECK_LIB(resolv, res_query, [ tempres="no" ],tempres="yes")
X if test "$tempres" = "no"; then
X@@ -356,8 +354,8 @@
X dnl Find the correct res_querydomain prototype on this machine
X AC_MSG_CHECKING(for correct res_querydomain prototype)
X PROTO=
X-PROTO1='const char *name, const char *domain, int class, int type, unsigned char *answer, int anslen'
X-for testproto in "${PROTO1}"
X+PROTO1='const char *name, const char *domain, int class, int type, u_char *answer, int anslen'
X+for PROTO in "${PROTO1}"
X do
X   if test "${PROTO}" = ""; then
X     AC_TRY_COMPILE([
X@@ -376,8 +374,8 @@
X AC_MSG_CHECKING(for correct res_send prototype)
X PROTO=
X PROTO1='const char *msg, int msglen, char *answer, int anslen'
X-PROTO2='const unsigned char *msg, int msglen, unsigned char *answer, int anslen'
X-for testproto in "${PROTO1}" \
X+PROTO2='const u_char *msg, int msglen, u_char *answer, int anslen'
X+for PROTO in "${PROTO1}" \
X                  "${PROTO2}"
X do
X   if test "${PROTO}" = ""; then
X@@ -397,8 +395,8 @@
X dnl Find the correct res_search prototype on this machine
X AC_MSG_CHECKING(for correct res_search prototype)
X PROTO=
X-PROTO1='const char *dname, int class, int type,unsigned char *answer, int anslen'
X-for testproto in "${PROTO1}" 
X+PROTO1='const char *dname, int class, int type, u_char *answer, int anslen'
X+for PROTO in "${PROTO1}" 
X do
X   if test "${PROTO}" = ""; then
X     AC_TRY_COMPILE([
X@@ -417,8 +415,8 @@
X dnl Find the correct res_query prototype on this machine
X AC_MSG_CHECKING(for correct res_query prototype)
X PROTO=
X-PROTO1='const char *dname, int class, int type,unsigned char *answer, int anslen'
X-for testproto in "${PROTO1}" 
X+PROTO1='const char *dname, int class, int type, u_char *answer, int anslen'
X+for PROTO in "${PROTO1}" 
X do
X   if test "${PROTO}" = ""; then
X     AC_TRY_COMPILE([
X@@ -462,7 +460,7 @@
X dnl Find the correct poll prototype on this machine 
X AC_MSG_CHECKING(for correct poll prototype)
X PROTO=
X-for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout' \
X+for testproto in 'struct pollfd *ufds, u_long nfds, int timeout' \
X                  'struct pollfd *ufds, nfds_t nfds, int timeout'
X do
X   if test "${PROTO}" = ""; then
9aa12cd95cef9318f1a22a6399c83927
echo x - torsocks/distinfo
sed 's/^X//' >torsocks/distinfo << 'd72135cf3f893b64aa04d62ad008a62e'
XMD5 (torsocks-1.0-gamma.tar.gz) = a55f99cf78654a990d0646fc767567ca
XSHA256 (torsocks-1.0-gamma.tar.gz) = d13dbd7d97745ecac6cf3ecc3800535faa3c08f5b9b33f214e210afd7658aae6
XSIZE (torsocks-1.0-gamma.tar.gz) = 482415
d72135cf3f893b64aa04d62ad008a62e
echo x - torsocks/pkg-plist
sed 's/^X//' >torsocks/pkg-plist << 'ba89a773954534ba4a690a39d72647c3'
Xbin/torsocks
Xbin/tsocks
Xetc/torsocks.conf.sample
Xlib/torsocks/libtorsocks.a
Xlib/torsocks/libtorsocks.la
Xlib/torsocks/libtorsocks.so.1
Xlib/torsocks/libtorsocks.so
Xlib/libtorsocks.a
Xlib/libtorsocks.la
Xlib/libtorsocks.so
Xlib/libtsocks.so
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/tsocks.conf.complex.example
X%%PORTEXAMPLES%%%%EXAMPLESDIR%%/tsocks.conf.simple.example
X%%PORTDOCS%%%%DOCSDIR%%/README
X at dirrm %%EXAMPLESDIR%%
X at dirrm %%DOCSDIR%%
X at dirrm /lib/torsocks
X
ba89a773954534ba4a690a39d72647c3
echo x - torsocks/pkg-message
sed 's/^X//' >torsocks/pkg-message << 'f400791653efc9c4727ad5b5f30f2c3d'
X
X###
X
XAbout:
X
XTorsocks allows you to use most socks-friendly applications in
Xa safe way with Tor. It ensures that DNS requests are handled
Xsafely and explicitly rejects UDP traffic from the application
Xyou're using.
X
X The first release of torsocks contained the following enhancements: 
X
X    -Torifying reverse dns requests through gethostbyaddr() 
X    -Blocking of UDP traffic from sendto() and its variants. 
X    -Use of Tor-friendly defaults if no configuration file available. 
X    -The addition of all RFC defined private address ranges to the
X    -default configuration.
X
XAuthor:	Robert Hogan <robert at roberthogan.net>
X
X----------------------------------------------------------------------
X
XNotes:
X
XSimple setup file was copied to ${PREFIX}/etc/torsocks.conf.sample
XAn example of a more complex setup file can be found in
X${PREFIX}/share/examples/torsocks/
X
X
XIntroduction:
X
XOnce you have installed torsocks, just launch it like so: 
X
Xusewithtor [application] 
X
XSo, for example you can use ssh to a some.ssh.com by doing: 
X
Xusewithtor ssh username at some.ssh.com -l <user>
X
Xor launch pidgin by doing: 
X
Xusewithtor pidgin
X
X
X###
f400791653efc9c4727ad5b5f30f2c3d
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list