[Midnightbsd-cvs] mports: mports/security:

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Nov 9 20:56:55 EST 2007


Log Message:
-----------


Modified Files:
--------------
    mports/security:
        Makefile (r1.66 -> r1.67)

Added Files:
-----------
    mports/security/tor:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-deinstall (r1.1)
        pkg-descr (r1.1)
        pkg-install (r1.1)
        pkg-plist (r1.1)
    mports/security/tor/files:
        pkg-message.in (r1.1)
        tor.in (r1.1)

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/security/Makefile,v
retrieving revision 1.66
retrieving revision 1.67
diff -L security/Makefile -L security/Makefile -u -r1.66 -r1.67
--- security/Makefile
+++ security/Makefile
@@ -65,6 +65,7 @@
     SUBDIR += saint
     SUBDIR += secpwgen
     SUBDIR += sudo
+    SUBDIR += tor
     SUBDIR += tripwire
     SUBDIR += vlock
     SUBDIR += vlog
--- /dev/null
+++ security/tor/pkg-install
@@ -0,0 +1,42 @@
+#! /bin/sh
+#
+# taken from devel/perforce
+
+PATH=/bin:/usr/sbin
+
+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 pw groupadd ${GROUP} -g ${GID}; 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} -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
+
+	;;
+esac
--- /dev/null
+++ security/tor/pkg-descr
@@ -0,0 +1,16 @@
+Tor: an anonymizing overlay network for TCP
+
+Tor is a connection-based low-latency anonymous communication system which
+addresses many flaws in the original onion routing design.
+
+Tor is a toolset for a wide range of organizations and people that
+want to improve their safety and security on the Internet. Using
+Tor can help you anonymize web browsing and publishing, instant
+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/
--- /dev/null
+++ security/tor/pkg-plist
@@ -0,0 +1,6 @@
+bin/tor
+bin/tor-resolve
+bin/torify
+etc/tor/tor-tsocks.conf.sample
+etc/tor/torrc.sample
+ at dirrm etc/tor
--- /dev/null
+++ 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}
--- /dev/null
+++ security/tor/Makefile
@@ -0,0 +1,93 @@
+# ports collection makefile for:	tor
+# Date created:				9 Nov 2007
+# Whom:					Lucas Holt <luke at midnightbsd.org>
+#
+# $MidnightBSD: mports/security/tor/Makefile,v 1.1 2007/11/10 01:56:53 laffer1 Exp $
+#
+
+PORTNAME=	tor
+PORTVERSION=	0.1.2.17
+CATEGORIES=	security net
+MASTER_SITES=	http://tor.eff.org/dist/ \
+		http://mirror.onionland.org/dist/
+DISTNAME=	${PORTNAME}-${PORTVERSION}
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	An anonymizing overlay network for TCP
+LICENSE=	bsd3
+
+RUN_DEPENDS=	tsocks:${PORTSDIR}/net/tsocks
+LIB_DEPENDS=	event-1.3d:${PORTSDIR}/devel/libevent
+
+GNU_CONFIGURE=	yes
+USE_OPENSSL=	yes
+
+OPTIONS=	EVENTDNS "asynchronous DNS module" on \
+		THREADS "multi-threading support" on \
+		TRANSPARENT "transparent proxy support" on \
+		VIDALIA "Vidalia graphical Tor controller" off
+
+USE_RC_SUBR=	tor
+SUB_FILES=	pkg-message
+
+MANCOMPRESSED=	no
+MAN1=		tor.1 tor-resolve.1 torify.1
+
+.include <bsd.port.pre.mk>
+
+CONFIGURE_ENV+=	CPPFLAGS+=-I{LOCALBASE}/include \
+		LDFLAGS+=-L{LOCALBASE}/lib
+
+.if defined(WITH_EVENTDNS)
+CONFIGURE_ARGS+=	--enable-eventdns
+.else
+CONFIGURE_ARGS+=	--disable-eventdns
+.endif
+
+.if defined(WITH_THREADS)
+CONFIGURE_ARGS+=	--enable-threads
+CONFIGURE_ENV+=	LDFLAGS+={PTHREAD_LIBS}
+.else
+CONFIGURE_ARGS+=	--disable-threads
+.endif
+
+.if defined(WITH_TRANSPARENT)
+CONFIGURE_ARGS+=	--enable-transparent
+.else
+CONFIGURE_ARGS+=	--disable-transparent
+.endif
+
+.ifdef(WITH_VIDALIA)
+RUN_DEPENDS+=	vidalia:${PORTSDIR}/net-mgmt/vidalia
+.endif
+
+post-patch:
+	@${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
+#fix typos in configure scripts, undesirable compiler flags, wrong location of in6.h
+	@${FIND} ${WRKSRC} -type f | ${XARGS} \
+		-n 10 ${REINPLACE_CMD} -E \
+		-e 's!-g -O2!!' \
+		-e 's!-O2!!' \
+		-e 's|netintet|netinet|g' \
+		-e 's|netinet/in6|netinet6/in6|g'
+
+post-configure:
+	@${FIND} ${WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} -e \
+		's|-lpthread|${PTHREAD_LIBS}|g'
+
+pre-su-install:
+	@${SETENV} PKG_PREFIX=${PREFIX} ${SH} \
+		${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+
+post-install:
+	${MKDIR} /var/run/tor
+	${CHOWN} _tor:_tor /var/run/tor
+	${TOUCH} /var/log/tor
+	${CHOWN} _tor:_tor /var/log/tor
+	${MKDIR} /var/db/tor/data
+	${CHOWN} _tor:_tor /var/db/tor
+
+.include <bsd.port.post.mk>
--- /dev/null
+++ security/tor/distinfo
@@ -0,0 +1,3 @@
+MD5 (tor-0.1.2.17.tar.gz) = ef8fc7f45d167875c337063d437c9832
+SHA256 (tor-0.1.2.17.tar.gz) = fc0fb0c2891ae09854a69512c6b4988964f2eaf62ce80ed6644cb21f87f6056a
+SIZE (tor-0.1.2.17.tar.gz) = 1251636
--- /dev/null
+++ security/tor/files/pkg-message.in
@@ -0,0 +1,3 @@
+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
--- /dev/null
+++ security/tor/files/tor.in
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $MidnightBSD: mports/security/tor/files/tor.in,v 1.1 2007/11/10 01:56:53 laffer1 Exp $
+#
+# PROVIDE: tor
+# REQUIRE: NETWORKING SERVERS USR
+# BEFORE: LOGIN
+#
+# Add the following lines to /etc/rc.conf to enable tor.
+# All these options will overide any settings in your local torrc as
+# they are command line options.
+#
+# 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
+# tor_logfile (str):	Tor Log File.  Defaults /var/log/tor
+#
+
+. %%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}
+pidfile=${tor_pidfile}
+command="%%PREFIX%%/bin/${name}"
+command_args="-f ${tor_conf} --PidFile ${tor_pidfile} --RunAsDaemon 1 --DataDirectory ${tor_datadir} --User ${tor_user} --Group ${tor_group} --Log \"notice file ${tor_logfile}\""
+extra_commands="log"
+log_cmd="${name}_log"
+
+tor_log() {
+	cat ${tor_logfile}
+}
+
+run_rc_command "$1"
+


More information about the Midnightbsd-cvs mailing list