From patchwork Wed Mar 23 20:22:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fesoj000 X-Patchwork-Id: 38032 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 744BF27BBEA; Wed, 23 Mar 2022 20:23:10 +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 4146B27BBE9 for ; Wed, 23 Mar 2022 20:23:10 +0000 (GMT) Received: from localhost ([::1]:47876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nX7Vd-0002yO-Dm for patchwork@mira.cbaines.net; Wed, 23 Mar 2022 16:23:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nX7VW-0002wq-H5 for guix-patches@gnu.org; Wed, 23 Mar 2022 16:23:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nX7VW-0006oA-8F for guix-patches@gnu.org; Wed, 23 Mar 2022 16:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nX7VW-0001tf-4F for guix-patches@gnu.org; Wed, 23 Mar 2022 16:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54309] [PATCHv2] 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:23: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.16480669677248 (code B ref 54309); Wed, 23 Mar 2022 20:23:02 +0000 Received: (at 54309) by debbugs.gnu.org; 23 Mar 2022 20:22:47 +0000 Received: from localhost ([127.0.0.1]:46157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nX7VG-0001sq-Tc for submit@debbugs.gnu.org; Wed, 23 Mar 2022 16:22:47 -0400 Received: from mail-ej1-f43.google.com ([209.85.218.43]:38907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nX7VG-0001sd-41 for 54309@debbugs.gnu.org; Wed, 23 Mar 2022 16:22:46 -0400 Received: by mail-ej1-f43.google.com with SMTP id r13so5157747ejd.5 for <54309@debbugs.gnu.org>; Wed, 23 Mar 2022 13:22:46 -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=LPLsfJ4mn4rNruNfMJ1xjeVZ4Zq6wOdl77YUiF79vAo=; b=QVbsazkou81jH4QShNKn/PGxDoc8knpoREeb4RMrpDZfUcMrFpMUSOVEyQYB1BrXi3 f2YXlG6UBV/V7mQVLN7AyWzTlBpVfnH7PnqEMm11iDoveF10IlA1MvjRY+2RCsnozymP x9UJO4f5ZpLQj1IedS7j1i+PKWZ1sk3/ju4F1OxIs27lLWJgTGEhY/xDhAJAA8wCcQQV GHeGSGXMN3qlNCL+95GJaoCWkB1mVctkdKwNAeY5aSZrb3gZGMBwGQ6H+fsTKbKA01O7 X2f54S1re5aQdVZ4eZxKSkY6kAs9oaVqqcZQVpN9EDbEoGQj3dwzkNgMvNJcRbAWp62U 6JGw== 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=LPLsfJ4mn4rNruNfMJ1xjeVZ4Zq6wOdl77YUiF79vAo=; b=UlKId0xitIvS80q7uZOkaT3RG4+sdavxFGrQ9FG4iSKFOt6pDVIrq2e/VeTyLLmzp9 opLgAzSyCfnvC5fvtDzl3lqrL0COpw89H76oCd/xC/NNgoj8ltrymjpAu1db0P2lTgDd VTK6QNaltF5bsN70m1bV/TilgptOhdmhIYx0hgut0VjB4VipEYwMc0tSEQKnXaxOTWRj 01/xKLFj44cLzs6Pw+TGeHgHJHWFeJom9DQCHizeKspGnipS8YXMpbkIzyxmWUlXm+G0 vRinldOrwJet9Phw4/IdIpPb0/qdSTDETyDyUAzg+8BUo0xmdbZVx38AVZ23yhcf8fP4 QHdg== X-Gm-Message-State: AOAM5324jveZNNkJufNfl3F1QgwS6xbqz2j53mNGZqLRDCDGBYPb4jo0 h/oX29wsn1gKxdxzPHNFBW1wa4s0QPc= X-Google-Smtp-Source: ABdhPJyt4LtngF8KfsvYggMNxJD9bd5w3/4EtmiqOyeChg1HyxtFU7QucIEn+8/WKAIbrvg660cgIA== X-Received: by 2002:a17:907:96a1:b0:6df:c9e3:25e2 with SMTP id hd33-20020a17090796a100b006dfc9e325e2mr2088613ejc.138.1648066960337; Wed, 23 Mar 2022 13:22:40 -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 da23-20020a056402177700b0041394d8173csm399230edb.31.2022.03.23.13.22.39 for <54309@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Mar 2022 13:22:40 -0700 (PDT) Message-ID: Date: Wed, 23 Mar 2022 21:22:40 +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 | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/gnu/services/auditd.scm b/gnu/services/auditd.scm index abde811f51..8e3d5fd2bc 100644 --- a/gnu/services/auditd.scm +++ b/gnu/services/auditd.scm @@ -31,10 +31,15 @@ (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" "\ +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 +55,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)) + ;; ensure /var/log exists with default permissions + (mkdir-p "/var/log") + (mkdir-p/perm "/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 +80,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)))))