summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorChristopher Lemmer Webber <cwebber@dustycloud.org>2021-02-15 17:57:04 -0500
committerChristopher Lemmer Webber <cwebber@dustycloud.org>2021-02-22 10:03:02 -0500
commitb309a28678664c295e97a70607def02b0c9b4296 (patch)
treedfb3d0e51ace6c7e5fabc8d4170c4b4b4d82242c /gnu
parent51b3ea8d5bf6ad7eecc413fec9eec1d94f9d8c1f (diff)
services: tor: Add control-socket? option.
* doc/guix.texi (Networking Services): Document new `control-socket?' option for `tor-configuration`. * gnu/services/networking.scm (<tor-configuration>): (tor-configuration->torrc):
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/networking.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index a4d4ac0646..231a9f66c7 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -15,6 +15,7 @@
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2021 Christopher Lemmer Webber <cwebber@dustycloud.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -744,7 +745,9 @@ demand.")))
(hidden-services tor-configuration-hidden-services
(default '()))
(socks-socket-type tor-configuration-socks-socket-type ; 'tcp or 'unix
- (default 'tcp)))
+ (default 'tcp))
+ (control-socket? tor-control-socket-path
+ (default #f)))
(define %tor-accounts
;; User account and groups for Tor.
@@ -766,7 +769,8 @@ demand.")))
(define (tor-configuration->torrc config)
"Return a 'torrc' file for CONFIG."
(match config
- (($ <tor-configuration> tor config-file services socks-socket-type)
+ (($ <tor-configuration> tor config-file services
+ socks-socket-type control-socket?)
(computed-file
"torrc"
(with-imported-modules '((guix build utils))
@@ -786,6 +790,11 @@ Log notice syslog\n" port)
(display "\
SocksPort unix:/var/run/tor/socks-sock
UnixSocksGroupWritable 1\n" port))
+ (when #$control-socket?
+ (display "\
+ControlSocket unix:/var/run/tor/control-sock GroupWritable RelaxDirModeCheck
+ControlSocketsGroupWritable 1\n"
+ port))
(for-each (match-lambda
((service (ports hosts) ...)