From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 8EmtIhrhJWYaHwAAqHPOHw:P1 (envelope-from ) for ; Mon, 22 Apr 2024 06:01:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 8EmtIhrhJWYaHwAAqHPOHw (envelope-from ) for ; Mon, 22 Apr 2024 06:01:30 +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=nKdqpJWX; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713758490; 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=g4LsYtQrFF9cYf4DGGX2LknC+LGEH/Rg9sHLzc/IhkI=; b=A6SH2Yrd+MtS0pLZDSq1UFY/Sb5pTXIREeL7niPplnEi/yNIy+EVIuuqcKziegenRMDLoQ WEwI0mnErdJOi7UzvR3Ytqf1URfSKcFEfLeBWD9+YVwKvv7tDZV5EB+9LOr/oZxZ+X30ya GNl7L2OlkVTGNa45cp8u8xlr6TC/rmFdMGfrcWLWPePuZoSIkh+jYQNrow88k2ux/H8bPq QvfoV9yNNxAu6NUpNVKYKyEczQBMdXlheb6sTJJ30XARAsJ/8d3dfTxKqwZ94X7BONhCTC OSIT+/mc9xENCUHA0MjiSwVgRtw6uQmV7SId24uGJE9aOlGOeMLJTpsirLmRvw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713758490; a=rsa-sha256; cv=none; b=NJQyHavYL01NcMoWmUYKDZkFcVAyj9IYKS2OxEb1Sq/w/+E9wD2G16sT1lvLaEdOafGOl/ 10r/aO5wNs2TgslIfwsyTE/OZnx25NfTvyzEW0mnFE0uwTTz6ijyPr1HqPVIYqrOd3wdmI m1Y49n6A70F08J7ngx1BWRFZN/g+pu9QBRALB3d37AUd0s8OuhqZqtfoRBA9J79fv1FLHJ q2hEJtg11G4jj+2TkwtC94cQgBj5AMWX+4nU/htvU4YtfIXFkdJowv51YpZ+cLmJtdLL2S r2gyoWwuWsLHTs44dWoDG4fpx5JJcx5K4u+Uee12uQ6HBVrlzEpW6hcFEBcOzQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=nKdqpJWX; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) 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 277AA1775A for ; Mon, 22 Apr 2024 06:01:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rykre-0003hy-RX; Mon, 22 Apr 2024 00:01:15 -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 1rykrS-0003hZ-Kf for guix-patches@gnu.org; Mon, 22 Apr 2024 00:00:59 -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 1rykrH-0002ac-88 for guix-patches@gnu.org; Mon, 22 Apr 2024 00:00:54 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rykrW-0003Jo-ND for guix-patches@gnu.org; Mon, 22 Apr 2024 00:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70341] [PATCH v3] 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: Mon, 22 Apr 2024 04:01:02 +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.171375842712511 (code B ref 70341); Mon, 22 Apr 2024 04:01:02 +0000 Received: (at 70341) by debbugs.gnu.org; 22 Apr 2024 04:00:27 +0000 Received: from localhost ([127.0.0.1]:45335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rykqw-0003Fj-HH for submit@debbugs.gnu.org; Mon, 22 Apr 2024 00:00:27 -0400 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:43185) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rykqq-0003Ef-R0 for 70341@debbugs.gnu.org; Mon, 22 Apr 2024 00:00:25 -0400 Received: by mail-lj1-x244.google.com with SMTP id 38308e7fff4ca-2d872102372so37336601fa.0 for <70341@debbugs.gnu.org>; Sun, 21 Apr 2024 21:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713758398; x=1714363198; 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=g4LsYtQrFF9cYf4DGGX2LknC+LGEH/Rg9sHLzc/IhkI=; b=nKdqpJWXx75CE78qWDwubMPJPrEcGdFZrAaqFmb1T66yHg8jPW3mmjxjtXEZMn5rgO t+WJF6tEUO7q/IXHaRFIkxhjSQXV7g+UF7RMQ2vaAxXu5IISOF4sl3W/UFUjA5GLVqIX Cr6onqoEj0/97zxaiki9ta9waBlFZOS5Z92uXnMOX51ODQxzU4OK/27tcNlxmpVGhJjt T9ePS3yeqkIcsbvmZRomg4lit77PQI8iSSWfonqlvAbROVezSWJj20BR0RdYdIN9tGrl oZFL9+SEK3/lXpk69ELKYzCVHbmlQl04vIi28NbtzoaLRryU2oIGBkrrRJorCfew8fE/ y1vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713758398; x=1714363198; 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=g4LsYtQrFF9cYf4DGGX2LknC+LGEH/Rg9sHLzc/IhkI=; b=RdzhtCZOA1BkwqExhdYM6OFXrP9pnSh/H4Ig4+UQ2EzJDmahNu0t9zi4Bo9C8/siaL 6QArmGzyGGO0S67A+yPulDO7RweM1MuEVYBx6opNFqaEJGCZE5Rz/Iz+9YvFnxngueJ8 fD37+9YR4Fhw5wwGgTNg6ejHGgfsuatjQ6NyQDIkUh6Iqh7p92FFPsG6gIpxr5EhHaCX iuz/FgO4oFGLVTA+NWWYUewDM22Ev5YBGE1KqssFt0ABUs6Dxm9V/SNILJ5P9Iz+Gr6L OAmuiC02kccrUj2ik0wd7/BCPP/BKLm+8bcCtCyUoJ/7dUFlQNn1y4LCSplIrWvyUoxw sK/w== X-Gm-Message-State: AOJu0YzhpGkkXkXWoQY8cGaAttYKQxV3jdx3UvjInC3I2RMm72IcG4Hk tbB7V6t5KKuDvEEk6aGBiA3tr9JHs4MDCOBZl2DdRtYzMGUOxHQctAWhAunV X-Google-Smtp-Source: AGHT+IFVgKx8qcyYxcyWXlqNk83W9Qaz/5nIvAAfeSmzufp3w71n+2C5mB1nDX2OC1os8Z5QklRaFg== X-Received: by 2002:a05:651c:33a:b0:2d9:36af:d224 with SMTP id b26-20020a05651c033a00b002d936afd224mr3004587ljp.1.1713758397476; Sun, 21 Apr 2024 20:59:57 -0700 (PDT) Received: from localhost.localdomain ([188.244.176.248]) by smtp.gmail.com with ESMTPSA id z19-20020a2e8e93000000b002d8a12e3d90sm1339702ljk.122.2024.04.21.20.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 20:59:57 -0700 (PDT) From: Nigko Yerden Date: Mon, 22 Apr 2024 08:58:39 +0500 Message-ID: <3af678c4310a58373fe1e86b84f75a1d37e02295.1713758319.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-Migadu-Spam-Score: 2.62 X-Spam-Score: 2.62 X-Migadu-Queue-Id: 277AA1775A X-Migadu-Scanner: mx12.migadu.com X-TUID: y4gSnvPxVjnq Pluggable transports are programs that disguise Tor traffic, which can be useful in case 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: Export 'tor-configuration-transport-plugin-path', 'tor-configuration-pluggable-transport'. (): Add 'transport-plugin' and 'pluggable-transport' fields. (tor-configuration->torrc)[transport-plugin]: Add content to 'torrc' computed-file. (tor-shepherd-service)[transport-plugin]: Add file-system-mapping. Change-Id: I64e7632729287ea0ab27818bb7322fddae43de48 --- doc/guix.texi | 11 ++++++++ gnu/services/networking.scm | 54 ++++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 65af136e61..eb0837860e 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} 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..6e535ea8ef 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. ;;; @@ -159,6 +160,8 @@ (define-module (gnu services networking) tor-configuration-hidden-services tor-configuration-socks-socket-type tor-configuration-control-socket-path + tor-configuration-transport-plugin-path + tor-configuration-pluggable-transport tor-onion-service-configuration tor-onion-service-configuration? tor-onion-service-configuration-name @@ -955,7 +958,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 +995,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 +1035,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 +1054,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: 9fa34ad616b94ad881b5ca48ef88bd84f877a0e9 -- 2.41.0