Date: Wed, 15 Feb 2006 05:20:09 GMT From: Peter Thoenen <peter.thoenen@yahoo.com> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/93314: security/tor-devel Message-ID: <200602150520.k1F5K9V2096299@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/93314; it has been noted by GNATS. From: Peter Thoenen <peter.thoenen@yahoo.com> To: bug-followup@FreeBSD.org Cc: Subject: Re: ports/93314: security/tor-devel Date: Tue, 14 Feb 2006 21:17:00 -0800 (PST) --0-1122628208-1139980620=:96936 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline Had the night off and motivated myself enough to write the rc.subr script finally. Attached is a new unified diff .. ignore the previous one. --0-1122628208-1139980620=:96936 Content-Type: text/plain; name="tor-devel.diff.txt" Content-Description: 3310809015-tor-devel.diff.txt Content-Disposition: inline; filename="tor-devel.diff.txt" diff -ruN tor-devel.orig/Makefile tor-devel/Makefile --- tor-devel.orig/Makefile Sat Feb 11 11:09:25 2006 +++ tor-devel/Makefile Tue Feb 14 15:33:30 2006 @@ -1,18 +1,18 @@ # ports collection makefile for: tor-devel # Date created: 2005.10.20 -# Whom: eol1@yahoo.com +# Whom: peter.thoenen@yahoo.com # # $FreeBSD: ports/security/tor-devel/Makefile,v 1.22 2006/01/16 00:13:31 pav Exp $ # PORTNAME= tor -PORTVERSION= 0.1.1.12 +PORTVERSION= 0.1.1.13 CATEGORIES= security net MASTER_SITES= http://tor.eff.org/dist/ PKGNAMESUFFIX= -devel DISTNAME= ${PORTNAME}-${PORTVERSION}-alpha -MAINTAINER= eol1@yahoo.com +MAINTAINER= peter.thoenen@yahoo.com COMMENT= An anonymizing overlay network for TCP RUN_DEPENDS= tsocks:${PORTSDIR}/net/tsocks @@ -20,32 +20,31 @@ GNU_CONFIGURE= yes USE_OPENSSL= yes -USE_REINPLACE= yes -USE_RC_SUBR= yes CONFLICTS= tor-[0-9]* MANCOMPRESSED= no MAN1= tor.1 tor-resolve.1 torify.1 +USE_RC_SUBR+= tor + post-patch: + @${SED} -e "s|%%PREFIX%%|${PREFIX}|g" \ + ${FILESDIR}/pkg-message.in > ${PKGMESSAGE} @${MV} ${WRKSRC}/contrib/tor-tsocks.conf \ ${WRKSRC}/contrib/tor-tsocks.conf.sample @${REINPLACE_CMD} -e "s|tor-tsocks.conf|tor-tsocks.conf.sample|g" \ ${WRKSRC}/contrib/Makefile.in - @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \ - ${WRKSRC}/contrib/torctl.in @${FIND} ${WRKSRC} -type f | ${XARGS} \ -n 10 ${REINPLACE_CMD} -E \ -e 's!-g -O2!!' \ -e 's!-O2!!' pre-install: - PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} PRE-INSTALL post-install: - ${INSTALL_SCRIPT} ${WRKSRC}/contrib/tor.sh ${PREFIX}/etc/rc.d/tor.sh - ${INSTALL_SCRIPT} ${WRKSRC}/contrib/torctl ${PREFIX}/bin/torctl @${MKDIR} /var/run/tor @${CHOWN} _tor:_tor /var/run/tor @${TOUCH} /var/log/tor diff -ruN tor-devel.orig/distinfo tor-devel/distinfo --- tor-devel.orig/distinfo Sat Feb 11 11:09:25 2006 +++ tor-devel/distinfo Sat Feb 11 11:10:26 2006 @@ -1,3 +1,3 @@ -MD5 (tor-0.1.1.12-alpha.tar.gz) = 64439b11f18462bc0a9599940899240e -SHA256 (tor-0.1.1.12-alpha.tar.gz) = 125bfd5b3f6979ee02dca0fa8372f80bbf6e4907a569e890105fe3405dc03a95 -SIZE (tor-0.1.1.12-alpha.tar.gz) = 751711 +MD5 (tor-0.1.1.13-alpha.tar.gz) = 5cdf6c5ed20efd7048ee1257cbcc1b4e +SHA256 (tor-0.1.1.13-alpha.tar.gz) = cb15a83ed8ad87d67c0685b20a41096c32211f20ae321f39ed110d7ace38e29f +SIZE (tor-0.1.1.13-alpha.tar.gz) = 756583 diff -ruN tor-devel.orig/files/patch-contrib-tor.sh.in tor-devel/files/patch-contrib-tor.sh.in --- tor-devel.orig/files/patch-contrib-tor.sh.in Sat Feb 11 11:09:25 2006 +++ tor-devel/files/patch-contrib-tor.sh.in Thu Jan 1 03:00:00 1970 @@ -1,85 +0,0 @@ ---- contrib/tor.sh.in.orig Mon Dec 26 04:28:12 2005 -+++ contrib/tor.sh.in Thu Jan 12 06:25:02 2006 -@@ -9,26 +9,26 @@ - # This particular script is written for Red Hat/Fedora Linux, and may - # also work on Mandrake, but not SuSE. - # --# These next couple of lines "declare" tor for the "chkconfig" program, --# originally from SGI, used on Red Hat/Fedora and probably elsewhere. --# --# chkconfig: 2345 90 10 - # description: Onion Router - A low-latency anonymous proxy - # -+# -+# Add some of the following variables to /etc/rc.conf to configure stunnel: -+# tor_enable (bool): Default "NO" -+# Set it to "YES" to enable stunnel. -+# tor_user (str): Default "_tor" -+# Set it to the tor user -+# tor_group (str): Default "_tor" -+# Set it to the tor group -+# - --# Library functions --if [ -f /etc/rc.d/init.d/functions ]; then -- . /etc/rc.d/init.d/functions --elif [ -f /etc/init.d/functions ]; then -- . /etc/init.d/functions --fi -+tor_enable=${tor_enable-"NO"} - --TORCTL=@BINDIR@/torctl -+TORCTL=%%PREFIX%%/bin/torctl - - # torctl will use these environment variables --TORUSER=@TORUSER@ -+TORUSER=${tor_user-"_tor"} - export TORUSER --TORGROUP=@TORGROUP@ -+TORGROUP=${tor_group-"_tor"} - export TORGROUP - - if [ -x /bin/su ] ; then -@@ -46,28 +46,32 @@ - case "$1" in - - start) -- action $"Starting tor:" $TORCTL start -- RETVAL=$? -+ echo "Starting tor:" -+ $TORCTL start -+ RETVAL=$? - ;; - - stop) -- action $"Stopping tor:" $TORCTL stop -- RETVAL=$? -+ echo "Stopping tor:" -+ $TORCTL stop -+ RETVAL=$? - ;; - - restart) -- action $"Restarting tor:" $TORCTL restart -- RETVAL=$? -+ echo "Restarting tor:" -+ $TORCTL restart -+ RETVAL=$? - ;; - - reload) -- action $"Reloading tor:" $TORCTL reload -- RETVAL=$? -+ echo "Reloading tor:" -+ $TORCTL reload -+ RETVAL=$? - ;; - - status) -- $TORCTL status -- RETVAL=$? -+ $TORCTL status -+ RETVAL=$? - ;; - - *) diff -ruN tor-devel.orig/files/patch-contrib-torctl.in tor-devel/files/patch-contrib-torctl.in --- tor-devel.orig/files/patch-contrib-torctl.in Sat Feb 11 11:09:25 2006 +++ tor-devel/files/patch-contrib-torctl.in Thu Jan 1 03:00:00 1970 @@ -1,39 +0,0 @@ ---- contrib/torctl.in.orig Mon Dec 26 04:28:12 2005 -+++ contrib/torctl.in Fri Jan 13 09:12:42 2006 -@@ -24,20 +24,20 @@ - EXEC=tor - # - # the path to your binary, including options if necessary --TORBIN="@BINDIR@/$EXEC" -+TORBIN="/usr/local/bin/$EXEC" - # - # the path to the configuration file --TORCONF="@CONFDIR@/torrc" -+TORCONF="/usr/local/etc/tor/torrc" - # - # the path to your PID file --PIDFILE="@LOCALSTATEDIR@/run/tor/tor.pid" -+PIDFILE="/var/run/tor/tor.pid" - # - # The path to the log file --LOGFILE="@LOCALSTATEDIR@/log/tor/tor.log" -+LOGFILE="/var/log/tor" - # - # The path to the datadirectory --TORDATA="@LOCALSTATEDIR@/lib/tor" - # -+TORDATA="/var/db/tor/data" - TORARGS="--pidfile $PIDFILE --log \"notice file $LOGFILE\" --runasdaemon 1" - TORARGS="$TORARGS --datadirectory $TORDATA" - -@@ -47,8 +47,8 @@ - # let an unprivileged user run tor for her own use using this script, - # while still providing for it to be used as a system daemon. - if [ "x`id -u`" = "x0" ]; then -- TORUSER=@TORUSER@ -- TORGROUP=@TORGROUP@ -+ TORUSER="_tor" -+ TORGROUP="_tor" - fi - - if [ "x$TORUSER" != "x" ]; then diff -ruN tor-devel.orig/files/pkg-message.in tor-devel/files/pkg-message.in --- tor-devel.orig/files/pkg-message.in Thu Jan 1 03:00:00 1970 +++ tor-devel/files/pkg-message.in Tue Feb 14 14:33:23 2006 @@ -0,0 +1,5 @@ +===================================================================================== +Tor has been converted to used rc.subr. To enable the tor server, set +tor_enable="YES" in your /etc/rc.conf and edit %%PREFIX%%/etc/tor/torrc +===================================================================================== + diff -ruN tor-devel.orig/files/tor.in tor-devel/files/tor.in --- tor-devel.orig/files/tor.in Thu Jan 1 03:00:00 1970 +++ tor-devel/files/tor.in Tue Feb 14 15:11:17 2006 @@ -0,0 +1,50 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# The Onion Router (Tor) +# +# Description: Tor is a connection-based low-latency anonymous communication +# system which addresses many of the flaws in the orginal onion +# routing design. + +# REQUIRE: NETWORKING SERVERS USR +# BEFORE: LOGIN +# KEYWORD: FreeBSD + +# Add the following lines to /etc/rc.conf to enable tor +# tor_enable (bool): Set to "NO" by default +# Set it to "YES" to enable tor +# tor_conf (str): Points to your tor conf file +# Default: %%PREFIX%%/etc/tor/torrc +# tor_user (str): Tor Daemon user. Default _tor + +. /etc/rc.subr + +name="tor" +rcvar=`set_rcvar` + +[ -z "${tor_enable}" ] && tor_enable="NO" +[ -z "${tor_conf}" ] && tor_conf="%%PREFIX%%/etc/tor/torrc" +[ -z "${tor_user}" ] && tor_user="_tor" +[ -z "${tor_group}" ] && tor_group="_tor" + +command="%%PREFIX%%/bin/${name}" +extra_commands="log" +log_cmd="${name}_log" +pidfile="/var/run/tor/tor.pid" +logfile="/var/log/tor" +datadir="/var/run/tor" +command_args="-f ${tor_conf} --pidfile ${pidfile} --runasdaemon 1 --datadirectory ${datadir} --user ${tor_user} --group ${tor_group}" + +load_rc_config $name + +required_files=${tor_conf} +required_dirs=${datadir} + +tor_log() { + cat ${logfile} +} + +run_rc_command "$1" + diff -ruN tor-devel.orig/pkg-deinstall tor-devel/pkg-deinstall --- tor-devel.orig/pkg-deinstall Thu Jan 1 03:00:00 1970 +++ tor-devel/pkg-deinstall Wed Feb 15 00:52:06 2006 @@ -0,0 +1,62 @@ +#! /bin/sh +# +# taken from net/cvsup-mirror + +PATH=/bin:/usr/sbin + +TOR_USER=${TOR_USER:-_tor} +TOR_GROUP=${TOR_GROUP:-_tor} + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +delete_account() { + local u g home + + u=$1 + g=$2 + if yesno "Do you want me to remove group \"${g}\"" y; then + pw groupdel -n ${g} + echo "Done." + fi + if yesno "Do you want me to remove user \"${u}\"" y; then + eval home=~${u} + pw userdel -n ${u} + echo "Done." + if [ -d "${home}" ]; then + echo "Please remember to remove the home directory \"${home}\"" + fi + fi +} + +if [ x$2 != xDEINSTALL ]; then + exit +fi + +delete_account ${TOR_USER} ${TOR_GROUP} diff -ruN tor-devel.orig/pkg-descr tor-devel/pkg-descr --- tor-devel.orig/pkg-descr Sat Feb 11 11:09:25 2006 +++ tor-devel/pkg-descr Tue Feb 14 14:36:10 2006 @@ -14,5 +14,3 @@ NETWORK FOR ANONYMITY! WWW: http://tor.eff.org/ -- rik -freebsd-ports@rikrose.net diff -ruN tor-devel.orig/pkg-install tor-devel/pkg-install --- tor-devel.orig/pkg-install Sat Feb 11 11:09:25 2006 +++ tor-devel/pkg-install Wed Feb 15 00:51:40 2006 @@ -1,35 +1,40 @@ -#!/bin/sh +#! /bin/sh +# +# taken from devel/perforce -if [ x"$2" = xPRE-INSTALL ]; then - USER="_tor" - UID="256" - GROUP="_tor" - GID="256" - - if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if /usr/sbin/pw groupadd ${GROUP} -g ${GID}; then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi - - if /usr/sbin/pw user show "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." - else - if /usr/sbin/pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d /var/db/tor \ - -s /bin/sh \ - -c "Tor anonymising router"; then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi -fi +PATH=/bin:/usr/sbin + +TOR_USER=${TOR_USER:-_tor} +TOR_GROUP=${TOR_GROUP:-_tor} + +case $2 in +PRE-INSTALL) + USER=${TOR_USER} + GROUP=${TOR_GROUP} + + if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." + else + if pw groupadd ${GROUP} ; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." + else + if pw useradd ${USER} -g ${GROUP} -h - \ + -d /nonexistent -c "Tor Daemon" -s /bin/sh + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi + fi + + ;; +esac diff -ruN tor-devel.orig/pkg-message tor-devel/pkg-message --- tor-devel.orig/pkg-message Sat Feb 11 11:09:25 2006 +++ tor-devel/pkg-message Thu Jan 1 03:00:00 1970 @@ -1,7 +0,0 @@ - -*********************** WARNING! WARNING! WARNING! *********************** -The tor startup script has been converted to rc_subr format now. You -have to set at least the tor_enable variable if you want tor to be started -automatically at boot time! -************************************************************************** - diff -ruN tor-devel.orig/pkg-plist tor-devel/pkg-plist --- tor-devel.orig/pkg-plist Sat Feb 11 11:09:25 2006 +++ tor-devel/pkg-plist Wed Feb 15 08:08:12 2006 @@ -1,6 +1,5 @@ bin/tor bin/tor-resolve -bin/torctl bin/torify etc/rc.d/tor.sh etc/tor/tor-tsocks.conf.sample --0-1122628208-1139980620=:96936--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602150520.k1F5K9V2096299>