From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 2O+qHhlaN2RxCgEASxT56A (envelope-from ) for ; Thu, 13 Apr 2023 03:25:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id ePOsHhlaN2T2WwEAauVa8A (envelope-from ) for ; Thu, 13 Apr 2023 03:25:45 +0200 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 44ACC3A5EA for ; Thu, 13 Apr 2023 03:25:45 +0200 (CEST) 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 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1681349145; a=rsa-sha256; cv=none; b=B9ynHCvGZlIXPVC3xK53YZT1I6RDX5LIsLg/NfkhRhdZj5GKEG7SSdo4QMiraZDY/pKhnA aHOcSL/k+ICFE9XQuXoknzqm7QwExCnhTB5UXPEElZyCXpa8rvuAhRBSpMozYUitnuDrc0 vbUOGJNF+UgqHFbopoA9iJly2eud7gXoooVq58c9/KC+1t0KQHCWaV4jMvDH0jNC2ZfEk7 FkwTjeY1xwOXo7ER7dsIMm7BMKd4eYptpT1/iNU0LERvpZeJMQPZZ5B0jTGi4arYRL0Kfk HMrpwEXZX8303gchtDHmHxUWw9FTqq2hYq2jQrpxWtFkHga1ZnI2L0nRx6wf2g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=AzTxVPuW; 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=1681349145; 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=ew1pgoEQpVf0pKQ2oVSsLSGqhjwKe5wiS97MIGUJkV8=; b=YhbBqP2S1oks7RTme/o8c4tvxyfHWxNdH2IFE+lBSdbzpUWQ2lCSlblgRFysCgUppTXS1k WRYGi92Y6Lp0D2u38mob67HVppEr7Ueym1SmG1w039URAm9xDyuLU6vma48CRyVmUkxjBq z2nEsSpPKafUGcDeN+yrTNZdVUQH/slZUmGPczhRQyVLUXZMBBusJ+lZPN2z1PBasTTN26 oV8YTqmZ6un6GwolsCxAneGv4byORAK/QpfgiR8nb6vCXBcz0PqrjcYmHjGA6zztl3cGWE mGziPvQYeQecojPAhAcRkHLuqrYKZJeJIeINH2f3QyqUebn/jY1GHC2JdSs2fA== X-Migadu-Queue-Id: 44ACC3A5EA Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=AzTxVPuW; 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) X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: 4.98 X-Spam-Score: 4.98 X-TUID: JCI+x2BcMX+o 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(-) 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."))) base-commit: 0fe2c78cac19acfb46c3bc365075293e51e0e5aa -- 2.39.2