From patchwork Thu Oct 21 11:56:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Geerinckx-Rice X-Patchwork-Id: 33996 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5875A27BBE3; Thu, 21 Oct 2021 12:57:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DFA5B27BBE1 for ; Thu, 21 Oct 2021 12:57:19 +0100 (BST) Received: from localhost ([::1]:33472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdWhC-0002Dj-So for patchwork@mira.cbaines.net; Thu, 21 Oct 2021 07:57:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdWgx-0002Da-TR for guix-patches@gnu.org; Thu, 21 Oct 2021 07:57:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdWgv-0000vF-Tq for guix-patches@gnu.org; Thu, 21 Oct 2021 07:57:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mdWgv-0003w8-Sy for guix-patches@gnu.org; Thu, 21 Oct 2021 07:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51315] [PATCH] services: tor: Raise file descriptor ulimit. Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Oct 2021 11:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51315 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51315@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163481739415088 (code B ref -1); Thu, 21 Oct 2021 11:57:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Oct 2021 11:56:34 +0000 Received: from localhost ([127.0.0.1]:56339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdWgT-0003vI-LR for submit@debbugs.gnu.org; Thu, 21 Oct 2021 07:56:33 -0400 Received: from lists.gnu.org ([209.51.188.17]:36874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdWgQ-0003vA-TQ for submit@debbugs.gnu.org; Thu, 21 Oct 2021 07:56:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdWgQ-0002DI-J9 for guix-patches@gnu.org; Thu, 21 Oct 2021 07:56:30 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]:32806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdWgK-0000Qf-HQ for guix-patches@gnu.org; Thu, 21 Oct 2021 07:56:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=jTPw5gkr+RlWN xWWN0UcBpT6JEkHDq8b5RTBDpEBknE=; h=date:subject:to:from; d=tobias.gr; b=UQilb/PD04nCxBEJMpHK6l9fgEIoAFwtBWnRhdagaPrTjKPFXRmz5dTxbVG/R1XsKv+V UmLXPjYNohEw5zOWknv/MxY2pGKum1/Gj10uUPfjKnRxhV3W/hMH1yHJXYmYKevGJAv6dH VM8tOxBoE+T6Ppcav3+J4cXiP5mDS45kUd2ZJU2bU6I1xgBnmHWDLomP6x2VV5DeEKn9SK NEOBUGIdk97n/1ZQkNvl0rNTaSh9ZFmKROmHB+VuWvVifeLrKUHzuREyto7TGYwNeuPfmb BHmH8Ayy55gx94bOw1jYb0tDgZGK3OgtsfuEpPFhoq3+YqJKvQUXn1a7whGck1UQ== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 801422dd (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Thu, 21 Oct 2021 11:56:15 +0000 (UTC) Date: Thu, 21 Oct 2021 13:56:22 +0200 Message-Id: <20211021115622.826-1-me@tobias.gr> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Tobias Geerinckx-Rice X-ACL-Warn: , Tobias Geerinckx-Rice via Guix-patches X-Patchwork-Original-From: Tobias Geerinckx-Rice via Guix-patches via From: Tobias Geerinckx-Rice X-getmail-retrieved-from-mailbox: Patches * gnu/services/tor.scm (tor-shepherd-service): Run ulimit -n before launching Tor. --- Guix, I got a kind mail from an authorised Torperson[0] that one of my nodes was running low on efdees. Sure enough, it was the Guix one. This patch does the job, but boy, would I like to know if there's a better way to do it. Kind regards, T G-R [0]: Yes, I did bite their official-looking badge to make sure it wasn't just someone trying to ingratiate themselves with incompetent relay operators. gnu/services/networking.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index e19add927d..13150cb98e 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -948,34 +948,40 @@ (define (tor-shepherd-service config) (($ tor) (let ((torrc (tor-configuration->torrc config))) (with-imported-modules (source-module-closure '((gnu build shepherd) (gnu system file-systems))) (list (shepherd-service (provision '(tor)) ;; Tor needs at least one network interface to be up, hence the ;; dependency on 'loopback'. (requirement '(user-processes loopback syslogd)) (modules '((gnu build shepherd) (gnu system file-systems))) + ;; The file descriptor ulimit must be raised in the + ;; environment from which the daemon is launched; see + ;; https://gitweb.torproject.org/tor.git/plain/doc/TUNING + ;; The exact number is somewhat arbitrary but taken from + ;; https://gitweb.torproject.org/debian/tor.git/tree/debian/tor.init#n40 (start #~(make-forkexec-constructor/container (list #$(file-append bash "/bin/bash") "-c" (string-append "ulimit -n 32768; exec " - #$(file-append tor "/bin/tor") " -f " #$torrc)) + #$(file-append tor "/bin/tor") + " -f " #$torrc)) #:log-file "/var/log/tor.log" #: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))) #:pid-file "/var/run/tor/tor.pid")) (stop #~(make-kill-destructor))