From 3086f72684b219b707f99f9e4bcd85f08f20a977 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Sun, 8 Dec 2019 12:03:52 -0500 Subject: [PATCH] net-vpn/tor: user /run instead of /var/run, bug #685296 Closes: https://bugs.gentoo.org/685296 Package-Manager: Portage-2.3.79, Repoman-2.3.16 Signed-off-by: Anthony G. Basile --- .../tor/files/tor-0.2.7.4-torrc.sample.patch | 2 +- net-vpn/tor/files/tor.initd-r9 | 37 +++++++++++++++++++ net-vpn/tor/files/torrc-r2 | 7 ++++ net-vpn/tor/tor-0.4.1.6-r1.ebuild | 4 +- net-vpn/tor/tor-0.4.2.4_rc-r1.ebuild | 4 +- 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 net-vpn/tor/files/tor.initd-r9 create mode 100644 net-vpn/tor/files/torrc-r2 diff --git a/net-vpn/tor/files/tor-0.2.7.4-torrc.sample.patch b/net-vpn/tor/files/tor-0.2.7.4-torrc.sample.patch index 92eb03bb18ea..5f9e258de031 100644 --- a/net-vpn/tor/files/tor-0.2.7.4-torrc.sample.patch +++ b/net-vpn/tor/files/tor-0.2.7.4-torrc.sample.patch @@ -8,7 +8,7 @@ diff -Nuar tor-0.2.7.4-rc.orig/src/config/torrc.sample.in tor-0.2.7.4-rc/src/con +## Default username and group the server will run as +User tor + -+PIDFile /var/run/tor/tor.pid ++PIDFile /run/tor/tor.pid + ## Tor opens a SOCKS proxy on port 9050 by default -- even if you don't ## configure one below. Set "SOCKSPort 0" if you plan to run Tor only diff --git a/net-vpn/tor/files/tor.initd-r9 b/net-vpn/tor/files/tor.initd-r9 new file mode 100644 index 000000000000..c1639c2af95a --- /dev/null +++ b/net-vpn/tor/files/tor.initd-r9 @@ -0,0 +1,37 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +command=/usr/bin/tor +pidfile=/run/tor/tor.pid +command_args="--hush --runasdaemon 1 --pidfile \"${pidfile}\"" +retry=${GRACEFUL_TIMEOUT:-60} +stopsig=INT +command_progress=yes + +extra_commands="checkconfig" +extra_started_commands="reload" +description="Anonymizing overlay network for TCP" +description_checkconfig="Check for valid config file" +description_reload="Reload the configuration" + +checkconfig() { + ${command} --verify-config --hush > /dev/null 2>&1 + if [ $? -ne 0 ] ; then + eerror "Tor configuration (/etc/tor/torrc) is not valid." + eerror "Example is in /etc/tor/torrc.sample" + return 1 + fi +} + +start_pre() { + checkconfig || return 1 + checkpath -d -m 0755 -o tor:tor /run/tor +} + +reload() { + checkconfig || return 1 + ebegin "Reloading Tor configuration" + start-stop-daemon -s HUP --pidfile ${pidfile} + eend $? +} diff --git a/net-vpn/tor/files/torrc-r2 b/net-vpn/tor/files/torrc-r2 new file mode 100644 index 000000000000..b308104c7031 --- /dev/null +++ b/net-vpn/tor/files/torrc-r2 @@ -0,0 +1,7 @@ +# +# Minimal torrc so tor will work out of the box +# +User tor +PIDFile /run/tor/tor.pid +Log notice syslog +DataDirectory /var/lib/tor/data diff --git a/net-vpn/tor/tor-0.4.1.6-r1.ebuild b/net-vpn/tor/tor-0.4.1.6-r1.ebuild index 0e4ac6b73434..4bb1f0d376b1 100644 --- a/net-vpn/tor/tor-0.4.1.6-r1.ebuild +++ b/net-vpn/tor/tor-0.4.1.6-r1.ebuild @@ -75,7 +75,7 @@ src_install() { readme.gentoo_create_doc newconfd "${FILESDIR}"/tor.confd tor - newinitd "${FILESDIR}"/tor.initd-r8 tor + newinitd "${FILESDIR}"/tor.initd-r9 tor systemd_dounit contrib/dist/tor.service keepdir /var/lib/tor @@ -84,5 +84,5 @@ src_install() { fowners tor:tor /var/lib/tor insinto /etc/tor/ - newins "${FILESDIR}"/torrc-r1 torrc + newins "${FILESDIR}"/torrc-r2 torrc } diff --git a/net-vpn/tor/tor-0.4.2.4_rc-r1.ebuild b/net-vpn/tor/tor-0.4.2.4_rc-r1.ebuild index e81cec3f97ec..ed9e10a6a652 100644 --- a/net-vpn/tor/tor-0.4.2.4_rc-r1.ebuild +++ b/net-vpn/tor/tor-0.4.2.4_rc-r1.ebuild @@ -77,7 +77,7 @@ src_install() { readme.gentoo_create_doc newconfd "${FILESDIR}"/tor.confd tor - newinitd "${FILESDIR}"/tor.initd-r8 tor + newinitd "${FILESDIR}"/tor.initd-r9 tor systemd_dounit contrib/dist/tor.service keepdir /var/lib/tor @@ -86,5 +86,5 @@ src_install() { fowners tor:tor /var/lib/tor insinto /etc/tor/ - newins "${FILESDIR}"/torrc-r1 torrc + newins "${FILESDIR}"/torrc-r2 torrc } -- 2.26.2