diff options
author | 2011-08-30 13:57:42 +0000 | |
---|---|---|
committer | 2011-08-30 13:57:42 +0000 | |
commit | 0d4c8508b16576f751ab6de801c1e05eeba5c355 (patch) | |
tree | eacb77a5d42efabd129337aa1e20ab68851487e1 /net-misc/tor | |
parent | Change version scheme (diff) | |
download | gentoo-2-0d4c8508b16576f751ab6de801c1e05eeba5c355.tar.gz gentoo-2-0d4c8508b16576f751ab6de801c1e05eeba5c355.tar.bz2 gentoo-2-0d4c8508b16576f751ab6de801c1e05eeba5c355.zip |
Change logging to syslog, add sanity check for /var/run/tor, bug #380117
(Portage version: 2.1.10.11/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/tor')
-rw-r--r-- | net-misc/tor/ChangeLog | 10 | ||||
-rw-r--r-- | net-misc/tor/files/tor.initd-r5 | 81 | ||||
-rw-r--r-- | net-misc/tor/files/torrc-r1 | 7 | ||||
-rw-r--r-- | net-misc/tor/files/torrc.sample.patch | 30 | ||||
-rw-r--r-- | net-misc/tor/tor-0.2.2.32-r1.ebuild | 82 | ||||
-rw-r--r-- | net-misc/tor/tor-0.2.3.2_alpha-r3.ebuild | 88 |
6 files changed, 297 insertions, 1 deletions
diff --git a/net-misc/tor/ChangeLog b/net-misc/tor/ChangeLog index d2bcb8f2c302..6098f372a36a 100644 --- a/net-misc/tor/ChangeLog +++ b/net-misc/tor/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-misc/tor # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/ChangeLog,v 1.269 2011/08/28 11:15:42 blueness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/ChangeLog,v 1.270 2011/08/30 13:57:42 blueness Exp $ + +*tor-0.2.3.2_alpha-r3 (30 Aug 2011) +*tor-0.2.2.32-r1 (30 Aug 2011) + + 30 Aug 2011; Anthony G. Basile <blueness@gentoo.org> +tor-0.2.2.32-r1.ebuild, + +tor-0.2.3.2_alpha-r3.ebuild, +files/tor.initd-r5, +files/torrc-r1, + +files/torrc.sample.patch: + Change logging to syslog, add sanity check for /var/run/tor, bug #380117 28 Aug 2011; Anthony G. Basile <blueness@gentoo.org> -tor-0.2.2.31_rc.ebuild: Removed old release candidate diff --git a/net-misc/tor/files/tor.initd-r5 b/net-misc/tor/files/tor.initd-r5 new file mode 100644 index 000000000000..9f102ed4ba25 --- /dev/null +++ b/net-misc/tor/files/tor.initd-r5 @@ -0,0 +1,81 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r5,v 1.3 2011/08/30 13:57:42 blueness Exp $ + +opts="${opts} checkconfig checkvarrun reload" +PIDDIR="/var/run/tor" +PIDFILE="${PIDDIR}/tor.pid" +CONFFILE="/etc/tor/torrc" + +depend() { + need net +} + +checkvarrun() +{ + # Check if /var/run/tor exists, create it if it doesn't + [ ! -d /var/run/tor ] && mkdir -p ${PIDDIR} + [ ! -d /var/run/tor ] && return 1 + + # The directory definitly exists now, but does it belong to tor:tor? + local dir=$(find ${PIDDIR} -maxdepth 0 -a -user tor -a -group tor) + [ -z "$dir" ] && chown tor:tor ${PIDDIR} + dir=$(find ${PIDDIR} -maxdepth 0 -a -user tor -a -group tor) + [ -z "$dir" ] && return 1 + + # And does it have the right perms? + dir=$(find ${PIDDIR} -maxdepth 0 -perm 0755) + [ -z "$dir" ] && chmod 0755 ${PIDDIR} + dir=$(find ${PIDDIR} -maxdepth 0 -perm 0755) + [ -z "$dir" ] && return 1 + + # If any of the above failed, we would not be here + return 0 +} + +checkconfig() { + # first check that it exists + if [ ! -f ${CONFFILE} ] ; then + eerror "You need to setup ${CONFFILE} first" + eerror "Example is in ${CONFFILE}.sample" + return 1 + fi + + # now verify whether the configuration is valid + /usr/bin/tor --verify-config -f ${CONFFILE} > /dev/null 2>&1 + if [ $? -eq 0 ] ; then + einfo "Tor configuration (${CONFFILE}) is valid." + return 0 + else + eerror "Tor configuration (${CONFFILE}) not valid." + /usr/bin/tor --verify-config -f ${CONFFILE} + return 1 + fi +} + +start() { + checkconfig || return 1 + checkvarrun || return 1 + ebegin "Starting Tor" + HOME=/var/lib/tor + start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor -- -f "${CONFFILE}" --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1 + eend $? +} + +stop() { + ebegin "Stopping Tor" + start-stop-daemon --stop --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}" + eend $? +} + +reload() { + if [ ! -f ${PIDFILE} ]; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || return 1 + ebegin "Reloading Tor configuration" + start-stop-daemon --signal HUP --pidfile ${PIDFILE} + eend $? +} diff --git a/net-misc/tor/files/torrc-r1 b/net-misc/tor/files/torrc-r1 new file mode 100644 index 000000000000..322a794aa1d5 --- /dev/null +++ b/net-misc/tor/files/torrc-r1 @@ -0,0 +1,7 @@ +# +# Minimal torrc so tor will work out of the box +# +User tor +PIDFile /var/run/tor/tor.pid +Log notice syslog +DataDirectory /var/lib/tor/data diff --git a/net-misc/tor/files/torrc.sample.patch b/net-misc/tor/files/torrc.sample.patch new file mode 100644 index 000000000000..4a1592a552f9 --- /dev/null +++ b/net-misc/tor/files/torrc.sample.patch @@ -0,0 +1,30 @@ +diff -Nuar tor-0.2.2.32.orig/src/config/torrc.sample.in tor-0.2.2.32/src/config/torrc.sample.in +--- tor-0.2.2.32.orig/src/config/torrc.sample.in 2011-08-29 23:13:09.000000000 -0400 ++++ tor-0.2.2.32/src/config/torrc.sample.in 2011-08-29 23:14:19.000000000 -0400 +@@ -12,6 +12,10 @@ + ## Tor will look for this file in various places based on your platform: + ## https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#torrc + ++## Default username and group the server will run as ++User tor ++ ++PIDFile /var/run/tor/tor.pid + + ## Replace this with "SocksPort 0" if you plan to run Tor only as a + ## relay, and not make any local application connections yourself. +@@ -40,6 +44,7 @@ + #Log notice syslog + ## To send all messages to stderr: + #Log debug stderr ++Log notice syslog + + ## Uncomment this to start the process in the background... or use + ## --runasdaemon 1 on the command line. This is ignored on Windows; +@@ -49,6 +54,7 @@ + ## The directory for keeping all the keys/etc. By default, we store + ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows. + #DataDirectory @LOCALSTATEDIR@/lib/tor ++DataDirectory /var/lib/tor/data + + ## The port on which Tor will listen for local connections from Tor + ## controller applications, as documented in control-spec.txt. diff --git a/net-misc/tor/tor-0.2.2.32-r1.ebuild b/net-misc/tor/tor-0.2.2.32-r1.ebuild new file mode 100644 index 000000000000..b17b77ebae80 --- /dev/null +++ b/net-misc/tor/tor-0.2.2.32-r1.ebuild @@ -0,0 +1,82 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/tor-0.2.2.32-r1.ebuild,v 1.1 2011/08/30 13:57:42 blueness Exp $ + +EAPI=4 + +inherit autotools eutils flag-o-matic versionator + +MY_PV="$(replace_version_separator 4 -)" +MY_PF="${PN}-${MY_PV}" +DESCRIPTION="Anonymizing overlay network for TCP" +HOMEPAGE="http://www.torproject.org/" +SRC_URI="http://www.torproject.org/dist/${MY_PF}.tar.gz" +S="${WORKDIR}/${MY_PF}" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" +IUSE="doc tor-hardening +transparent-proxy threads" + +DEPEND="dev-libs/openssl + >=dev-libs/libevent-2.0" +# The tordns patch for tsocks avoids some leakage of information thus raising anonymity +RDEPEND="${DEPEND} + net-proxy/tsocks[tordns]" + +pkg_setup() { + enewgroup tor + enewuser tor -1 -1 /var/lib/tor tor +} + +src_prepare() { + epatch "${FILESDIR}"/torrc.sample.patch + + einfo "Regenerating autotools files ..." + epatch "${FILESDIR}"/${PN}-0.2.2.24_alpha-respect-CFLAGS.patch + eautoreconf || die "eautoreconf failed" +} + +src_configure() { + # Upstream isn't sure of all the user provided CFLAGS that + # will break tor, but does recommend against -fstrict-aliasing. + # We'll filter-flags them here as we encounter them. + filter-flags -fstrict-aliasing + econf --docdir=/usr/share/doc/${PF} \ + $(use_enable doc asciidoc) \ + $(use_enable tor-hardening gcc-hardening) \ + $(use_enable tor-hardening linker-hardening)\ + $(use_enable transparent-proxy transparent) \ + $(use_enable threads) +} + +src_install() { + newconfd "${FILESDIR}"/tor.confd tor + newinitd "${FILESDIR}"/tor.initd-r5 tor + emake DESTDIR="${D}" install || die + keepdir /var/{lib,run}/tor + + dodoc README ChangeLog ReleaseNotes \ + doc/{HACKING,TODO} \ + doc/spec/README + + fperms 750 /var/lib/tor + fperms 755 /var/run/tor + fowners tor:tor /var/lib/tor /var/run/tor + + insinto /etc/tor/ + newins "${FILESDIR}"/torrc-r1 torrc +} + +pkg_postinst() { + elog + elog "We created a configuration file for tor, /etc/tor/torrc, but you can" + elog "change it according to your needs. Use the torrc.sample that is in" + elog "that directory as a guide. Also, to have privoxy work with tor" + elog "just add the following line" + elog + elog "forward-socks4a / localhost:9050 ." + elog + elog "to /etc/privoxy/config. Notice the . at the end!" + elog +} diff --git a/net-misc/tor/tor-0.2.3.2_alpha-r3.ebuild b/net-misc/tor/tor-0.2.3.2_alpha-r3.ebuild new file mode 100644 index 000000000000..ef8818c18acd --- /dev/null +++ b/net-misc/tor/tor-0.2.3.2_alpha-r3.ebuild @@ -0,0 +1,88 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/tor-0.2.3.2_alpha-r3.ebuild,v 1.1 2011/08/30 13:57:42 blueness Exp $ + +EAPI=4 + +inherit autotools eutils flag-o-matic versionator + +MY_PV="$(replace_version_separator 4 -)" +MY_PF="${PN}-${MY_PV}" +DESCRIPTION="Anonymizing overlay network for TCP" +HOMEPAGE="http://www.torproject.org/" +SRC_URI="http://www.torproject.org/dist/${MY_PF}.tar.gz" +S="${WORKDIR}/${MY_PF}" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" +IUSE="+bufferevents doc nat-pmp tor-hardening transparent-proxy threads upnp" +DEPEND="dev-libs/openssl + >=dev-libs/libevent-2.0 + nat-pmp? ( net-libs/libnatpmp ) + upnp? ( <net-libs/miniupnpc-1.6 )" + +# The tordns patch for tsocks avoids some leakage of information thus raising anonymity +RDEPEND="${DEPEND} + net-proxy/tsocks[tordns]" + +pkg_setup() { + enewgroup tor + enewuser tor -1 -1 /var/lib/tor tor +} + +src_prepare() { + epatch "${FILESDIR}"/torrc.sample.patch + epatch "${FILESDIR}"/${PN}-0.2.3.2_alpha-fix-asneeded.patch + + einfo "Regenerating autotools files ..." + epatch "${FILESDIR}"/${PN}-0.2.2.24_alpha-respect-CFLAGS.patch + eautoreconf || die "eautoreconf failed" +} + +src_configure() { + # Upstream isn't sure of all the user provided CFLAGS that + # will break tor, but does recommend against -fstrict-aliasing. + # We'll filter-flags them here as we encounter them. + filter-flags -fstrict-aliasing + econf --docdir=/usr/share/doc/${PF} \ + $(use_enable bufferevents) \ + $(use_enable doc asciidoc) \ + $(use_enable nat-pmp) \ + $(use_enable tor-hardening gcc-hardening) \ + $(use_enable tor-hardening linker-hardening)\ + $(use_enable transparent-proxy transparent) \ + $(use_enable threads) \ + $(use_enable upnp) +} + +src_install() { + newconfd "${FILESDIR}"/tor.confd tor + newinitd "${FILESDIR}"/tor.initd-r5 tor + emake DESTDIR="${D}" install || die + keepdir /var/{lib,run}/tor + + dodoc README ChangeLog ReleaseNotes \ + doc/{HACKING,TODO} \ + doc/spec/README + + fperms 750 /var/lib/tor + fperms 755 /var/run/tor + fowners tor:tor /var/lib/tor /var/run/tor + + insinto /etc/tor/ + newins "${FILESDIR}"/torrc-r1 torrc +} + +pkg_postinst() { + elog + elog "We created a configuration file for tor, /etc/tor/torrc, but you can" + elog "change it according to your needs. Use the torrc.sample that is in" + elog "that directory as a guide. Also, to have privoxy work with tor" + elog "just add the following line" + elog + elog "forward-socks4a / localhost:9050 ." + elog + elog "to /etc/privoxy/config. Notice the . at the end!" + elog +} |