From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id AGKPHTHVI2bYCQEAe85BDQ:P1 (envelope-from ) for ; Sat, 20 Apr 2024 16:46:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id AGKPHTHVI2bYCQEAe85BDQ (envelope-from ) for ; Sat, 20 Apr 2024 16:46:09 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="Nz3/pywO"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713624369; a=rsa-sha256; cv=none; b=EXGeK2Tyu9AOtFc6VpUCblto5DOcZe5hj20qyOD+y41lwabaShtMNtYSTzczAxHtUOsyXj 3YsxHV2RbkPtI1RHpI+qs+ae7apzFld9Y4uLCh1TRv5M53/WirsZ7WJP5StE1hNVFk/d3O Z8LWay3IRE6Pg/XqYWy1wmdiq0Mxt7jDMfTmHuIw/30b1WuT6isQeb0p+zFpXW2rUzA1Zh 6GixtJWhWm+CzDxr2DUFDhN/fdDJG0OfvnhrKKz8cQ+t/8nkOZ1gf8+4DcCZa53HrFtbU5 6MWT2kSyt4QQpaAGSDqOEcQI7EanIbtNQQDyW/SQkDctdAUYSv0RKcJFZrQk5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="Nz3/pywO"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713624369; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=hzMggZRHPhx9LlQJHpLbUh6ZYrpKzlOeJlfRlaBIXjU=; b=dhvqBMVuVqqA6/e+DKjq4Q2RXw3PlgbKILEaDvZOBQIMgw9btmRnSL+TJ5NhElTgd7nVSm 1UJebYXRGtN0coq9mLrl+yLnzb30gT7qVKi1IaDhYM/1adhEGwaveYrlL4To614tx0Soab gWo+lYqjSHFNg12rw0cK2sModkXToku8+wHE34NAZPJt1yDgm5hKB44R3YDyv+gxsBt5Hy deuFs3YbpMmL0N+h4Fqf8kBSJSy7p5TOL4XWmJRhSK5wd9/gZVGnAAZp8Ngsi3FuybrJ3l Vb/mJTZf8qtz5XOZEk9LVlemiKRPaLWsII7t8ynO7iufBH0yz4efkg9fn9AL3Q== 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 024DE2112A for ; Sat, 20 Apr 2024 16:46:09 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryByP-00049A-J5; Sat, 20 Apr 2024 10:45:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ryByN-00048z-MA for guix-patches@gnu.org; Sat, 20 Apr 2024 10:45:48 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ryByN-0000RA-D8 for guix-patches@gnu.org; Sat, 20 Apr 2024 10:45:47 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryByb-0007DF-T5 for guix-patches@gnu.org; Sat, 20 Apr 2024 10:46:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70341] [PATCH v2] services: tor: Add support for pluggable transports. References: <11e72216f4be8b6559ecc04646fd722daa5dd09d.1712846897.git.nigko.yerden@gmail.com> In-Reply-To: <11e72216f4be8b6559ecc04646fd722daa5dd09d.1712846897.git.nigko.yerden@gmail.com> Resent-From: Nigko Yerden Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 20 Apr 2024 14:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70341 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70341@debbugs.gnu.org Cc: Nigko Yerden Received: via spool by 70341-submit@debbugs.gnu.org id=B70341.171362431327336 (code B ref 70341); Sat, 20 Apr 2024 14:46:01 +0000 Received: (at 70341) by debbugs.gnu.org; 20 Apr 2024 14:45:13 +0000 Received: from localhost ([127.0.0.1]:36649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryBxo-00076q-Vn for submit@debbugs.gnu.org; Sat, 20 Apr 2024 10:45:13 -0400 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]:56431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryBxl-00076g-Cb for 70341@debbugs.gnu.org; Sat, 20 Apr 2024 10:45:10 -0400 Received: by mail-lf1-x144.google.com with SMTP id 2adb3069b0e04-516d4d80d00so3809759e87.0 for <70341@debbugs.gnu.org>; Sat, 20 Apr 2024 07:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713624288; x=1714229088; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hzMggZRHPhx9LlQJHpLbUh6ZYrpKzlOeJlfRlaBIXjU=; b=Nz3/pywO933DMoQXL0H7FNK6E8SH6KBj7DZxfMbeExIw2B3/Eoe4DmXIqGJRSuprBu DttOKsg+CBWcdUjJBOatv8HdfPTerp4VqLT6MV6OzWNKE5T8UkfTlPyXG/zkhE2sZvBK eqFiY9Kt9NLBkzD1jSUW7afKNSrkDT9MUHwjx/YoE3OfWG9V5iWqwVoNhOs0MKVq0B2/ y+aF1ZXIaGyPlgS0FffaLyWjj67EAJ79FFvbcN0TGh7H8be4OcuLu89Jw9FJm04ichvN U+a/BgMsOFDKtEjUAvd4lvskZzZZ5ptV5zrAKTieQkuTjho8NEgA56bf+Ll7pBlgtUZd aaNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713624288; x=1714229088; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hzMggZRHPhx9LlQJHpLbUh6ZYrpKzlOeJlfRlaBIXjU=; b=obGuMo8o5+uHh1xV5gBXwROui7oALvEI0FRAzgt+9ZcpXVMJhhlsCkbz/Oq/9HhCOD bpYlrOpaDhp4+BDyxXfb/SWXvaWci86bKbdzR/qGYhsOvxnLBn92V+26GHgHMdIyzcnH c5Oi9cP1YgI46WWO1uivxLxpK9TI0P1JzzqO+8A0Vfz5KC+8qxTPFfiKvRTu3P71+gVM YFRfIFbJWpK0+Z0oujpmRtkLhzO6OP1x9vxv11DIjRg0SHICvyztnX9o3Ej3t+Ur+SDd W94nTDsm90O9/HZFx1Rns+87wj0wyFynwlAI1nZrjXNinrgesxMuxu9VbkMDbtxbmxHt U/9w== X-Gm-Message-State: AOJu0Yx4eayndDMEkpBMHudjle8nH5wlF3CBV1qzg8Ma8au/pdzlgxZS wcBADkLZt1lMUT20QWYoOF0X0mjnoFvdR/MpZYvINTri9koywQQ5J0IGKbDd X-Google-Smtp-Source: AGHT+IE5FVaIBqgD4IatsdJ2kvzqhyWxUOA9alkB0PvDlcdQwE03YxRh1rQSLJ+CjJtNspY9nnvpFA== X-Received: by 2002:a05:6512:3b96:b0:51a:c9a2:58e with SMTP id g22-20020a0565123b9600b0051ac9a2058emr3481491lfv.29.1713624287770; Sat, 20 Apr 2024 07:44:47 -0700 (PDT) Received: from localhost.localdomain ([188.68.139.217]) by smtp.gmail.com with ESMTPSA id h7-20020a056512220700b0051ac9a1cbdbsm625736lfu.50.2024.04.20.07.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 07:44:47 -0700 (PDT) From: Nigko Yerden Date: Sat, 20 Apr 2024 19:43:03 +0500 Message-ID: <714e3316b5a14168c495253ae585c9e73361b11a.1713624182.git.nigko.yerden@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -5.28 X-Migadu-Queue-Id: 024DE2112A X-Migadu-Spam-Score: -5.28 X-Migadu-Scanner: mx10.migadu.com X-TUID: t7QXqO9sYApu Pluggable transports are programs that disguise Tor traffic, which can be useful in cases when Tor is censored. Pluggable transports cannot be configured by #:config-file file exclusively because Tor process is run via 'least-authority-wrapper' and cannot have access to transport plugin, which is a separate executable (Bug:#70302, Bug:#70332). * doc/guix.texi (Networking Services): Document 'transport-plugin' and 'pluggable-transport' options for 'tor-configuration'. * gnu/services/networking.scm (): Add 'transport-plugin' and 'pluggable-transport' fields. (tor-configuration->torrc)[transport-plugin]: Add content to 'torrc' computed-file. (tor-shepherd-service)[transport-plugin-path]: Add file-system-mapping. Change-Id: I64e7632729287ea0ab27818bb7322fddae43de48 --- doc/guix.texi | 11 ++++++++ gnu/services/networking.scm | 52 +++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 65af136e61..9fbe928484 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -127,6 +127,7 @@ Copyright @copyright{} 2024 Herman Rimm@* Copyright @copyright{} 2024 Matthew Trzcinski@* Copyright @copyright{} 2024 Richard Sent@* +Copyright @copyright{} 2024 Nigko Yerden@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -21849,6 +21850,16 @@ Networking Services @file{/var/run/tor/control-sock}, which will be made writable by members of the @code{tor} group. +@item @code{transport-plugin} (default: @code{#f}) +This must be either @code{#f}, in which case the pluggable transports are +not used by Tor, or a ``file-like'' object pointing to the pluggable transport +plugin executable. In the latter case the @code{#:config-file} file +should contain line(s) configuring one or more bridges. + +@item @code{pluggable-transport} (default: @code{"obfs4"}) +A string that specifies the type of the pluggable transport in +case @code{#:transport-plugin} is not @code{#f}. + @end table @end deftp diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 8e64e529ab..e47f7ca61a 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -22,6 +22,7 @@ ;;; Copyright © 2023 Declan Tsien ;;; Copyright © 2023 Bruno Victal ;;; Copyright © 2023 muradm +;;; Copyright © 2024 Nigko Yerden ;;; ;;; This file is part of GNU Guix. ;;; @@ -955,7 +956,11 @@ (define-record-type* (socks-socket-type tor-configuration-socks-socket-type ; 'tcp or 'unix (default 'tcp)) (control-socket? tor-configuration-control-socket-path - (default #f))) + (default #f)) + (transport-plugin tor-configuration-transport-plugin-path + (default #f)) + (pluggable-transport tor-configuration-pluggable-transport + (default "obfs4"))) (define %tor-accounts ;; User account and groups for Tor. @@ -988,7 +993,8 @@ (define-configuration/no-serialization tor-onion-service-configuration (define (tor-configuration->torrc config) "Return a 'torrc' file for CONFIG." (match-record config - (tor config-file hidden-services socks-socket-type control-socket?) + (tor config-file hidden-services socks-socket-type control-socket? + transport-plugin pluggable-transport) (computed-file "torrc" (with-imported-modules '((guix build utils)) @@ -1027,6 +1033,13 @@ (define (tor-configuration->torrc config) (cons name mapping))) hidden-services)) + (when #$transport-plugin + (format port "\ +UseBridges 1 +ClientTransportPlugin ~a exec ~a~%" + #$pluggable-transport + #$transport-plugin)) + (display "\ ### End of automatically generated lines.\n\n" port) @@ -1039,23 +1052,30 @@ (define (tor-configuration->torrc config) (define (tor-shepherd-service config) "Return a running Tor." (let* ((torrc (tor-configuration->torrc config)) + (transport-plugin-path (tor-configuration-transport-plugin-path config)) (tor (least-authority-wrapper (file-append (tor-configuration-tor config) "/bin/tor") #:name "tor" - #:mappings (list (file-system-mapping - (source "/var/lib/tor") - (target source) - (writable? #t)) - (file-system-mapping - (source "/dev/log") ;for syslog - (target source)) - (file-system-mapping - (source "/var/run/tor") - (target source) - (writable? #t)) - (file-system-mapping - (source torrc) - (target source))) + #:mappings (append + (list (file-system-mapping + (source "/var/lib/tor") + (target source) + (writable? #t)) + (file-system-mapping + (source "/dev/log") ;for syslog + (target source)) + (file-system-mapping + (source "/var/run/tor") + (target source) + (writable? #t)) + (file-system-mapping + (source torrc) + (target source))) + (if transport-plugin-path + (list (file-system-mapping + (source transport-plugin-path) + (target source))) + '())) #:namespaces (delq 'net %namespaces)))) (list (shepherd-service (provision '(tor)) base-commit: 0f68306268773f0eaa4327e1f6fdcb39442e4a34 -- 2.41.0