[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [torsocks/master] Prevent execution of suid/sgid programs by torsocks
Author: Robert Hogan <robert@xxxxxxxxxxxxxxx>
Date: Sun, 2 Jan 2011 13:46:39 +0000
Subject: Prevent execution of suid/sgid programs by torsocks
Commit: 5875e3afc294a6e92dc4b66986387b9fa3e62dfe
We already do this in usewithtor. Closes off
http://code.google.com/p/torsocks/issues/detail?id=5
---
src/torsocks.in | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/torsocks.in b/src/torsocks.in
index d4e4f17..075a5e4 100755
--- a/src/torsocks.in
+++ b/src/torsocks.in
@@ -63,6 +63,11 @@
# Tamas Szerb <toma@xxxxxxxxx>
# Modified by Robert Hogan <robert@xxxxxxxxxxxxxxx> April 16th 2006
+set_id () {
+ echo "ERROR: $1 is set${2}id. torsocks will not work on a set${2}id executable." >&2
+ exit 1
+}
+
if [ $# = 0 ] ; then
echo "$0: insufficient arguments"
exit
@@ -122,6 +127,11 @@ case "$1" in
if [ $# -gt 0 ]
then
+ if [ -u `which "$1"` ]; then
+ set_id $1 u
+ elif [ -g `which "$1"` ]; then
+ set_id $1 g
+ fi
exec "$@"
fi
;;
--
1.7.1