From patchwork Wed Mar 23 20:39:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fesoj000 X-Patchwork-Id: 38033 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 EC10027BBEA; Wed, 23 Mar 2022 20:40:43 +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 81FD427BBE9 for ; Wed, 23 Mar 2022 20:40:43 +0000 (GMT) Received: from localhost ([::1]:51980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nX7mc-0006wV-LI for patchwork@mira.cbaines.net; Wed, 23 Mar 2022 16:40:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nX7m8-0006vN-8O for guix-patches@gnu.org; Wed, 23 Mar 2022 16:40:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nX7ly-0000w9-GX for guix-patches@gnu.org; Wed, 23 Mar 2022 16:40:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nX7ly-0002Lt-97 for guix-patches@gnu.org; Wed, 23 Mar 2022 16:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54309] [PATCHv3] 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: Wed, 23 Mar 2022 20:40: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.16480679688982 (code B ref 54309); Wed, 23 Mar 2022 20:40:02 +0000 Received: (at 54309) by debbugs.gnu.org; 23 Mar 2022 20:39:28 +0000 Received: from localhost ([127.0.0.1]:46173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nX7lP-0002Ko-TX for submit@debbugs.gnu.org; Wed, 23 Mar 2022 16:39:28 -0400 Received: from mail-ej1-f41.google.com ([209.85.218.41]:38878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nX7lO-0002KZ-30 for 54309@debbugs.gnu.org; Wed, 23 Mar 2022 16:39:26 -0400 Received: by mail-ej1-f41.google.com with SMTP id r13so5232429ejd.5 for <54309@debbugs.gnu.org>; Wed, 23 Mar 2022 13:39:26 -0700 (PDT) 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=KbFXVf3K9zZoZYy4kUITYq6L5Svh/Os8r548G/a1bJo=; b=J+apBRNCljJZioPHLo/zt62TDIAd6NvXfYz0PExCbFwvZ/lKwTF3q3Y4lkvfnYoTPv sp4mAFYv1Ze9HDEdtdbw4Y+SPVcfDfll10ynyTijddt4nYk8ZnMsWZsG4kFYziAdpZ6f sh9XAod7aIOYpI9wKT3hmoq+tYsFwQ+Zc0iBkn4HjYvGqjh9gwVLtk2RdtjidptwOw30 Fu/Y7Uzs3T5JZ25sD6FK6E+sKxFNUulGH2fWj6A93rd3WjN6/KzulelKFmlManYWNSnX SoMlWitl/kplZvct55U3dF5txQ4FzJqsATOZ4zXqxYsCGf7Vht2s52kiq2GsJi8rA2J+ bG3Q== 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=KbFXVf3K9zZoZYy4kUITYq6L5Svh/Os8r548G/a1bJo=; b=E+OUvcLXCPMOWdYJmHt5yrZ7bO8Ni0SjNb9msg0PvoXijDVeyg7c654HFurJeE8ZS/ fyP0IbURUI6kgH6Icmg+C8Eh/LAFzYqA5v3vndfNHDjsZlyC35PtHw6sy9jtqXI/sLb7 szOYyCTI6NoIdroIAXkDIifR2qYqYAidWcRqGwLonTj5IyG4qkdUU2MuLRL2sZGg9zs7 /4oqdBQB9o1yjlOOMlkemTsvsXTpEpfQi3PRjmkKbAIKmLWAnt78/PQdstv3Lln5pix9 raqc/5tPGXGGLbPqSitDtTKajkWVGaQSP1niYzv6seI0v+1VcTzlDsjSiBSe4Ua6/NRl 2x4g== X-Gm-Message-State: AOAM533pXi8cqyacT+XkhDWuj8TiWJuYvZ/gVu6Lc2SKecCX8OGO3H4O hW+prAa5o39VtQB1xIHoqwO5Fss1USs= X-Google-Smtp-Source: ABdhPJypHyO6OrMgd0GCEUP2vsrXjNoUgE9LIP4GrW0B3b3daNugG+iH3TWidm1qYWkdRtDF5fzLCA== X-Received: by 2002:a17:906:a1c8:b0:6da:a635:e402 with SMTP id bx8-20020a170906a1c800b006daa635e402mr2059537ejb.598.1648067959955; Wed, 23 Mar 2022 13:39:19 -0700 (PDT) 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 d11-20020a170906c20b00b006d584a09b9fsm340356ejz.98.2022.03.23.13.39.19 for <54309@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Mar 2022 13:39:19 -0700 (PDT) Message-ID: <10e679cf-b574-5ae5-76f7-d59828ed0dae@gmail.com> Date: Wed, 23 Mar 2022 21:39:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 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. * gnu/services/auditd.scm: add auditd-activation function and extend activation-service-type. --- gnu/services/auditd.scm | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/gnu/services/auditd.scm b/gnu/services/auditd.scm index abde811f51..33849155a1 100644 --- a/gnu/services/auditd.scm +++ b/gnu/services/auditd.scm @@ -26,15 +26,21 @@ (define-module (gnu services auditd) #:use-module (guix records) #:use-module (guix gexp) #:use-module (guix packages) + #:use-module (guix modules) #:export (auditd-configuration auditd-service-type %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" "\ +log_format = ENRICHED +freq = 1 +space_left = 5% +space_left_action = syslog +admin_space_left_action = ignore +disk_full_action = ignore +disk_error_action = syslog +")) (define %default-auditd-configuration-directory (computed-file "auditd" @@ -50,6 +56,16 @@ (define-record-type* (default audit)) (configuration-directory auditd-configuration-configuration-directory)) ; file-like +(define (auditd-activation config) + (with-imported-modules (source-module-closure '((gnu build activation) + (guix build utils))) + #~(begin + (use-modules (gnu build activation) + (guix build utils)) + ;; ensure /var/log exists with default permissions + (mkdir-p "/var/log") + (mkdir-p/perms "/var/log/audit" (getpwnam "root") #o700)))) + (define (auditd-shepherd-service config) (let* ((audit (auditd-configuration-audit config)) (configuration-directory (auditd-configuration-configuration-directory config))) @@ -67,7 +83,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)))))