From patchwork Thu Mar 10 16:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fesoj000 X-Patchwork-Id: 37726 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 8E32527BBEA; Thu, 10 Mar 2022 16:30:31 +0000 (GMT) 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_H5,RCVD_IN_MSPIKE_WL,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 1897027BBE9 for ; Thu, 10 Mar 2022 16:30:31 +0000 (GMT) Received: from localhost ([::1]:54248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSLgM-0003cj-8n for patchwork@mira.cbaines.net; Thu, 10 Mar 2022 11:30:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSLfv-0003cT-Cv for guix-patches@gnu.org; Thu, 10 Mar 2022 11:30:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nSLfv-0004Mm-3G for guix-patches@gnu.org; Thu, 10 Mar 2022 11:30:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nSLfu-0008Lz-VS for guix-patches@gnu.org; Thu, 10 Mar 2022 11:30:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54309] [PATCH] services: auditd: use exclusive log directory for auditd References: In-Reply-To: Resent-From: fesoj000 Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 10 Mar 2022 16:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54309@debbugs.gnu.org Received: via spool by 54309-submit@debbugs.gnu.org id=B54309.164692977832054 (code B ref 54309); Thu, 10 Mar 2022 16:30:02 +0000 Received: (at 54309) by debbugs.gnu.org; 10 Mar 2022 16:29:38 +0000 Received: from localhost ([127.0.0.1]:35349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSLfV-0008Kw-Sm for submit@debbugs.gnu.org; Thu, 10 Mar 2022 11:29:38 -0500 Received: from mail-wm1-f51.google.com ([209.85.128.51]:45869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSLfU-0008Kf-0i for 54309@debbugs.gnu.org; Thu, 10 Mar 2022 11:29:36 -0500 Received: by mail-wm1-f51.google.com with SMTP id k29-20020a05600c1c9d00b003817fdc0f00so3715976wms.4 for <54309@debbugs.gnu.org>; Thu, 10 Mar 2022 08:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject :content-language:to:content-transfer-encoding; bh=2XLRdKwdlMymofDXtAQhcpWE05SxVzV11tRAFLlpFNo=; b=Fu98BkXdx3qew0dCzKNFUAhcsnBRC7MOMAi05Gz0dbQwu2DRQljKbZfKlffLAc/cMd 9wnGHl33sk4fVBoU1Cfvmb/dGIJ3UPD4lZkDDlBmrYwgwSbMqjVH0eQTbS+oewsAACIt UkoKBfoV5sH4BF92jfq5HYbtE5ZF0TKrzEhY+SA/SuicuhUw85h8XajhYgjupH+/dtXT EZqv56CaVjn1a5hdzkRdhuVvGxta8Y4dNHCgwxBfJbLVAWxio5ICAZiNcueApWhs6iqz pfpTVcndau8b4xmos/01Q74REnxnaKUis0tG26j/lguMz9PFZK/3j6PxaxtpjSW5GbYV ZCfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:content-language:to:content-transfer-encoding; bh=2XLRdKwdlMymofDXtAQhcpWE05SxVzV11tRAFLlpFNo=; b=dWOlwjb5uMRdP7hsMsCxN2ssTQYEM8wRpyrnDLNwsuksvnab+dw9yHn0w00ED+1ZaU TFwMfUGOgtcxe1bUI4WwwzCTJMKV9/D5uREG3USQeEd0ts53oagNzB+14/eCYUQUSwzi aVUrhwPJj73theT7EYDDwIiZtyEOR3cN+sFNq59Dt2jTyQEgY7Nf7m1RUWbMqeUp6Q4+ Qwx6qA6LvfOIw54ycb1YsknRjSt4FEX5fuuT/yV+RffsbM6gW+RyuOGwp+MHuJjhT+6u CZx8wZZj/Lm29Y4uQAgaym6CZlhH4Yoi+hp4V/Ww8YHt460A83RTwTHcy5CDxZxzsFhD exmg== X-Gm-Message-State: AOAM533PJ9tchgq0CvFwmio7TXWWfn31w7MXX1Fuwwcp3lfDp7FwId4s evYSjOWFpWDGxsSZjHmm3xXpgBgH86U= X-Google-Smtp-Source: ABdhPJz66gsJHLp5/2Wozo3EfNHEDj7WKH438fUTdVxEh+0sfzdKVFYcHJN370oX/wWGyEsC2Lzzqg== X-Received: by 2002:a05:600c:3483:b0:380:edaf:d479 with SMTP id a3-20020a05600c348300b00380edafd479mr12414534wmq.20.1646929770033; Thu, 10 Mar 2022 08:29:30 -0800 (PST) Received: from ?IPV6:2003:ee:af2f:e00:c2f9:c2bb:bf95:1fc5? (p200300eeaf2f0e00c2f9c2bbbf951fc5.dip0.t-ipconnect.de. [2003:ee:af2f:e00:c2f9:c2bb:bf95:1fc5]) by smtp.gmail.com with ESMTPSA id r188-20020a1c2bc5000000b00387c81c32e7sm8569828wmr.8.2022.03.10.08.29.29 for <54309@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Mar 2022 08:29:29 -0800 (PST) Message-ID: <8b52d7e5-314d-406e-87b7-cdc087dc7826@gmail.com> Date: Thu, 10 Mar 2022 17:29:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: fesoj000 Content-Language: en-US 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" X-getmail-retrieved-from-mailbox: Patches Use /var/log/audit for auditd. This is the upstream default. Further, rework the config file generated by auditd-service-type. Only write values which diverge from the upstream default. * gnu/services/auditd.scm: add auditd-activation function and extend activation-service-type. --- gnu/services/auditd.scm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/gnu/services/auditd.scm b/gnu/services/auditd.scm index abde811f51..1eb0ed291b 100644 --- a/gnu/services/auditd.scm +++ b/gnu/services/auditd.scm @@ -31,10 +31,10 @@ (define-module (gnu services auditd) %default-auditd-configuration-directory)) (define auditd.conf - (plain-file "auditd.conf" "log_file = /var/log/audit.log\nlog_format = \ -ENRICHED\nfreq = 1\nspace_left = 5%\nspace_left_action = \ -syslog\nadmin_space_left_action = ignore\ndisk_full_action = \ -ignore\ndisk_error_action = syslog\n")) + (plain-file "auditd.conf" "\ +space_left = 5% +space_left_action = syslog +")) (define %default-auditd-configuration-directory (computed-file "auditd" @@ -50,6 +50,14 @@ (define-record-type* (default audit)) (configuration-directory auditd-configuration-configuration-directory)) ; file-like +(define (auditd-activation config) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (let ((var-log-audit "/var/log/audit")) + (mkdir-p var-log-audit) + (chmod var-log-audit #o700))))) + (define (auditd-shepherd-service config) (let* ((audit (auditd-configuration-audit config)) (configuration-directory (auditd-configuration-configuration-directory config))) @@ -67,7 +75,9 @@ (define auditd-service-type (extensions (list (service-extension shepherd-root-service-type - auditd-shepherd-service))) + auditd-shepherd-service) + (service-extension activation-service-type + auditd-activation))) (default-value (auditd-configuration (configuration-directory %default-auditd-configuration-directory)))))