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):
This commit is contained in:
parent
51b3ea8d5b
commit
b309a28678
2 changed files with 19 additions and 3 deletions
|
@ -45,7 +45,7 @@ Copyright @copyright{} 2017 Federico Beffa@*
|
||||||
Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
|
Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
|
||||||
Copyright @copyright{} 2017 Thomas Danckaert@*
|
Copyright @copyright{} 2017 Thomas Danckaert@*
|
||||||
Copyright @copyright{} 2017 humanitiesNerd@*
|
Copyright @copyright{} 2017 humanitiesNerd@*
|
||||||
Copyright @copyright{} 2017 Christopher Allan Webber@*
|
Copyright @copyright{} 2017, 2021 Christopher Lemmer Webber@*
|
||||||
Copyright @copyright{} 2017, 2018, 2019, 2020 Marius Bakke@*
|
Copyright @copyright{} 2017, 2018, 2019, 2020 Marius Bakke@*
|
||||||
Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
|
Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
|
||||||
Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@*
|
Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@*
|
||||||
|
@ -16596,6 +16596,13 @@ If you want to customize the SOCKS socket in more detail, leave
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
@item @code{control-socket?} (default: @code{#f})
|
||||||
|
Whether or not to provide a ``control socket'' by which Tor can be
|
||||||
|
controlled to, for instance, dynamically instantiate tor onion services.
|
||||||
|
If @code{#t}, Tor will listen for control commands on the UNIX domain socket
|
||||||
|
@file{/var/run/tor/control-sock}, which will be made writable by members of the
|
||||||
|
@code{tor} group.
|
||||||
|
|
||||||
@cindex hidden service
|
@cindex hidden service
|
||||||
@deffn {Scheme Procedure} tor-hidden-service @var{name} @var{mapping}
|
@deffn {Scheme Procedure} tor-hidden-service @var{name} @var{mapping}
|
||||||
Define a new Tor @dfn{hidden service} called @var{name} and implementing
|
Define a new Tor @dfn{hidden service} called @var{name} and implementing
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
|
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
|
||||||
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
||||||
;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
|
;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
|
||||||
|
;;; Copyright © 2021 Christopher Lemmer Webber <cwebber@dustycloud.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -744,7 +745,9 @@ demand.")))
|
||||||
(hidden-services tor-configuration-hidden-services
|
(hidden-services tor-configuration-hidden-services
|
||||||
(default '()))
|
(default '()))
|
||||||
(socks-socket-type tor-configuration-socks-socket-type ; 'tcp or 'unix
|
(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
|
(define %tor-accounts
|
||||||
;; User account and groups for Tor.
|
;; User account and groups for Tor.
|
||||||
|
@ -766,7 +769,8 @@ demand.")))
|
||||||
(define (tor-configuration->torrc config)
|
(define (tor-configuration->torrc config)
|
||||||
"Return a 'torrc' file for CONFIG."
|
"Return a 'torrc' file for CONFIG."
|
||||||
(match 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
|
(computed-file
|
||||||
"torrc"
|
"torrc"
|
||||||
(with-imported-modules '((guix build utils))
|
(with-imported-modules '((guix build utils))
|
||||||
|
@ -786,6 +790,11 @@ Log notice syslog\n" port)
|
||||||
(display "\
|
(display "\
|
||||||
SocksPort unix:/var/run/tor/socks-sock
|
SocksPort unix:/var/run/tor/socks-sock
|
||||||
UnixSocksGroupWritable 1\n" port))
|
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
|
(for-each (match-lambda
|
||||||
((service (ports hosts) ...)
|
((service (ports hosts) ...)
|
||||||
|
|
Reference in a new issue