From unknown Tue Sep 23 12:15:56 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#46549] services: tor: Add control-socket? option. Resent-From: Christopher Lemmer Webber Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Feb 2021 23:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46549 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 46549@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1613430261491 (code B ref -1); Mon, 15 Feb 2021 23:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Feb 2021 23:04:21 +0000 Received: from localhost ([127.0.0.1]:38894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBmui-00007q-02 for submit@debbugs.gnu.org; Mon, 15 Feb 2021 18:04:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:55728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBmud-00007f-9f for submit@debbugs.gnu.org; Mon, 15 Feb 2021 18:04:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBmud-0005mm-4I for guix-patches@gnu.org; Mon, 15 Feb 2021 18:04:15 -0500 Received: from dustycloud.org ([50.116.34.160]:59736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBmuU-0000xr-Cx for guix-patches@gnu.org; Mon, 15 Feb 2021 18:04:14 -0500 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 6EDD726614 for ; Mon, 15 Feb 2021 18:04:04 -0500 (EST) User-agent: mu4e 1.4.13; emacs 27.1 From: Christopher Lemmer Webber Message-ID: <87czx1orvf.fsf@dustycloud.org> Date: Mon, 15 Feb 2021 18:04:04 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=50.116.34.160; envelope-from=cwebber@dustycloud.org; helo=dustycloud.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain This allows users to have an easy way to enable control sockets for Tor. Turning it on does so via a unix domain socket. Intentionally I did not add the localhost+port path because I feel unsure about the safety of that, and nobodey has yet demonstrated a need. I suppose another nice option might be to let the user specify a specific path, but we didn't allow that for the socks-sock, so I was too lazy to allow it here either. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-services-tor-Add-control-socket-option.patch Content-Transfer-Encoding: quoted-printable >From b85d5d49678ae11fd5a855acddbc78be123d863c Mon Sep 17 00:00:00 2001 From: Christopher Lemmer Webber Date: Mon, 15 Feb 2021 17:57:04 -0500 Subject: [PATCH] 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->torrc): --- doc/guix.texi | 9 ++++++++- gnu/services/networking.scm | 13 +++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 535c98a453..81cc24e0e3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -45,7 +45,7 @@ Copyright @copyright{} 2017 Federico Beffa@* Copyright @copyright{} 2017, 2018 Carlo Zancanaro@* Copyright @copyright{} 2017 Thomas Danckaert@* 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, 2019, 2020 Hartmut Goebel@* Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@* @@ -16578,6 +16578,13 @@ If you want to customize the SOCKS socket in more = detail, leave @end table @end deftp =20 +@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 sock= et +@file{/var/run/tor/control-sock}, which will be made writable by members o= f the +@code{tor} group. + @cindex hidden service @deffn {Scheme Procedure} tor-hidden-service @var{name} @var{mapping} Define a new Tor @dfn{hidden service} called @var{name} and implementing 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 =C2=A9 2019 Alex Griffin ;;; Copyright =C2=A9 2020 Brice Waegeneire ;;; Copyright =C2=A9 2021 Oleg Pykhalov +;;; Copyright =C2=A9 2021 Christopher Lemmer Webber ;;; ;;; 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))) =20 (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 config-file services socks-socket-type) + (($ 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 RelaxDirModeChe= ck +ControlSocketsGroupWritable 1\n" + port)) =20 (for-each (match-lambda ((service (ports hosts) ...) --=20 2.30.0 --=-=-=-- From unknown Tue Sep 23 12:15:56 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#46549] services: tor: Add control-socket? option. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 22 Feb 2021 10:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46549 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Christopher Lemmer Webber Cc: 46549@debbugs.gnu.org Received: via spool by 46549-submit@debbugs.gnu.org id=B46549.161398856125599 (code B ref 46549); Mon, 22 Feb 2021 10:10:01 +0000 Received: (at 46549) by debbugs.gnu.org; 22 Feb 2021 10:09:21 +0000 Received: from localhost ([127.0.0.1]:55712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lE89Z-0006en-Dj for submit@debbugs.gnu.org; Mon, 22 Feb 2021 05:09:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lE89U-0006eU-5W for 46549@debbugs.gnu.org; Mon, 22 Feb 2021 05:09:19 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51624) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE89O-0002Iz-T9; Mon, 22 Feb 2021 05:09:10 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42388 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lE89N-0006jw-2n; Mon, 22 Feb 2021 05:09:09 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87czx1orvf.fsf@dustycloud.org> Date: Mon, 22 Feb 2021 11:09:07 +0100 In-Reply-To: <87czx1orvf.fsf@dustycloud.org> (Christopher Lemmer Webber's message of "Mon, 15 Feb 2021 18:04:04 -0500") Message-ID: <878s7gct30.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hey Chris, Christopher Lemmer Webber skribis: >>>From b85d5d49678ae11fd5a855acddbc78be123d863c Mon Sep 17 00:00:00 2001 > From: Christopher Lemmer Webber > Date: Mon, 15 Feb 2021 17:57:04 -0500 > Subject: [PATCH] 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->torrc): LGTM, thanks! :-) Ludo=E2=80=99. From unknown Tue Sep 23 12:15:56 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Christopher Lemmer Webber Subject: bug#46549: closed (Re: bug#46549: services: tor: Add control-socket? option.) Message-ID: References: <87mtvwb0ve.fsf@dustycloud.org> <87czx1orvf.fsf@dustycloud.org> X-Gnu-PR-Message: they-closed 46549 X-Gnu-PR-Package: guix-patches Reply-To: 46549@debbugs.gnu.org Date: Mon, 22 Feb 2021 15:04:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1614006242-13928-1" This is a multi-part message in MIME format... ------------=_1614006242-13928-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #46549: services: tor: Add control-socket? option. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 46549@debbugs.gnu.org. --=20 46549: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D46549 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1614006242-13928-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 46549-done) by debbugs.gnu.org; 22 Feb 2021 15:03:51 +0000 Received: from localhost ([127.0.0.1]:57046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lECkZ-0003bv-Eq for submit@debbugs.gnu.org; Mon, 22 Feb 2021 10:03:51 -0500 Received: from dustycloud.org ([50.116.34.160]:43616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lECkY-0003bn-8a for 46549-done@debbugs.gnu.org; Mon, 22 Feb 2021 10:03:50 -0500 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 87212265C5; Mon, 22 Feb 2021 10:03:49 -0500 (EST) References: <87czx1orvf.fsf@dustycloud.org> <878s7gct30.fsf@gnu.org> User-agent: mu4e 1.4.13; emacs 27.1 From: Christopher Lemmer Webber To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#46549: services: tor: Add control-socket? option. In-reply-to: <878s7gct30.fsf@gnu.org> Date: Mon, 22 Feb 2021 10:03:49 -0500 Message-ID: <87mtvwb0ve.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 46549-done Cc: 46549-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: > Hey Chris, > > Christopher Lemmer Webber skribis: > >>>>From b85d5d49678ae11fd5a855acddbc78be123d863c Mon Sep 17 00:00:00 2001 >> From: Christopher Lemmer Webber >> Date: Mon, 15 Feb 2021 17:57:04 -0500 >> Subject: [PATCH] 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->torrc): > > LGTM, thanks! :-) > > Ludo=E2=80=99. Pushed, thanks for the review! ------------=_1614006242-13928-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Feb 2021 23:04:21 +0000 Received: from localhost ([127.0.0.1]:38894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBmui-00007q-02 for submit@debbugs.gnu.org; Mon, 15 Feb 2021 18:04:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:55728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBmud-00007f-9f for submit@debbugs.gnu.org; Mon, 15 Feb 2021 18:04:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBmud-0005mm-4I for guix-patches@gnu.org; Mon, 15 Feb 2021 18:04:15 -0500 Received: from dustycloud.org ([50.116.34.160]:59736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBmuU-0000xr-Cx for guix-patches@gnu.org; Mon, 15 Feb 2021 18:04:14 -0500 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 6EDD726614 for ; Mon, 15 Feb 2021 18:04:04 -0500 (EST) User-agent: mu4e 1.4.13; emacs 27.1 From: Christopher Lemmer Webber To: guix-patches@gnu.org Subject: services: tor: Add control-socket? option. Message-ID: <87czx1orvf.fsf@dustycloud.org> Date: Mon, 15 Feb 2021 18:04:04 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=50.116.34.160; envelope-from=cwebber@dustycloud.org; helo=dustycloud.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain This allows users to have an easy way to enable control sockets for Tor. Turning it on does so via a unix domain socket. Intentionally I did not add the localhost+port path because I feel unsure about the safety of that, and nobodey has yet demonstrated a need. I suppose another nice option might be to let the user specify a specific path, but we didn't allow that for the socks-sock, so I was too lazy to allow it here either. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-services-tor-Add-control-socket-option.patch Content-Transfer-Encoding: quoted-printable >From b85d5d49678ae11fd5a855acddbc78be123d863c Mon Sep 17 00:00:00 2001 From: Christopher Lemmer Webber Date: Mon, 15 Feb 2021 17:57:04 -0500 Subject: [PATCH] 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->torrc): --- doc/guix.texi | 9 ++++++++- gnu/services/networking.scm | 13 +++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 535c98a453..81cc24e0e3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -45,7 +45,7 @@ Copyright @copyright{} 2017 Federico Beffa@* Copyright @copyright{} 2017, 2018 Carlo Zancanaro@* Copyright @copyright{} 2017 Thomas Danckaert@* 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, 2019, 2020 Hartmut Goebel@* Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@* @@ -16578,6 +16578,13 @@ If you want to customize the SOCKS socket in more = detail, leave @end table @end deftp =20 +@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 sock= et +@file{/var/run/tor/control-sock}, which will be made writable by members o= f the +@code{tor} group. + @cindex hidden service @deffn {Scheme Procedure} tor-hidden-service @var{name} @var{mapping} Define a new Tor @dfn{hidden service} called @var{name} and implementing 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 =C2=A9 2019 Alex Griffin ;;; Copyright =C2=A9 2020 Brice Waegeneire ;;; Copyright =C2=A9 2021 Oleg Pykhalov +;;; Copyright =C2=A9 2021 Christopher Lemmer Webber ;;; ;;; 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))) =20 (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 config-file services socks-socket-type) + (($ 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 RelaxDirModeChe= ck +ControlSocketsGroupWritable 1\n" + port)) =20 (for-each (match-lambda ((service (ports hosts) ...) --=20 2.30.0 --=-=-=-- ------------=_1614006242-13928-1--