From patchwork Thu Apr 13 01:24:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 49131 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 7CEBC174F1; Thu, 13 Apr 2023 02:25:46 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 60701172C2 for ; Thu, 13 Apr 2023 02:25:45 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmli1-0007qr-6G; Wed, 12 Apr 2023 21:25:09 -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 1pmlhz-0007nm-4y for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmlhu-0004Rg-PO for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmlhu-0008FW-A1 for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62802] [PATCH 1/4] services: syslog: Move configuration to /etc/syslog.conf. References: <20230413011530.1960-1-maxim.cournoyer@gmail.com> In-Reply-To: <20230413011530.1960-1-maxim.cournoyer@gmail.com> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Apr 2023 01:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62802@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 62802-submit@debbugs.gnu.org id=B62802.168134907531632 (code B ref 62802); Thu, 13 Apr 2023 01:25:02 +0000 Received: (at 62802) by debbugs.gnu.org; 13 Apr 2023 01:24:35 +0000 Received: from localhost ([127.0.0.1]:42134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhS-0008E8-Nf for submit@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:35 -0400 Received: from mail-qt1-f178.google.com ([209.85.160.178]:34370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhQ-0008Dq-RP for 62802@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:34 -0400 Received: by mail-qt1-f178.google.com with SMTP id l16so1935483qtv.1 for <62802@debbugs.gnu.org>; Wed, 12 Apr 2023 18:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681349067; x=1683941067; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ew1pgoEQpVf0pKQ2oVSsLSGqhjwKe5wiS97MIGUJkV8=; b=AzTxVPuWz7ffkAO0ngeVQLHXY0CyjJjBn3k4BZl15KLA4RqUrfZAikmwWnXgOW0wmN kFlIKGyG0Y2FEw0RyfMFwSXpa707gidspmsuDEYrqmMofcyTLLDO0zu/g4KuRJG5SYC0 CWdm3vsuBHasw62BFAgIdjf7k7ysfA6t+72tZeQkGakpVZJybrKoJezOKPorU6ID6sx/ PBIYkA57IBK5M7/5mNx9lIDbPvklVypX07AsoeTpUWmIRrpfSjbgUDnyKZ9nJl3m+p3n kIh+6Do7g/YaZeYpz5JKKVyARydfLRqJTL7SNEnT5Zwpowm7kNPDU+A5+7rfa7uvbmsK l/Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681349067; x=1683941067; 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=ew1pgoEQpVf0pKQ2oVSsLSGqhjwKe5wiS97MIGUJkV8=; b=mDLncE/GGthsadXKQ5khbPluXz/lZiRxji59WLbYbYWHUUPGxuVboc5rTCrzc+GJoY YIa+WktrZFKJFEVr16PGPDoZCB0HSU5iDsXTFDq2TGNk2+a44noea8EvRHn3kz4WNiQ1 F0JKUtXmigJtcdzdRUn2cFcd69DTTJ7hOKja2E2wpgqzgc+tyXlceN5/izaX1kJgFxSK vxBNAZShxgrRcwQir8uAZEUj1H5V0gwMRhX+n6ctThpjZ0wBc+QKaP8T6GdY4UH/x6WE JAhBtflHzWn3pI3pSjEl1NFzqA3wa3d/hapx4zcMwNWVXmI1D0y4tQ9QbxDweTSdEhm2 cPuA== X-Gm-Message-State: AAQBX9fjaSdfGnxwdY8oDZ40vbT3K63netbsCs6AufKNpL7cKgmnH6iT 6ysfys29HyYq+s+mAMzb3SAETYPMgk4= X-Google-Smtp-Source: AKy350Y+2FRnqDy6GCV2Ma/d5olgcRcioTmOxC34FkZUdAGvHv9z1KenDq15WuO1JEgfXkbEeSuWug== X-Received: by 2002:a05:622a:1801:b0:3e6:954a:3f9e with SMTP id t1-20020a05622a180100b003e6954a3f9emr700711qtc.60.1681349066695; Wed, 12 Apr 2023 18:24:26 -0700 (PDT) Received: from localhost.localdomain (dsl-152-224.b2b2c.ca. [66.158.152.224]) by smtp.gmail.com with ESMTPSA id l22-20020ac81496000000b003e4c6b2cc35sm142505qtj.24.2023.04.12.18.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 18:24:26 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 12 Apr 2023 21:24:04 -0400 Message-Id: <20230413012408.2759-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Having the configuration live at a static location makes it possible to hot-reload it. * gnu/services/base.scm (syslog.conf): New variable. (syslog-etc, syslog-shepherd-service): New procedures. (syslog-service-type): Rewrite using the above new variable and procedures, extending etc-service-type with its configuration file. --- gnu/services/base.scm | 61 ++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 24 deletions(-) base-commit: 0fe2c78cac19acfb46c3bc365075293e51e0e5aa diff --git a/gnu/services/base.scm b/gnu/services/base.scm index e5c6bf5335..1ed874aa84 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -15,7 +15,7 @@ ;;; Copyright © 2020, 2021 Brice Waegeneire ;;; Copyright © 2021 qblade ;;; Copyright © 2021 Hui Lu -;;; Copyright © 2021, 2022 Maxim Cournoyer +;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer ;;; Copyright © 2021 muradm ;;; Copyright © 2022 Guillaume Le Vaillant ;;; Copyright © 2022 Justin Veilleux @@ -1526,30 +1526,43 @@ (define-record-type* (config-file syslog-configuration-config-file (default %default-syslog.conf))) -(define syslog-service-type - (shepherd-service-type - 'syslog - (lambda (config) - (define config-file - (syslog-configuration-config-file config)) +;;; Note: a static file name is used for syslog.conf so that the reload action +;;; work as intended. +(define syslog.conf "/etc/syslog.conf") - (shepherd-service - (documentation "Run the syslog daemon (syslogd).") - (provision '(syslogd)) - (requirement '(user-processes)) - (actions (list (shepherd-configuration-action config-file))) - (start #~(let ((spawn (make-forkexec-constructor - (list #$(syslog-configuration-syslogd config) - "--rcfile" #$config-file) - #:pid-file "/var/run/syslog.pid"))) - (lambda () - ;; Set the umask such that file permissions are #o640. - (let ((mask (umask #o137)) - (pid (spawn))) - (umask mask) - pid)))) - (stop #~(make-kill-destructor)))) - (syslog-configuration) +(define (syslog-etc configuration) + (match-record configuration + (config-file) + (list `(,(basename syslog.conf) ,config-file)))) + +(define (syslog-shepherd-service config) + (define config-file + (syslog-configuration-config-file config)) + + (shepherd-service + (documentation "Run the syslog daemon (syslogd).") + (provision '(syslogd)) + (requirement '(user-processes)) + (actions (list (shepherd-configuration-action syslog.conf))) + (start #~(let ((spawn (make-forkexec-constructor + (list #$(syslog-configuration-syslogd config) + #$(string-append "--rcfile=" syslog.conf)) + #:pid-file "/var/run/syslog.pid"))) + (lambda () + ;; Set the umask such that file permissions are #o640. + (let ((mask (umask #o137)) + (pid (spawn))) + (umask mask) + pid)))) + (stop #~(make-kill-destructor)))) + +(define syslog-service-type + (service-type + (name 'syslog) + (default-value (syslog-configuration)) + (extensions (list (service-extension shepherd-root-service-type + (compose list syslog-shepherd-service)) + (service-extension etc-service-type syslog-etc))) (description "Run the syslog daemon, @command{syslogd}, which is responsible for logging system messages."))) From patchwork Thu Apr 13 01:24:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 49130 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 4485B174F9; Thu, 13 Apr 2023 02:25:46 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8D4F2173E2 for ; Thu, 13 Apr 2023 02:25:45 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmli0-0007q8-Ka; Wed, 12 Apr 2023 21:25:08 -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 1pmlhy-0007ni-JA for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmlhu-0004Wb-Ur for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmlhu-0008Fd-Qq for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62802] [PATCH 2/4] services: syslog: Add a reload action. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Apr 2023 01:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62802@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 62802-submit@debbugs.gnu.org id=B62802.168134907831648 (code B ref 62802); Thu, 13 Apr 2023 01:25:02 +0000 Received: (at 62802) by debbugs.gnu.org; 13 Apr 2023 01:24:38 +0000 Received: from localhost ([127.0.0.1]:42137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhW-0008EO-8L for submit@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:38 -0400 Received: from mail-qt1-f182.google.com ([209.85.160.182]:41623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhU-0008Dy-Ag for 62802@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:37 -0400 Received: by mail-qt1-f182.google.com with SMTP id a23so9980327qtj.8 for <62802@debbugs.gnu.org>; Wed, 12 Apr 2023 18:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681349070; x=1683941070; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/oLdcWqObvN0tAoohB66ma2M+2OuUUxyvmJ+2vHofrw=; b=F8ZLnRFAB7GVrHZL0//82lXH0ZktAEzoY7aQvrVAz3lurkO8szi7tWMPNbzY9UvSFH 462hToHpQkaO3GqEHHPKlQI2ZC/0wLoA/13T1EHn24ofeQa9BMwdchrJwY7EOKiRdwJ2 D25sDivgQQIL4iSFLuReKtVrbW/y85I6jWO/Q+A4YI8awqVGGiCS8LBOiJtDYXQv4GWq ParYIijcy1uEw22O0Akbvjm4p7PVIXyioBRL3Hh1ihAlu9Jp13gtO8foth/w9Zf4124D CTtSOumVjdNG4oXb7D3PVCoO8wwyIWRjcfalWGzxKN24RLhn/BXsooCc7zzIUtY9sraK 1aTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681349070; x=1683941070; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/oLdcWqObvN0tAoohB66ma2M+2OuUUxyvmJ+2vHofrw=; b=k+5oTRbF+XhxbqperzHtnnrdBJFzmspTr7InFK3gj5YSPNx5PBPU6+UictMPP189AR LT2UE0JDli3MOE9bo2aIZM1qro9ds24kxIqPsWf0Y/42hwSO2qw7RqzjFfUfMuxLuaU+ YjwE1MXVV5oUpj+L+k1DIl6yuWbejqw9LFdOanz0qpKGahnlPTPkKmz3+5CflsQrmald AdMhAHTo9gWaE3mJ/uWZGoF5JMpe3Ld7LU4rTd53kGJrM/iZqi/hqQMWot8/DkndX24x qTWkF1jxPEVohftp8Ff7RYshPUaZDgrRpwj3In4E8qWbQUmEOlOEfpoN840yPq7vtvtE cQ5A== X-Gm-Message-State: AAQBX9cLpTSjxka1W00ABv+uDNu3jSylxDF6OWw9ITbCyC5QijKr/6Lm 5kWLZvTCDd3roRCs98lXhm7ulddYVrA= X-Google-Smtp-Source: AKy350aI/GDDXmPepigUwaZAJOwB4Jn4XuYrbExR3hcauTPqopuSV5wO3IDNMKo89wSwgX/r3fMGrw== X-Received: by 2002:ac8:7d94:0:b0:3b8:6ca4:bb23 with SMTP id c20-20020ac87d94000000b003b86ca4bb23mr885415qtd.15.1681349070491; Wed, 12 Apr 2023 18:24:30 -0700 (PDT) Received: from localhost.localdomain (dsl-152-224.b2b2c.ca. [66.158.152.224]) by smtp.gmail.com with ESMTPSA id l22-20020ac81496000000b003e4c6b2cc35sm142505qtj.24.2023.04.12.18.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 18:24:30 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 12 Apr 2023 21:24:05 -0400 Message-Id: <20230413012408.2759-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413012408.2759-1-maxim.cournoyer@gmail.com> References: <20230413012408.2759-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/base.scm (syslog-service-type) [actions]: Add a reload action. * doc/guix.texi (Base Services): Document it. --- doc/guix.texi | 12 ++++++++++++ gnu/services/base.scm | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index acb6f0c2e1..70909917a5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18573,6 +18573,18 @@ Type of the service that runs the syslog daemon, whose value is a @code{} object. @end defvar +To have a modified @code{syslog-configuration} come into effect after +reconfiguring your system, the @samp{reload} action should be preferred +to restarting the service, as many services such as the login manager +depend on it and would be restarted as well: + +@example +# herd reload syslog +@end example + +which will cause the running @command{syslogd} process to reload its +configuration. + @deftp {Data Type} syslog-configuration Data type representing the configuration of the syslog daemon. diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 1ed874aa84..db7a0bbc56 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1543,7 +1543,21 @@ (define config-file (documentation "Run the syslog daemon (syslogd).") (provision '(syslogd)) (requirement '(user-processes)) - (actions (list (shepherd-configuration-action syslog.conf))) + (actions + (list (shepherd-configuration-action syslog.conf) + (shepherd-action + (name 'reload) + (documentation "Reload the configuration file from disk.") + (procedure + #~(lambda (pid) + (if pid + (begin + (kill pid SIGHUP) + (display #$(G_ "Service syslog has been asked to \ +reload its settings file."))) + (display #$(G_ "Service syslog is not running.")))))))) + ;; Note: a static file name is used for syslog.conf so that the reload + ;; action work as intended. (start #~(let ((spawn (make-forkexec-constructor (list #$(syslog-configuration-syslogd config) #$(string-append "--rcfile=" syslog.conf)) From patchwork Thu Apr 13 01:24:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 49129 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 C39D7174BB; Thu, 13 Apr 2023 02:25:41 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C5F62173E2 for ; Thu, 13 Apr 2023 02:25:40 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmli0-0007pu-FY; Wed, 12 Apr 2023 21:25:08 -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 1pmlhz-0007ns-4y for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmlhv-0004Zs-D2 for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmlhv-0008Fk-94 for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62802] [PATCH 3/4] services/syslog: Strip leading white space indent in syslog.conf. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Apr 2023 01:25:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62802@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 62802-submit@debbugs.gnu.org id=B62802.168134908131664 (code B ref 62802); Thu, 13 Apr 2023 01:25:03 +0000 Received: (at 62802) by debbugs.gnu.org; 13 Apr 2023 01:24:41 +0000 Received: from localhost ([127.0.0.1]:42140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhZ-0008Ee-IG for submit@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:41 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:44869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhX-0008E7-NS for 62802@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:40 -0400 Received: by mail-qt1-f173.google.com with SMTP id cg4so4977220qtb.11 for <62802@debbugs.gnu.org>; Wed, 12 Apr 2023 18:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681349074; x=1683941074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SN+J/ZlWLAFtrbldkmME74Nw70ZO4SBPficaocjB9v4=; b=djrglG3LAChzk1KMds77K9fWoD9GcYYG6SWSWDuyiCix91UPUDQkykNR9sFj+0jILw 7aaIz1Pngjit6iixEP8Ly1Oe7X6vsk3tLTqU2AJiSO78z5944FK6SVwl+rdgdgen0lLf u1FfyPZPnCBQ4JJzUzWcehqN5pWM1ly3b8Kf2DC12TQyVPE8tERFoP/glgWKoONr96yL meyYPgDsBeq5IFC150Bf+ubdqjx/rAcxyXbQjT72xtGnzgqKB9TFkW/3x39hj/du6Px9 Yu8pAT7t93IKmcnSuJX//SCy7R3Em5ddi943+E1LvpIcgeIttGPwTJkvlmAyuo5kX+Xm Alkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681349074; x=1683941074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SN+J/ZlWLAFtrbldkmME74Nw70ZO4SBPficaocjB9v4=; b=IUy+S3eL+M1jUcMwdiVdWYj67mLr3DX8Dc2v9UPI1QK4E1G+nn4uZmHrUSwK5wI5wn uOh8urYC+hsad7VA2s2XJKUECVn9sx23YnYYfgSuBkWchWLgnmrsJNA4fhrVjucBaAlX rzGUnF2SC+zmyL1KaWQx2zzEbqu+/qqGBy17P0Mz6KvZ/ozohcr91D6tioN9f7NChYFr e5IH+3iCR5iFVjOYtLMFnOB6MZY6HxJnWdXuJ+/8PEXxr6plk3aQ1ZG6iJP92BTTuoYh ixdyiAhee56Mcj92I/0DQv5UywiuG/2d+KVchPkr/jxA7YRTMeiM+FohJ8NejiF7nXAl ULwQ== X-Gm-Message-State: AAQBX9eJGU1aiK1it5yzTBvQXG7Sjl0JCcdjiE4NwzLPPhxRT2cKEeG9 rnFlAVXWrSZS5L8zH/lfjihIqI0oC7I= X-Google-Smtp-Source: AKy350b2YnduisSXBBfdkQZwg61evGb6qh43khaR01Qpt64y+6/+o3TJj/PAdtRQxX3+m/EIoli+DA== X-Received: by 2002:a05:622a:4:b0:3e3:5ac8:c17f with SMTP id x4-20020a05622a000400b003e35ac8c17fmr944257qtw.4.1681349074086; Wed, 12 Apr 2023 18:24:34 -0700 (PDT) Received: from localhost.localdomain (dsl-152-224.b2b2c.ca. [66.158.152.224]) by smtp.gmail.com with ESMTPSA id l22-20020ac81496000000b003e4c6b2cc35sm142505qtj.24.2023.04.12.18.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 18:24:33 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 12 Apr 2023 21:24:06 -0400 Message-Id: <20230413012408.2759-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413012408.2759-1-maxim.cournoyer@gmail.com> References: <20230413012408.2759-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This is a cosmetic change. * gnu/services/base.scm (%default-syslog.conf): Add a comment referencing the documentation. Strip the extraneous leading trailing white space indent. --- gnu/services/base.scm | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index db7a0bbc56..0cde151e1a 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1491,31 +1491,34 @@ (define-deprecated (nscd-service #:optional (config (nscd-configuration))) Service Switch}, for an example." (service nscd-service-type config)) -;; Snippet adapted from the GNU inetutils manual. +;;; Snippet adapted from the GNU inetutils manual. (define %default-syslog.conf - (plain-file "syslog.conf" " - # Log all error messages, authentication messages of - # level notice or higher and anything of level err or - # higher to the console. - # Don't log private authentication messages! - *.alert;auth.notice;authpriv.none -/dev/console + (plain-file "syslog.conf" "\ +# See info '(inetutils) syslogd invocation' for the documentation +# of the syslogd configuration syntax. - # Log anything (except mail) of level info or higher. - # Don't log private authentication messages! - *.info;mail.none;authpriv.none -/var/log/messages +# Log all error messages, authentication messages of +# level notice or higher and anything of level err or +# higher to the console. +# Don't log private authentication messages! +*.alert;auth.notice;authpriv.none -/dev/console - # Log \"debug\"-level entries and nothing else. - *.=debug -/var/log/debug +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none -/var/log/messages - # Same, in a different place. - *.info;mail.none;authpriv.none -/dev/tty12 +# Log \"debug\"-level entries and nothing else. +*.=debug -/var/log/debug - # The authpriv file has restricted access. - # 'fsync' the file after each line (hence the lack of a leading dash). - authpriv.* /var/log/secure +# Same, in a different place. +*.info;mail.none;authpriv.none -/dev/tty12 - # Log all the mail messages in one place. - mail.* -/var/log/maillog +# The authpriv file has restricted access. +# 'fsync' the file after each line (hence the lack of a leading dash). +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog ")) (define-record-type* From patchwork Thu Apr 13 01:24:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 49128 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 EE5E9174BC; Thu, 13 Apr 2023 02:25:31 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 82E4E172C2 for ; Thu, 13 Apr 2023 02:25:31 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmli0-0007qW-UN; Wed, 12 Apr 2023 21:25:08 -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 1pmlhz-0007nn-1X for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmlhv-0004Zt-QM for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmlhv-0008Ft-M5 for guix-patches@gnu.org; Wed, 12 Apr 2023 21:25:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62802] [PATCH 4/4] services: syslog: Log auth.info to /var/log/secure in default configuration. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Apr 2023 01:25:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62802@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 62802-submit@debbugs.gnu.org id=B62802.168134908531680 (code B ref 62802); Thu, 13 Apr 2023 01:25:03 +0000 Received: (at 62802) by debbugs.gnu.org; 13 Apr 2023 01:24:45 +0000 Received: from localhost ([127.0.0.1]:42143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlhc-0008Eu-Sa for submit@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:45 -0400 Received: from mail-qt1-f171.google.com ([209.85.160.171]:35381) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmlha-0008EM-OE for 62802@debbugs.gnu.org; Wed, 12 Apr 2023 21:24:43 -0400 Received: by mail-qt1-f171.google.com with SMTP id bn8so11919648qtb.2 for <62802@debbugs.gnu.org>; Wed, 12 Apr 2023 18:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681349077; x=1683941077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V6HzVwoWL277lhWPXtjzT8KL0q0jSRzVX6DqtbuVvXg=; b=lwAJArsMFSqOpj5+dim8P4vsuS1uHR/8wE5cTR8lLtERWNANOaUo72KpbZjyxFv3b7 MRw81aB7WHrVoAD5aPS/ty8ltMlM6cux4eiJEPxF3o4iifEgcOUJIBW6VMZxkqfa3juG s76IhsgTI2OyVKaot7LqpjtzJrcEi7/yfWvIca7hotSockC8MPibGjQx33HophdRmevn +5bixDd5WPaCaOTyEKTT76d/mRFnGLfrTryQwcGQKIGH/oRO8tPInVngqj6m4zz3yL1j 0apNRLvKO0TBJmtDHgDv41LpaFvbjQQUiCFclVs/psQ4CUFgBdVWGG7kx+YxKNy/jw+8 aFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681349077; x=1683941077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V6HzVwoWL277lhWPXtjzT8KL0q0jSRzVX6DqtbuVvXg=; b=BhUfiRQqHWm9a7ETLw/7Ts7TuZOJOl/zXR7WHVvFz4PRv/6SFtz5VA8esCVZN93Zy7 ldCFM/9eB6NTc5uTfNeVYteWNbbVh3CF2ScKnQ9Lf/WtqbiqO/liu/x2vO3crXGZN9zy fh0Beb6hqvx+Dcf4azMivtldmTLHDh9pBZENtRD77qGrR+n6V4NyqqIZpYDHGARTD5u1 UJQZR7sTfyqZqkPOyQAvs9xvbr45vE/Zsq3ekTHm+4MwOSgfOM3lL2bvM3ypeoO3+35J gq3bv24VXzYCt4OUqmopwqhD6OEzzl9j1Ooq1acN6+asjjy02tOYAjcq5EHWv8maamfe EjUg== X-Gm-Message-State: AAQBX9cgfgeKBP2tIO3v+88CvloR6z0ApbhswOpeaEEvZ5HCSMf6ewgl Uz85qOwVqhwYDg3AKtJS8o0KTGG/vI4= X-Google-Smtp-Source: AKy350brZvNKYeKZSjwsSKVj/yKfX89HrFuGytbIPXd7320CsFB6JkhYSmhXfHfH57GaJJPtxYx9Rg== X-Received: by 2002:a05:622a:8f:b0:3b8:60b9:e75b with SMTP id o15-20020a05622a008f00b003b860b9e75bmr873956qtw.3.1681349077117; Wed, 12 Apr 2023 18:24:37 -0700 (PDT) Received: from localhost.localdomain (dsl-152-224.b2b2c.ca. [66.158.152.224]) by smtp.gmail.com with ESMTPSA id l22-20020ac81496000000b003e4c6b2cc35sm142505qtj.24.2023.04.12.18.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 18:24:36 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 12 Apr 2023 21:24:07 -0400 Message-Id: <20230413012408.2759-4-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413012408.2759-1-maxim.cournoyer@gmail.com> References: <20230413012408.2759-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This causes authentication failures such as those generated by SSH brute force attacks to appear in /var/log/secure, which is picked up by tools such as fail2ban. * gnu/services/base.scm (%default-syslog.conf): Add a auth.info selector for the /var/log/secure log. --- gnu/services/base.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 0cde151e1a..282d36c8b1 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1515,7 +1515,9 @@ (define %default-syslog.conf # The authpriv file has restricted access. # 'fsync' the file after each line (hence the lack of a leading dash). -authpriv.* /var/log/secure +# Also include unprivileged auth logs of info or higher level +# to conveniently gather the authentication data at the same place. +authpriv.*;auth.info /var/log/secure # Log all the mail messages in one place. mail.* -/var/log/maillog