From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MHerGyb+KmDkHAAA0tVLHw (envelope-from ) for ; Mon, 15 Feb 2021 23:05:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 0B2WFyb+KmBjfQAA1q6Kng (envelope-from ) for ; Mon, 15 Feb 2021 23:05:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6A0B52049C for ; Tue, 16 Feb 2021 00:05:09 +0100 (CET) Received: from localhost ([::1]:54136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBmvU-0005uI-IT for larch@yhetil.org; Mon, 15 Feb 2021 18:05:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBmvO-0005u6-9U for guix-patches@gnu.org; Mon, 15 Feb 2021 18:05:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55581) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBmvO-00019z-2A for guix-patches@gnu.org; Mon, 15 Feb 2021 18:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lBmvN-000090-Ru for guix-patches@gnu.org; Mon, 15 Feb 2021 18:05:01 -0500 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.36 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 6A0B52049C X-Spam-Score: -2.36 X-Migadu-Scanner: scn1.migadu.com X-TUID: MEYpUsLFSzZh --=-=-= 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 --=-=-=--