diff options
author | Erik Hanson <erik@slackbuilds.org> | 2010-05-12 17:44:17 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-12 17:44:17 +0200 |
commit | 10b0129f4ecd8457c9f6e62f0a3bf7b8aaf5c6cf (patch) | |
tree | 0b303d547f329f050cf77d6470730fb79213e564 /network/tor | |
parent | 482ff139b82148e05d07ede113748fdad0ff5af3 (diff) | |
download | slackbuilds-10b0129f4ecd8457c9f6e62f0a3bf7b8aaf5c6cf.tar.gz |
network/tor: Updated for version 0.2.0.35
Diffstat (limited to 'network/tor')
-rw-r--r-- | network/tor/README | 21 | ||||
-rw-r--r-- | network/tor/doinst.sh | 1 | ||||
-rw-r--r-- | network/tor/rc.tor | 75 | ||||
-rw-r--r-- | network/tor/tor.SlackBuild | 53 | ||||
-rw-r--r-- | network/tor/tor.info | 8 |
5 files changed, 108 insertions, 50 deletions
diff --git a/network/tor/README b/network/tor/README index 6340505979..962229ae97 100644 --- a/network/tor/README +++ b/network/tor/README @@ -5,4 +5,23 @@ SSH, and other applications that use the TCP protocol. Tor also provides a platform on which software developers can build new applications with built-in anonymity, safety, and privacy features. -Tor requires the libevent library which is also available from SlackBuilds.org. +This script requires a 'tor' user/group to exist before running. +The recommended UID/GID is 220. You can create these like so: + groupadd -g 220 tor + useradd -u 220 -g 220 -c "The Onion Router" -d /dev/null -s /bin/false tor + +You can pass another user/group to the script, this is however, less safe: + TOR_USER=nobody TOR_GROUP=nogroup sh tor.SlackBuild + +The following can be used to start/stop tor automatically: +/etc/rc.d/rc.local + if [ -x /etc/rc.d/rc.tor ]; then + /etc/rc.d/rc.tor start + fi + +/etc/rc.d/rc.local_shutdown + if [ -x /etc/rc.d/rc.tor ]; then + /etc/rc.d/rc.tor stop + fi + +Tor requires the libevent library, available from SlackBuilds.org. diff --git a/network/tor/doinst.sh b/network/tor/doinst.sh index 4a7f53f556..36769c85ca 100644 --- a/network/tor/doinst.sh +++ b/network/tor/doinst.sh @@ -21,3 +21,4 @@ fi config etc/rc.d/rc.tor.new config etc/tor/tor-tsocks.conf.new +config etc/tor/torrc.new diff --git a/network/tor/rc.tor b/network/tor/rc.tor index d7ef906aae..cdeb865af3 100644 --- a/network/tor/rc.tor +++ b/network/tor/rc.tor @@ -1,43 +1,42 @@ - #!/bin/sh +# +# tor The Onion Router +# +# Startup/shutdown script for tor. This is a wrapper around torctl; +# torctl does the actual work in a relatively system-independent, or at least +# distribution-independent, way, and this script deals with fitting the +# whole thing into the conventions of the particular system at hand. + +# This script is a modified contrb/tor.sh, for use on Slackware. + +TORCTL=/usr/bin/torctl -PIDFILE="/var/lib/tor/tor.pid" - -tor_start() { - echo -n "Starting tor: " - if [ ! -f $PIDFILE ]; then - /usr/bin/tor 1> /dev/null - echo "OK" - else - echo -n "Removing stale lock.. " - rm -f $PIDFILE - /usr/bin/tor 1> /dev/null - echo "OK" - fi -} - -tor_stop() { - echo -n "Stopping tor: " - if [ -f $PIDFILE ]; then - killall tor &> /dev/null - rm -f $PIDFILE - echo "OK" - else - echo "Not Running" - fi -} +# torctl will use these environment variables +TORUSER=tor +export TORUSER case "$1" in - start) - tor_start - ;; - stop) - tor_stop - ;; - restart) - tor_stop - tor_start - ;; - *) - echo "Usage: rc.tor {start|stop|restart}" + + start) + $TORCTL start + ;; + + stop) + $TORCTL stop + ;; + + restart) + $TORCTL restart + ;; + + reload) + $TORCTL reload + ;; + + status) + $TORCTL status + ;; + + *) + echo "Usage: $0 (start|stop|restart|reload|status)" esac diff --git a/network/tor/tor.SlackBuild b/network/tor/tor.SlackBuild index 576351449f..e0fe5d89b2 100644 --- a/network/tor/tor.SlackBuild +++ b/network/tor/tor.SlackBuild @@ -3,14 +3,18 @@ # Slackware build script for tor # Written by Erik Hanson erik@slackbuilds.org -set -eu - PRGNAM=tor -VERSION=0.2.0.32 +VERSION=0.2.0.35 ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +# Select tor's default user/group +TOR_USER=${TOR_USER:-tor} +TOR_UID=${TOR_UID:-220} +TOR_GROUP=${TOR_GROUP:-tor} +TOR_GID=${TOR_GID:-220} + CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM @@ -18,12 +22,34 @@ OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +bailout() { + echo " You must have a $TOR_USER user and $TOR_GROUP group to run this script. " + echo " Something like this should suffice for most systems: " + echo " # groupadd -g $TOR_GID $TOR_GROUP " + echo " # useradd -u $TOR_UID -g $TOR_GID -c \"The Onion Router\" -d /dev/null -s /bin/false $TOR_USER " + exit 1 +} + +# Bail if user and/or group isn't valid on your system +# uid=220 is suggested to avoid conflicts with other SBo packages, +# but it's your call: http://slackbuilds.org/uid_gid.txt +if ! grep -q "^$TOR_USER:" /etc/passwd; then + bailout +elif ! grep -q "^$TOR_GROUP:" /etc/group; then + bailout fi +set -eu + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP @@ -38,12 +64,27 @@ CFLAGS="$SLKCFLAGS" \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ - --mandir=/usr/man + --mandir=/usr/man \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --with-tor-user=$TOR_USER \ + --with-tor-group=$TOR_GROUP make make install-strip DESTDIR=$PKG -gzip -9 $PKG/usr/man/man?/*.? +# Create/install stuff that makes tor work (better) +mkdir -p $PKG/var/{run,log,lib}/tor +chown $TOR_USER:$TOR_GROUP $PKG/var/{run,log,lib}/tor +chmod 0700 $PKG/var/lib/tor +install -D -m 0755 $CWD/rc.tor $PKG/etc/rc.d/rc.tor.new +install -D -m 0755 contrib/torctl $PKG/usr/bin/torctl +mv $PKG/etc/tor/torrc.sample $PKG/etc/tor/torrc.new +mv $PKG/etc/tor/tor-tsocks.conf $PKG/etc/tor/tor-tsocks.conf.new + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done +) mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/spec cp -a AUTHORS ChangeLog INSTALL LICENSE README ReleaseNotes \ @@ -55,8 +96,6 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install $PKG/etc/rc.d cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh -cat $CWD/rc.tor > $PKG/etc/rc.d/rc.tor.new -mv $PKG/etc/tor/tor-tsocks.conf $PKG/etc/tor/tor-tsocks.conf.new cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/tor/tor.info b/network/tor/tor.info index eace537475..eb6960b786 100644 --- a/network/tor/tor.info +++ b/network/tor/tor.info @@ -1,8 +1,8 @@ PRGNAM="tor" -VERSION="0.2.0.32" +VERSION="0.2.0.35" HOMEPAGE="http://tor.eff.org/" -DOWNLOAD="http://www.torproject.org/dist/tor-0.2.0.32.tar.gz" -MD5SUM="fd55489f7ad1ef53c0b0dac857696fc9" +DOWNLOAD="http://www.torproject.org/dist/tor-0.2.0.35.tar.gz" +MD5SUM="d4841e1b4d54866495fd373e865b2d44" MAINTAINER="Erik Hanson" EMAIL="erik@slackbuilds.org" -APPROVED="dsomero"
\ No newline at end of file +APPROVED="rworkman" |