1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

It is new generation of 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.

WWW: http://code.google.com/p/torsocks/

PR:		ports/131653
Submitted by:	Andrei Lavreniyuk <andy.lavr AT gmail.com>
Approved by:	miwi (mentor)
This commit is contained in:
Beat Gaetzi 2009-03-08 13:57:27 +00:00
parent 335d471aee
commit c051a2080a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=229676
11 changed files with 319 additions and 0 deletions

View File

@ -963,6 +963,7 @@
SUBDIR += tinyldap
SUBDIR += tn5250
SUBDIR += tn5250j
SUBDIR += torsocks
SUBDIR += tptest
SUBDIR += traceroute
SUBDIR += traff

128
net/torsocks/Makefile Normal file
View File

@ -0,0 +1,128 @@
# New ports collection makefile for: torsocks
# Date created: 13 February 2009
# Whom: Andrei Lavreniyuk <andy.lavr@gmail.com>
#
# $FreeBSD$
PORTNAME= torsocks
PORTVERSION= 1.0
CATEGORIES= net security
MASTER_SITES= GOOGLE_CODE \
http://tor.reactor-xg.kiev.ua/files/
DISTNAME= ${PORTNAME}-${PORTVERSION}-gamma
MAINTAINER= andy.lavr@gmail.com
COMMENT= Most SOCKS-friendly applications way with Tor
USE_AUTOTOOLS= libtool:15 aclocal:110 autoconf:262
ACLOCAL_ARGS= -I ${LOCALBASE}/share/aclocal
USE_GMAKE= yes
USE_LDCONFIG= yes
MAN1= torsocks.1 usewithtor.1
MAN5= torsocks.conf.5
MAN8= torsocks.8
SUB_FILES= pkg-message
OPTIONS= TORDNS "Use tordns" on \
SOCKSDNS "Use socks server for DNS lookups" off \
OLDMETHOD "Do not use RTLD_NEXT parameter to dlsym" off \
NODEBUG "Disable output of error messages" off \
HOSTNAMES "Disable DNS lookups of socks server" off
.include <bsd.port.pre.mk>
.if defined(WITHOUT_TORDNS)
CONFIGURE_ARGS+= --disable-tordns
.endif
.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_HOSTNAMES)
CONFIGURE_ARGS+= --enable-hostnames
.endif
.if defined(WITH_SOCKSDNS) && !defined(WITH_HOSTNAMES)
BROKEN= HOSTNAMES option is necessary if SOCKSDNS option is enabled
.endif
pre-everything::
.if !defined(WITHOUT_TORDNS)
@${ECHO_MSG}
@${ECHO_MSG} "You can deselect the TORDNS option."
@${ECHO_MSG} "This option disables tordns, which causes"
@${ECHO_MSG} "names to be looked up in a way designed to"
@${ECHO_MSG} "work well with Tor."
@${ECHO_MSG}
.endif
.if !defined(WITH_SOCKSDNS)
@${ECHO_MSG}
@${ECHO_MSG} "You can use the SOCKSDNS option."
@${ECHO_MSG} "This option causes torsocks 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 OLDMETHOD option."
@${ECHO_MSG} "This forces torsocks not to use the"
@${ECHO_MSG} "RTLD_NEXT parameter to dlsym to get the"
@${ECHO_MSG} "address of the connect() method torsocks"
@${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 NODEBUG option."
@${ECHO_MSG} "This configuration option tells torsocks"
@${ECHO_MSG} "to never output error messages to stderr."
@${ECHO_MSG}
.endif
.if !defined(WITH_HOSTNAMES)
@${ECHO_MSG}
@${ECHO_MSG} "You can use the HOSTNAMES option."
@${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 torsocks"
@${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|@prefix@|${PREFIX}|' ${WRKSRC}/src/torsocks.in
@${REINPLACE_CMD} -e 's|MAP_ANONYMOUS|MAP_ANON|' ${WRKSRC}/src/dead_pool.c
@${MV} ${WRKSRC}/src/torsocks.conf ${WRKSRC}/src/torsocks.conf.sample
post-install:
.if !defined(NOPORTEXAMPLES)
@${MKDIR} ${EXAMPLESDIR}
${INSTALL_DATA} ${WRKSRC}/src/*.example ${EXAMPLESDIR}
.endif
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR}
.endif
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

3
net/torsocks/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (torsocks-1.0-gamma.tar.gz) = a55f99cf78654a990d0646fc767567ca
SHA256 (torsocks-1.0-gamma.tar.gz) = d13dbd7d97745ecac6cf3ecc3800535faa3c08f5b9b33f214e210afd7658aae6
SIZE (torsocks-1.0-gamma.tar.gz) = 482415

View File

@ -0,0 +1,21 @@
--- src/Makefile.am.orig 2009-02-07 11:48:12.000000000 +0100
+++ src/Makefile.am 2009-02-18 17:29:26.000000000 +0100
@@ -1,7 +1,7 @@
# Makefile used by configure to create real Makefile
-LIBS = -ldl -lc -lresolv
-libdir = @prefix@/lib/torsocks
+LIBS = -lc
+libdir = @prefix@/lib
# Install helper programs
#bin_PROGRAMS = validateconf inspectsocks saveme
@@ -16,7 +16,7 @@
# Install configuration file
usewithtorconfdir = $(CONFDIR)/
-usewithtorconf_DATA = torsocks.conf
+usewithtorconf_DATA = torsocks.conf.sample
# Install invocation scripts
bin_SCRIPTS = torsocks usewithtor

View File

@ -0,0 +1,70 @@
--- configure.in.orig 2009-02-12 15:59:50.000000000 +0200
+++ configure.in 2009-02-12 17:27:16.000000000 +0200
@@ -123,11 +123,9 @@
dnl Checks for libraries.
dnl Replace `main' with a function in -ldl:
-AC_CHECK_LIB(dl, dlsym, [ tempdso="yes" ],tempdso="no")
-if test "$tempdso" = "no"; then
- AC_CHECK_LIB(c, dlsym,,AC_MSG_ERROR("dlsym() not found in libc or libdl." \
- "Check your system for libc.so and/or libdl.so."))
-fi
+dnl Checks for libraries.
+AC_CHECK_LIB(c, dlsym,,AC_MSG_ERROR(""dlsym() not found in libc." \
+ "Check your system for libc.so."))
AC_CHECK_LIB(resolv, res_query, [ tempres="no" ],tempres="yes")
if test "$tempres" = "no"; then
@@ -356,8 +354,8 @@
dnl Find the correct res_querydomain prototype on this machine
AC_MSG_CHECKING(for correct res_querydomain prototype)
PROTO=
-PROTO1='const char *name, const char *domain, int class, int type, unsigned char *answer, int anslen'
-for testproto in "${PROTO1}"
+PROTO1='const char *name, const char *domain, int class, int type, u_char *answer, int anslen'
+for PROTO in "${PROTO1}"
do
if test "${PROTO}" = ""; then
AC_TRY_COMPILE([
@@ -376,8 +374,8 @@
AC_MSG_CHECKING(for correct res_send prototype)
PROTO=
PROTO1='const char *msg, int msglen, char *answer, int anslen'
-PROTO2='const unsigned char *msg, int msglen, unsigned char *answer, int anslen'
-for testproto in "${PROTO1}" \
+PROTO2='const u_char *msg, int msglen, u_char *answer, int anslen'
+for PROTO in "${PROTO1}" \
"${PROTO2}"
do
if test "${PROTO}" = ""; then
@@ -397,8 +395,8 @@
dnl Find the correct res_search prototype on this machine
AC_MSG_CHECKING(for correct res_search prototype)
PROTO=
-PROTO1='const char *dname, int class, int type,unsigned char *answer, int anslen'
-for testproto in "${PROTO1}"
+PROTO1='const char *dname, int class, int type, u_char *answer, int anslen'
+for PROTO in "${PROTO1}"
do
if test "${PROTO}" = ""; then
AC_TRY_COMPILE([
@@ -417,8 +415,8 @@
dnl Find the correct res_query prototype on this machine
AC_MSG_CHECKING(for correct res_query prototype)
PROTO=
-PROTO1='const char *dname, int class, int type,unsigned char *answer, int anslen'
-for testproto in "${PROTO1}"
+PROTO1='const char *dname, int class, int type, u_char *answer, int anslen'
+for PROTO in "${PROTO1}"
do
if test "${PROTO}" = ""; then
AC_TRY_COMPILE([
@@ -462,7 +460,7 @@
dnl Find the correct poll prototype on this machine
AC_MSG_CHECKING(for correct poll prototype)
PROTO=
-for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout' \
+for testproto in 'struct pollfd *ufds, u_long nfds, int timeout' \
'struct pollfd *ufds, nfds_t nfds, int timeout'
do
if test "${PROTO}" = ""; then

View File

@ -0,0 +1,37 @@
--- src/torsocks.in.orig 2008-12-08 23:43:55.000000000 +0200
+++ src/torsocks.in 2009-03-01 22:31:16.263795616 +0200
@@ -72,16 +72,16 @@
on)
if [ -z "$LD_PRELOAD" ]
then
- export LD_PRELOAD="@prefix@/lib/torsocks/libtorsocks.so"
+ export LD_PRELOAD="@prefix@/lib/libtorsocks.so"
else
- echo $LD_PRELOAD | grep -q "@prefix@/lib/torsocks/libtorsocks\.so" || \
- export LD_PRELOAD="@prefix@/lib/torsocks/libtorsocks.so $LD_PRELOAD"
+ echo $LD_PRELOAD | grep -q "@prefix@/lib/libtorsocks\.so" || \
+ export LD_PRELOAD="@prefix@/lib/libtorsocks.so $LD_PRELOAD"
fi
;;
off)
#replace '/' with '\/' in @prefix@
escprefix=`echo '@prefix@' |sed 's/\\//\\\\\//g'`
- export LD_PRELOAD=`echo -n $LD_PRELOAD | sed "s/$escprefix\/lib\/torsocks\/libtorsocks.so \?//"`
+ export LD_PRELOAD=`echo -n $LD_PRELOAD | sed "s/$escprefix\/lib\/libtorsocks.so \?//"`
if [ -z "$LD_PRELOAD" ]
then
unset LD_PRELOAD
@@ -96,10 +96,10 @@
*)
if [ -z "$LD_PRELOAD" ]
then
- export LD_PRELOAD="@prefix@/lib/torsocks/libtorsocks.so"
+ export LD_PRELOAD="@prefix@/lib/libtorsocks.so"
else
- echo $LD_PRELOAD | grep -q "@prefix@/lib/torsocks/libtorsocks\.so" || \
- export LD_PRELOAD="@prefix@/lib/torsocks/libtorsocks.so $LD_PRELOAD"
+ echo $LD_PRELOAD | grep -q "@prefix@/lib/libtorsocks\.so" || \
+ export LD_PRELOAD="@prefix@/lib/libtorsocks.so $LD_PRELOAD"
fi
if [ $# = 0 ]

View File

@ -0,0 +1,11 @@
--- src/tsocks.c.orig 2009-02-12 15:59:50.000000000 +0200
+++ src/tsocks.c 2009-02-12 23:18:14.870533468 +0200
@@ -164,7 +164,7 @@
void tsocks_init(void) {
#define LOAD_ERROR(s,l) { \
- char *error; \
+ const char *error; \
error = dlerror(); \
show_msg(l, "The symbol %s() was not found in any shared " \
"library. The error reported was: %s!\n", s, \

View File

@ -0,0 +1,16 @@
--- src/usewithtor.in.orig 2009-02-12 15:59:50.000000000 +0200
+++ src/usewithtor.in 2009-02-12 19:49:41.000000000 +0200
@@ -1,3 +1,5 @@
+#!/bin/sh
+#
# ***************************************************************************
# * *
# * $Id: usewithtor.in,v 1.3 2008-07-06 15:17:35 hoganrobert Exp $*
@@ -26,7 +28,6 @@
# ***************************************************************************
-#! /bin/sh
# Wrapper script for use of the torsocks(8) transparent socksification library
# See the torsocks(1) and usewithtor(1) manpages.

View File

@ -0,0 +1,12 @@
Simple setup file was copied to %%PREFIX%%/etc/torsocks.conf.sample
An example of a more complex setup file can be found in
%%PREFIX%%/share/examples/torsocks/
Once you have installed torsocks, just launch it like so:
usewithtor [application]
So, for example you can use ssh to a some.ssh.com by doing:
usewithtor ssh username@some.ssh.com -l <user>
or launch pidgin by doing:
usewithtor pidgin

8
net/torsocks/pkg-descr Normal file
View File

@ -0,0 +1,8 @@
It is new generation of 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.
WWW: http://code.google.com/p/torsocks/

12
net/torsocks/pkg-plist Normal file
View File

@ -0,0 +1,12 @@
bin/torsocks
bin/usewithtor
etc/torsocks.conf.sample
lib/libtorsocks.a
lib/libtorsocks.la
lib/libtorsocks.so
lib/libtorsocks.so.1
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/tsocks.conf.complex.example
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/tsocks.conf.simple.example
%%PORTDOCS%%%%DOCSDIR%%/INSTALL
%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%
%%PORTDOCS%%@dirrm %%DOCSDIR%%