pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/torsocks torsocks: Import torsocks-2.2.0 as net/to...
details: https://anonhg.NetBSD.org/pkgsrc/rev/5a24677683d2
branches: trunk
changeset: 376178:5a24677683d2
user: leot <leot%pkgsrc.org@localhost>
date: Mon Feb 26 13:19:55 2018 +0000
description:
torsocks: Import torsocks-2.2.0 as net/torsocks
Torsocks allows you to use most applications in a safe way with
Tor. It ensures that DNS requests are handled safely and explicitly
rejects any traffic other then TCP from the application you're
using.
Torsocks is an ELF shared library that is loaded before all others.
The library overrides every needed Internet communication libc
function calls such as connect(2) or gethostbyname(3).
This process is transparent to the user and if torsocks detects
any communication that can't go through the Tor network such as
UDP traffic for instance, the connection is denied. If, in some
way, there is no way for torsocks to provide the Tor anonymity
guarantee with your application, torsocks will force the application
to quit and stop everything.
Originally packaged in pkgsrc-wip by <wiz>, with some improvements by Ben
Gergely and further updates and improvements by myself.
diffstat:
net/torsocks/DESCR | 15 ++
net/torsocks/Makefile | 58 ++++++++++
net/torsocks/PLIST | 7 +
net/torsocks/distinfo | 7 +
net/torsocks/patches/patch-src_bin_torsocks.in | 133 +++++++++++++++++++++++++
5 files changed, 220 insertions(+), 0 deletions(-)
diffs (240 lines):
diff -r 0de4f25d7e66 -r 5a24677683d2 net/torsocks/DESCR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/torsocks/DESCR Mon Feb 26 13:19:55 2018 +0000
@@ -0,0 +1,15 @@
+Torsocks allows you to use most applications in a safe way with
+Tor. It ensures that DNS requests are handled safely and explicitly
+rejects any traffic other then TCP from the application you're
+using.
+
+Torsocks is an ELF shared library that is loaded before all others.
+The library overrides every needed Internet communication libc
+function calls such as connect(2) or gethostbyname(3).
+
+This process is transparent to the user and if torsocks detects
+any communication that can't go through the Tor network such as
+UDP traffic for instance, the connection is denied. If, in some
+way, there is no way for torsocks to provide the Tor anonymity
+guarantee with your application, torsocks will force the application
+to quit and stop everything.
diff -r 0de4f25d7e66 -r 5a24677683d2 net/torsocks/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/torsocks/Makefile Mon Feb 26 13:19:55 2018 +0000
@@ -0,0 +1,58 @@
+# $NetBSD: Makefile,v 1.1 2018/02/26 13:19:55 leot Exp $
+
+DISTNAME= torsocks_2.2.0.orig
+PKGNAME= ${DISTNAME:S/_/-/:S/.orig//}
+CATEGORIES= net
+MASTER_SITES= ${MASTER_SITE_DEBIAN:=pool/main/t/torsocks/}
+EXTRACT_SUFX= .tar.xz
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= https://gitweb.torproject.org/torsocks.git
+COMMENT= Library to torify applications
+LICENSE= gnu-gpl-v2
+
+WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
+
+GNU_CONFIGURE= yes
+USE_LIBTOOL= yes
+
+CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
+CONFIGURE_ARGS+= --with-conf=${PKG_SYSCONFDIR}/torsocks.conf
+
+EGDIR= ${PREFIX}/share/examples/torsocks
+CONF_FILES= ${EGDIR}/torsocks.conf \
+ ${PKG_SYSCONFDIR}/torsocks.conf
+
+SUBST_CLASSES+= configure
+SUBST_STAGE.configure= pre-configure
+SUBST_MESSAGE.configure= Fixing non-standard test(1) == operator
+SUBST_FILES.configure= configure
+SUBST_SED.configure= -e '/test/ s/ == / = /g'
+
+SUBST_CLASSES+= confdir
+SUBST_STAGE.confdir= pre-configure
+SUBST_MESSAGE.confdir= Adjusting confdir
+SUBST_FILES.confdir= doc/Makefile.in
+SUBST_SED.confdir= -e '/^confdir/ s;/tor;;'
+
+SUBST_CLASSES+= conffile
+SUBST_STAGE.conffile= pre-configure
+SUBST_MESSAGE.conffile= Adjusting DEFAULT_CONF_FILE
+SUBST_FILES.conffile= src/common/defaults.h
+SUBST_SED.conffile= -e '/DEFAULT_CONF_FILE/ s;"/tor/";"/";'
+
+SUBST_CLASSES+= man
+SUBST_STAGE.man= pre-configure
+SUBST_MESSAGE.man= Fix hardcoded paths in man pages
+SUBST_FILES.man= doc/torsocks.1 doc/torsocks.8 doc/torsocks.conf.5
+SUBST_SED.man= -e 's;/etc/tor;${PKG_SYSCONFDIR};g'
+
+TEST_TARGET= check
+
+post-install:
+ ${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR}
+ cd ${DESTDIR}${PREFIX} && ${RM} -fr share/doc
+ ${MV} ${DESTDIR}${PKG_SYSCONFDIR}/torsocks.conf \
+ ${DESTDIR}${EGDIR}/torsocks.conf
+
+.include "../../mk/bsd.pkg.mk"
diff -r 0de4f25d7e66 -r 5a24677683d2 net/torsocks/PLIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/torsocks/PLIST Mon Feb 26 13:19:55 2018 +0000
@@ -0,0 +1,7 @@
+@comment $NetBSD: PLIST,v 1.1 2018/02/26 13:19:55 leot Exp $
+bin/torsocks
+lib/torsocks/libtorsocks.la
+man/man1/torsocks.1
+man/man5/torsocks.conf.5
+man/man8/torsocks.8
+share/examples/torsocks/torsocks.conf
diff -r 0de4f25d7e66 -r 5a24677683d2 net/torsocks/distinfo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/torsocks/distinfo Mon Feb 26 13:19:55 2018 +0000
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1 2018/02/26 13:19:55 leot Exp $
+
+SHA1 (torsocks_2.2.0.orig.tar.xz) = 53d8cb45b487571d39ab226e25cb538976a195a1
+RMD160 (torsocks_2.2.0.orig.tar.xz) = a16adc2120da9c846d4801ece60a43758a25f2e6
+SHA512 (torsocks_2.2.0.orig.tar.xz) = 89eb1263bfb0079ca5cb7fcc3a6fa1ecde1327df9ea98de48babfff1f8947b1e9db8407ead747fef0190671e7fff502025dcfcd9b6cba97abbaf25b5a575c62a
+Size (torsocks_2.2.0.orig.tar.xz) = 309916 bytes
+SHA1 (patch-src_bin_torsocks.in) = 724a4a3f1e72347907c887d4a00a9308beeb2803
diff -r 0de4f25d7e66 -r 5a24677683d2 net/torsocks/patches/patch-src_bin_torsocks.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/torsocks/patches/patch-src_bin_torsocks.in Mon Feb 26 13:19:55 2018 +0000
@@ -0,0 +1,133 @@
+$NetBSD: patch-src_bin_torsocks.in,v 1.1 2018/02/26 13:19:56 leot Exp $
+
+- Add missing quotes to variables in torsocks.in.
+ From upstream commit 5a5b72fa0aef2315c369cedc5f448ee473be5e4f.
+- Discard stderr when invoking getcap(1).
+ Not all platforms support it.
+ Also present in upstream commit 6228eabd72eda576403bf6f199881a6d39c1148e.
+
+--- src/bin/torsocks.in.orig 2018-01-30 12:14:16.600824876 +0000
++++ src/bin/torsocks.in
+@@ -73,7 +73,7 @@ set_ld_preload ()
+ if [ -z "$@LDPRELOAD@" ]; then
+ export @LDPRELOAD@="${SHLIB}"
+ else
+- echo $@LDPRELOAD@ | grep -q "${SHLIB}" || \
++ echo "$@LDPRELOAD@" | grep -q "${SHLIB}" || \
+ export @LDPRELOAD@="${SHLIB} $@LDPRELOAD@"
+ fi
+
+@@ -130,13 +130,13 @@ tor_shell ()
+
+ torify_app ()
+ {
+- local app_path=`which $1`
+- local getcap=`PATH="$PATH:/usr/sbin:/sbin" which getcap`
++ local app_path="`which $1`"
++ local getcap="`PATH="$PATH:/usr/sbin:/sbin" which getcap`"
+ local caps=
+
+- if [ -z $1 ]; then
++ if [ -z "$1" ]; then
+ echo "Please provide an application to torify." >&2
+- elif [ -z $app_path ]; then
++ elif [ -z "$app_path" ]; then
+ echo "ERROR: $1 cannot be found." >&2
+ exit 1
+ fi
+@@ -144,20 +144,20 @@ torify_app ()
+ # This must be before torifying because getcap uses cap_get_file(3)
+ # via syscall(2) which breaks torsocks.
+ if [ -n "$getcap" ]; then
+- caps=`$getcap $app_path`
++ caps="`$getcap $app_path 2>/dev/null`"
+ fi
+
+ # Check if Apple's System Integrity Protection is enabled if the user is
+ # running on macOS.
+- macos_sip_check $app_path
++ macos_sip_check "$app_path"
+
+ # NEVER remove that line or else nothing it torified.
+ set_ld_preload
+
+- if [ -u $app_path ]; then
++ if [ -u "$app_path" ]; then
+ echo "ERROR: $1 is setuid. torsocks will not work on a setuid executable." >&2
+ exit 1
+- elif [ -g $app_path ]; then
++ elif [ -g "$app_path" ]; then
+ echo "ERROR: $1 is setgid. torsocks will not work on a setgid executable." >&2
+ exit 1
+ elif [ -n "$caps" ]; then
+@@ -219,7 +219,7 @@ if [ $# -eq 0 ] ; then
+ fi
+
+ # Ensure libtorsocks exists,
+-if [ ! -f $SHLIB ]; then
++if [ ! -f "$SHLIB" ]; then
+ echo "$0: $SHLIB does not exist! Try re-installing torsocks."
+ exit
+ fi
+@@ -228,14 +228,14 @@ while true;
+ do
+ case "$1" in
+ on)
+- check_script_sourced $1
++ check_script_sourced "$1"
+ set_ld_preload
+ echo "Tor mode activated. Every command will be torified for this shell."
+ break
+ ;;
+ off)
+- check_script_sourced $1
+- export @LDPRELOAD@=`echo -n $@LDPRELOAD@ | sed "s#$SHLIB *##"`
++ check_script_sourced "$1"
++ export @LDPRELOAD@="`echo -n $@LDPRELOAD@ | sed "s#$SHLIB *##"`"
+ if [ -z "$@LDPRELOAD@" ]; then
+ unset @LDPRELOAD@
+ case "$OSTYPE" in
+@@ -256,35 +256,35 @@ do
+ break
+ ;;
+ -u|--user)
+- if [ -z $2 ]; then
++ if [ -z "$2" ]; then
+ echo "Missing username to -u" >&2
+ exit 1
+ fi
+- export TORSOCKS_USERNAME=$2
++ export TORSOCKS_USERNAME="$2"
+ shift
+ ;;
+ -p|--pass)
+- if [ -z $2 ]; then
++ if [ -z "$2" ]; then
+ echo "Missing password to -p" >&2
+ exit 1
+ fi
+- export TORSOCKS_PASSWORD=$2
++ export TORSOCKS_PASSWORD="$2"
+ shift
+ ;;
+ -a|--address)
+- if [ -z $2 ]; then
++ if [ -z "$2" ]; then
+ echo "Missing address to -a" >&2
+ exit 1
+ fi
+- export TORSOCKS_TOR_ADDRESS=$2
++ export TORSOCKS_TOR_ADDRESS="$2"
+ shift
+ ;;
+ -P|--port)
+- if [ -z $2 ]; then
++ if [ -z "$2" ]; then
+ echo "Missing port to -P" >&2
+ exit 1
+ fi
+- export TORSOCKS_TOR_PORT=$2
++ export TORSOCKS_TOR_PORT="$2"
+ shift
+ ;;
+ -i|--isolate)
Home |
Main Index |
Thread Index |
Old Index