summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/tor/files')
-rw-r--r--net-misc/tor/files/README.gentoo8
-rw-r--r--net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch31
-rw-r--r--net-misc/tor/files/tor.conf1
-rw-r--r--net-misc/tor/files/tor.confd3
-rw-r--r--net-misc/tor/files/tor.initd-r784
-rw-r--r--net-misc/tor/files/tor.service21
-rw-r--r--net-misc/tor/files/torrc-r17
7 files changed, 155 insertions, 0 deletions
diff --git a/net-misc/tor/files/README.gentoo b/net-misc/tor/files/README.gentoo
new file mode 100644
index 000000000000..35214ac6fbb5
--- /dev/null
+++ b/net-misc/tor/files/README.gentoo
@@ -0,0 +1,8 @@
+We created a configuration file for tor, /etc/tor/torrc, but you can
+change it according to your needs. Use the torrc.sample that is in
+that directory as a guide. Also, to have privoxy work with tor
+just add the following line
+
+forward-socks4a / localhost:9050 .
+
+to /etc/privoxy/config. Notice the . at the end!
diff --git a/net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch b/net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch
new file mode 100644
index 000000000000..1fa9d2856dc3
--- /dev/null
+++ b/net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch
@@ -0,0 +1,31 @@
+diff -Naur tor-0.2.3.14-alpha.orig//src/config/torrc.sample.in tor-0.2.3.14-alpha/src/config/torrc.sample.in
+--- tor-0.2.3.14-alpha.orig//src/config/torrc.sample.in 2012-04-23 03:10:14.000000000 -0400
++++ tor-0.2.3.14-alpha/src/config/torrc.sample.in 2012-04-24 06:30:21.000000000 -0400
+@@ -12,6 +12,11 @@
+ ## Tor will look for this file in various places based on your platform:
+ ## https://www.torproject.org/docs/faq#torrc
+
++## Default username and group the server will run as
++User tor
++
++PIDFile /var/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
+ ## as a relay, and not make any local application connections yourself.
+@@ -41,6 +46,7 @@
+ #Log notice syslog
+ ## To send all messages to stderr:
+ #Log debug stderr
++Log warn syslog
+
+ ## Uncomment this to start the process in the background... or use
+ ## --runasdaemon 1 on the command line. This is ignored on Windows;
+@@ -50,6 +56,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/files/tor.conf b/net-misc/tor/files/tor.conf
new file mode 100644
index 000000000000..188c041e5442
--- /dev/null
+++ b/net-misc/tor/files/tor.conf
@@ -0,0 +1 @@
+d /var/run/tor 0775 tor tor - -
diff --git a/net-misc/tor/files/tor.confd b/net-misc/tor/files/tor.confd
new file mode 100644
index 000000000000..4195bf3237b2
--- /dev/null
+++ b/net-misc/tor/files/tor.confd
@@ -0,0 +1,3 @@
+#
+# Set the file limit
+rc_ulimit="-n 30000"
diff --git a/net-misc/tor/files/tor.initd-r7 b/net-misc/tor/files/tor.initd-r7
new file mode 100644
index 000000000000..799cca17f470
--- /dev/null
+++ b/net-misc/tor/files/tor.initd-r7
@@ -0,0 +1,84 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+PIDFILE=/var/run/tor/tor.pid
+CONFFILE=/etc/tor/torrc
+GRACEFUL_TIMEOUT=${GRACEFUL_TIMEOUT:-60}
+
+# See bug #523552, and https://trac.torproject.org/projects/tor/ticket/5525
+# Graceful = wait 30 secs or so until all connections are properly closed.
+extra_commands="checkconfig"
+extra_started_commands="graceful gracefulstop reload"
+description="Anonymizing overlay network for TCP"
+description_checkconfig="Check for valid config file."
+description_reload="Reload the configuration."
+description_graceful="Gracefully restart."
+description_gracefulstop="Gracefully stop."
+
+depend() {
+ need net
+}
+
+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
+ checkpath -d -m 0755 -o tor:tor /var/run/tor
+ 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 $?
+}
+
+graceful() {
+ gracefulstop
+ start
+ eend $?
+}
+
+gracefulstop() {
+ local rc=0
+ ebegin "Gracefully stopping Tor"
+ ebegin "This can take up to ${GRACEFUL_TIMEOUT} seconds"
+ start-stop-daemon -P --stop --signal INT -R ${GRACEFUL_TIMEOUT} --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
+ rc=$?
+ eend "done"
+ eend $rc
+}
+
+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/tor.service b/net-misc/tor/files/tor.service
new file mode 100644
index 000000000000..8fcc6740ed91
--- /dev/null
+++ b/net-misc/tor/files/tor.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=The Onion Router
+
+[Service]
+ExecStartPre=/usr/bin/tor --verify-config -f /etc/tor/torrc
+ExecStart=/usr/bin/tor --RunAsDaemon 0 -f /etc/tor/torrc
+ExecReload=/bin/kill -HUP $MAINPID
+KillSignal=SIGINT
+TimeoutStopSec=32
+LimitNOFILE=30000
+
+# Hardening options:
+CapabilityBoundingSet = CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE
+PrivateTmp = yes
+PrivateDevices = yes
+ProtectHome = yes
+ProtectSystem = full
+NoNewPrivileges = yes
+
+[Install]
+WantedBy=multi-user.target
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