aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjohans <johans@FreeBSD.org>2006-08-03 17:49:00 +0800
committerjohans <johans@FreeBSD.org>2006-08-03 17:49:00 +0800
commit2aaa0239a3e18d4642aa692f5b6c5703d00dc3a4 (patch)
tree0bd3bcd3b2af7fab539413ad9089b0d2df85f445
parent8a1722ad1b0f0223be8076a12e6be5837fcb127b (diff)
downloadfreebsd-ports-gnome-2aaa0239a3e18d4642aa692f5b6c5703d00dc3a4.tar.gz
freebsd-ports-gnome-2aaa0239a3e18d4642aa692f5b6c5703d00dc3a4.tar.zst
freebsd-ports-gnome-2aaa0239a3e18d4642aa692f5b6c5703d00dc3a4.zip
- Update tor to 1.1.20 (former development branch)
- Submitter becomes new maintainer (approved by old maintainer) - Use rc.subr PR: 98373 Submitted by: Peter Thoenen Approved by: flz (mentor)
-rw-r--r--security/tor/Makefile26
-rw-r--r--security/tor/distinfo6
-rw-r--r--security/tor/files/patch-contrib-tor.sh.in28
-rw-r--r--security/tor/files/pkg-message.in5
-rw-r--r--security/tor/files/tor.in49
-rw-r--r--security/tor/pkg-deinstall62
-rw-r--r--security/tor/pkg-descr5
-rw-r--r--security/tor/pkg-install57
-rw-r--r--security/tor/pkg-plist6
9 files changed, 170 insertions, 74 deletions
diff --git a/security/tor/Makefile b/security/tor/Makefile
index e4bd3922b992..f202440489f7 100644
--- a/security/tor/Makefile
+++ b/security/tor/Makefile
@@ -1,17 +1,17 @@
-# ports collection makefile for: tor
-# Date created: 2004.05.28
-# Whom: freebsd-ports@rikrose.net
+# ports collection makefile for: tor-devel
+# Date created: 2005.10.20
+# Whom: peter.thoenen@yahoo.com
#
# $FreeBSD$
#
PORTNAME= tor
-PORTVERSION= 0.1.0.17
+PORTVERSION= 0.1.1.20
CATEGORIES= security net
MASTER_SITES= http://tor.eff.org/dist/ \
- http://mirror.onionland.org/dist/
+ http://mirror.onionland.org/dist/
-MAINTAINER= freebsd-ports@rikrose.net
+MAINTAINER= peter.thoenen@yahoo.com
COMMENT= An anonymizing overlay network for TCP
RUN_DEPENDS= tsocks:${PORTSDIR}/net/tsocks
@@ -20,6 +20,9 @@ LIB_DEPENDS= event-1.2:${PORTSDIR}/devel/libevent
GNU_CONFIGURE= yes
USE_OPENSSL= yes
+USE_RC_SUBR= tor
+SUB_FILES= pkg-message
+
MANCOMPRESSED= no
MAN1= tor.1 tor-resolve.1 torify.1
@@ -28,16 +31,21 @@ post-patch:
${WRKSRC}/contrib/tor-tsocks.conf.sample
@${REINPLACE_CMD} -e "s|tor-tsocks.conf|tor-tsocks.conf.sample|g" \
${WRKSRC}/contrib/Makefile.in
-# uphold CFLAGS
@${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_DATA} ${WRKSRC}/contrib/tor.sh ${PREFIX}/etc/rc.d/tor.sh.sample
+ @${TOUCH} /var/log/tor
+ @${CHOWN} _tor:_tor /var/log/tor
+ @${MKDIR} /var/db/tor
+ @${MKDIR} /var/db/tor/data
+ @${CHOWN} _tor:_tor /var/db/tor
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/security/tor/distinfo b/security/tor/distinfo
index a5f01c60eace..998c80895a6b 100644
--- a/security/tor/distinfo
+++ b/security/tor/distinfo
@@ -1,3 +1,3 @@
-MD5 (tor-0.1.0.17.tar.gz) = 83c4afe29fa82473afcb2ec7e17771b9
-SHA256 (tor-0.1.0.17.tar.gz) = 33dc70a8d8f4ad20a9c9b8d476d431c713d8d94f1859b3efbaf1e178b36c2ca3
-SIZE (tor-0.1.0.17.tar.gz) = 634144
+MD5 (tor-0.1.1.20.tar.gz) = 51aac1749ff2549e8f3e1a172dc66992
+SHA256 (tor-0.1.1.20.tar.gz) = b251fd9079a40345beb5b67bcdf30c3292ee9220d2d062d583b89f3526015138
+SIZE (tor-0.1.1.20.tar.gz) = 828833
diff --git a/security/tor/files/patch-contrib-tor.sh.in b/security/tor/files/patch-contrib-tor.sh.in
index c271ee2e4d54..e69de29bb2d1 100644
--- a/security/tor/files/patch-contrib-tor.sh.in
+++ b/security/tor/files/patch-contrib-tor.sh.in
@@ -1,28 +0,0 @@
---- contrib/tor.sh.in.orig Sun Jun 5 15:44:43 2005
-+++ contrib/tor.sh.in Fri Sep 2 13:25:51 2005
-@@ -5,12 +5,12 @@
- # chkconfig: 2345 90 10
- # description: Onion Router
-
--TORUSER=
--TORGROUP=
-+TORUSER=_tor
-+TORGROUP=_tor
- TORBIN=@BINDIR@/tor
- TORPID=@LOCALSTATEDIR@/run/tor/tor.pid
--TORLOG=@LOCALSTATEDIR@/log/tor/tor.log
--TORDATA=@LOCALSTATEDIR@/lib/tor
-+TORLOG=/var/log/tor.log
-+TORDATA=/var/db/tor/data
-
- TORCONF=@CONFDIR@/torrc
- # Strictly speaking, we don't need to su if we have --user and --group.
-@@ -48,7 +48,7 @@
- if [ "x$TORUSER" = "x" ]; then
- $TORBIN -f $TORCONF $TORARGS
- else
-- $SUPROG -c "$TORBIN -f $TORCONF $TORARGS" $TORUSER
-+ $SUPROG $TORUSER -c "$TORBIN -f $TORCONF $TORARGS"
- fi
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
diff --git a/security/tor/files/pkg-message.in b/security/tor/files/pkg-message.in
new file mode 100644
index 000000000000..872f6f0b198c
--- /dev/null
+++ b/security/tor/files/pkg-message.in
@@ -0,0 +1,5 @@
+================================================================================
+To enable the tor server, set tor_enable="YES" in your /etc/rc.conf
+and edit %%PREFIX%%/etc/tor/torrc. Also note that the rc.subr script overrides
+many torrc options and is tunable. See %%PREFIX%%/etc/rc.d/tor.sh for details
+================================================================================
diff --git a/security/tor/files/tor.in b/security/tor/files/tor.in
new file mode 100644
index 000000000000..e99b5c126733
--- /dev/null
+++ b/security/tor/files/tor.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: tor
+# REQUIRE: NETWORKING SERVERS USR
+# BEFORE: LOGIN
+#
+# 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
+# tor_group (str): Tor Daemon group. Default _tor
+# tor_datadir (str): Tor DataDir. Defaults /var/db/tor
+# This will overide your torrc as it is
+# a command line option.
+#
+
+. %%RC_SUBR%%
+
+name="tor"
+rcvar=${name}_enable
+
+load_rc_config ${name}
+
+: ${tor_enable="NO"}
+: ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
+: ${tor_user="_tor"}
+: ${tor_group="_tor"}
+: ${tor_pidfile="/var/run/tor/tor.pid"}
+: ${tor_logfile="/var/log/tor"}
+: ${tor_datadir="/var/db/tor"}
+
+required_files=${tor_conf}
+required_dirs=${tor_datadir}
+command="%%PREFIX%%/bin/${name}"
+command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user} --group ${tor_group}"
+extra_commands="log"
+log_cmd="${name}_log"
+
+tor_log() {
+ cat ${tor_logfile}
+}
+
+run_rc_command "$1"
+
diff --git a/security/tor/pkg-deinstall b/security/tor/pkg-deinstall
new file mode 100644
index 000000000000..dc7222645375
--- /dev/null
+++ b/security/tor/pkg-deinstall
@@ -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 --git a/security/tor/pkg-descr b/security/tor/pkg-descr
index 459d213bead8..1435eed8c86a 100644
--- a/security/tor/pkg-descr
+++ b/security/tor/pkg-descr
@@ -10,9 +10,4 @@ messaging, IRC, SSH, and more. Tor also provides a platform on which
software developers can build new applications with built-in
anonymity, safety, and privacy features.
-Remember that this is development code -- DON'T RELY ON THE CURRENT TOR
-NETWORK FOR ANONYMITY!
-
WWW: http://tor.eff.org/
-- rik
-freebsd-ports@rikrose.net
diff --git a/security/tor/pkg-install b/security/tor/pkg-install
index 8e68cf08e203..f6f1cae43445 100644
--- a/security/tor/pkg-install
+++ b/security/tor/pkg-install
@@ -1,35 +1,42 @@
-#!/bin/sh
+#! /bin/sh
+#
+# taken from devel/perforce
-if [ x"$2" = xPRE-INSTALL ]; then
- USER="_tor"
- UID="256"
- GROUP="_tor"
- GID="256"
+PATH=/bin:/usr/sbin
- if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
+TOR_USER=${TOR_USER:-_tor}
+TOR_GROUP=${TOR_GROUP:-_tor}
+
+case $2 in
+PRE-INSTALL)
+ USER=${TOR_USER}
+ UID="256"
+ GROUP=${TOR_GROUP}
+ GID="256"
+
+ if pw group show "${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
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
fi
fi
- if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
+ if 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
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -d /var/db/tor -c "Tor Daemon" -s /bin/sh
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
fi
-fi
+
+ ;;
+esac
diff --git a/security/tor/pkg-plist b/security/tor/pkg-plist
index abae4f580d85..6dac940cc517 100644
--- a/security/tor/pkg-plist
+++ b/security/tor/pkg-plist
@@ -1,8 +1,6 @@
-@comment $FreeBSD$
bin/tor
bin/tor-resolve
bin/torify
-etc/rc.d/tor.sh.sample
-etc/tor/torrc.sample
etc/tor/tor-tsocks.conf.sample
-@dirrmtry etc/tor
+etc/tor/torrc.sample
+@dirrm etc/tor