aboutsummaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorChris Marusich <cmmarusich@gmail.com>2018-07-31 01:13:48 -0700
committerChris Marusich <cmmarusich@gmail.com>2018-08-28 00:25:05 -0700
commit3bcb305b98e02f6c9d98e7325813fc00f18f0e6c (patch)
tree814beccc935b4a221074e6458ae2be9e9d2c377c /gnu/services
parentb0f951e4f04766892933e3b60d1b24ab3a8589c2 (diff)
downloadguix-3bcb305b98e02f6c9d98e7325813fc00f18f0e6c.tar
guix-3bcb305b98e02f6c9d98e7325813fc00f18f0e6c.tar.gz
services: tor: Make it easier to use UNIX sockets.
* doc/guix.texi (Networking Services): Document it, and mention that tor-service is deprecated. * gnu/services/networking.scm (<tor-configuration>) <socks-socket-type>: New field. (tor-configuration->torrc): When socks-socket-type is 'unix, set SocksPort to UNIX domain socket /var/run/tor/socks-sock and set UnixSocksGroupWritable to 1. * gnu/tests/networking.scm (%tor-os/unix-socks-socket): Instead of using a custom config file, just set socks-socket-type to 'unix.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/networking.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index b7f2bfe7b3..b6b5ee3fec 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -577,7 +577,9 @@ demand.")))
(config-file tor-configuration-config-file
(default (plain-file "empty" "")))
(hidden-services tor-configuration-hidden-services
- (default '())))
+ (default '()))
+ (socks-socket-type tor-configuration-socks-socket-type ; 'tcp or 'unix
+ (default 'tcp)))
(define %tor-accounts
;; User account and groups for Tor.
@@ -599,7 +601,7 @@ demand.")))
(define (tor-configuration->torrc config)
"Return a 'torrc' file for CONFIG."
(match config
- (($ <tor-configuration> tor config-file services)
+ (($ <tor-configuration> tor config-file services socks-socket-type)
(computed-file
"torrc"
(with-imported-modules '((guix build utils))
@@ -615,6 +617,10 @@ User tor
DataDirectory /var/lib/tor
PidFile /var/run/tor/tor.pid
Log notice syslog\n" port)
+ (when (eq? 'unix '#$socks-socket-type)
+ (display "\
+SocksPort unix:/var/run/tor/socks-sock
+UnixSocksGroupWritable 1\n" port))
(for-each (match-lambda
((service (ports hosts) ...)