ports/131628: New port: net/torsocks Most socks-friendly applications way with Tor
Andrei Lavreniyuk
andy.lavr at gmail.com
Fri Feb 13 02:50:02 UTC 2009
>Number: 131628
>Category: ports
>Synopsis: New port: net/torsocks Most socks-friendly applications way with Tor
>Confidential: no
>Severity: non-critical
>Priority: high
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 13 02:50:01 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:
New port: net/torsocks
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.
>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:
#
# /usr/ports/net/torsocks
# /usr/ports/net/torsocks/pkg-descr
# /usr/ports/net/torsocks/pkg-message
# /usr/ports/net/torsocks/distinfo
# /usr/ports/net/torsocks/Makefile
# /usr/ports/net/torsocks/pkg-plist
# /usr/ports/net/torsocks/files
# /usr/ports/net/torsocks/files/patch-configure.in
# /usr/ports/net/torsocks/files/patch-dead_pool.c
# /usr/ports/net/torsocks/files/patch-Makefile.am
# /usr/ports/net/torsocks/files/patch-tsocks.c
# /usr/ports/net/torsocks/files/patch-usewithtor.in
#
echo c - /usr/ports/net/torsocks
mkdir -p /usr/ports/net/torsocks > /dev/null 2>&1
echo x - /usr/ports/net/torsocks/pkg-descr
sed 's/^X//' >/usr/ports/net/torsocks/pkg-descr << '737457117b6f64a97c8afae7932297e0'
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
XWWW: http://code.google.com/p/torsocks/
737457117b6f64a97c8afae7932297e0
echo x - /usr/ports/net/torsocks/pkg-message
sed 's/^X//' >/usr/ports/net/torsocks/pkg-message << 'ef9740b0728c4fbddaec0941174858bb'
X
X###
X
XSimple setup file was copied to ${PREFIX}/etc/torsocks.conf
XAn example of a more complex setup file can be found in
X${PREFIX}/share/examples/torsocks/
X
X###
ef9740b0728c4fbddaec0941174858bb
echo x - /usr/ports/net/torsocks/distinfo
sed 's/^X//' >/usr/ports/net/torsocks/distinfo << '1361154a4756936ad4e2e902138382f6'
XMD5 (torsocks-1.0-gamma.tar.gz) = a55f99cf78654a990d0646fc767567ca
XSHA256 (torsocks-1.0-gamma.tar.gz) = d13dbd7d97745ecac6cf3ecc3800535faa3c08f5b9b33f214e210afd7658aae6
XSIZE (torsocks-1.0-gamma.tar.gz) = 482415
1361154a4756936ad4e2e902138382f6
echo x - /usr/ports/net/torsocks/Makefile
sed 's/^X//' >/usr/ports/net/torsocks/Makefile << 'e14e26c396b8a98ae1b108b560140a38'
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
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= --with-conf=${PREFIX}/etc/tsocks.conf \
X --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
X.if ${ARCH} != "i386"
XTRYBROKEN= Not yet integrated and tested on !i386
X.elif ${OSVERSION} < 600000
XBROKEN= Not yet integrated and tested
X.endif
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 tsocks 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 tsocks not to use the"
X @${ECHO_MSG} "RTLD_NEXT parameter to dlsym to get the"
X @${ECHO_MSG} "address of the connect() method tsocks"
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 tsocks"
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 tsocks"
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
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 ${INSTALL_DATA} ${WRKSRC}/src/torsocks.conf ${PREFIX}/etc/torsocks.conf.sample
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>
e14e26c396b8a98ae1b108b560140a38
echo x - /usr/ports/net/torsocks/pkg-plist
sed 's/^X//' >/usr/ports/net/torsocks/pkg-plist << '37fd0dc7e30375c7c4e634c4f51bd818'
Xbin/torsocks
Xbin/tsocks
Xetc/torsocks.conf
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
37fd0dc7e30375c7c4e634c4f51bd818
echo c - /usr/ports/net/torsocks/files
mkdir -p /usr/ports/net/torsocks/files > /dev/null 2>&1
echo x - /usr/ports/net/torsocks/files/patch-configure.in
sed 's/^X//' >/usr/ports/net/torsocks/files/patch-configure.in << '607fe53ce01dcacb9f9891a9842cfade'
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
607fe53ce01dcacb9f9891a9842cfade
echo x - /usr/ports/net/torsocks/files/patch-dead_pool.c
sed 's/^X//' >/usr/ports/net/torsocks/files/patch-dead_pool.c << '86a2c579370b3f90085824d202d14841'
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 "
86a2c579370b3f90085824d202d14841
echo x - /usr/ports/net/torsocks/files/patch-Makefile.am
sed 's/^X//' >/usr/ports/net/torsocks/files/patch-Makefile.am << '48f603ed7f27409541a2446d782718dc'
X--- src/Makefile.am.orig 2009-02-12 17:44:45.000000000 +0200
X+++ src/Makefile.am 2009-02-12 17:44:08.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
48f603ed7f27409541a2446d782718dc
echo x - /usr/ports/net/torsocks/files/patch-tsocks.c
sed 's/^X//' >/usr/ports/net/torsocks/files/patch-tsocks.c << '0182336ebf9199df4e06c0f3d182f280'
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, \
0182336ebf9199df4e06c0f3d182f280
echo x - /usr/ports/net/torsocks/files/patch-usewithtor.in
sed 's/^X//' >/usr/ports/net/torsocks/files/patch-usewithtor.in << '20dadcd994b9bc76a67809fcfd268edb'
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.
20dadcd994b9bc76a67809fcfd268edb
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list