From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QND9Bc2FO2KB6AAAgWs5BA (envelope-from ) for ; Wed, 23 Mar 2022 21:40:45 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id oM34As2FO2Jw6QAAauVa8A (envelope-from ) for ; Wed, 23 Mar 2022 21:40:45 +0100 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 A10A643A3B for ; Wed, 23 Mar 2022 21:40:44 +0100 (CET) Received: from localhost ([::1]:51980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nX7md-0006wV-6r for larch@yhetil.org; Wed, 23 Mar 2022 16:40:43 -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 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648068044; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=KbFXVf3K9zZoZYy4kUITYq6L5Svh/Os8r548G/a1bJo=; b=kdCMxoobzhSiPHBSQ3SPANMCidZAfdOtt/8ofjXKruUxAH8tZ0ToyoELqKdIrnoWfHLpFR LnCfhimuSpCuo3gDcwhR1mUir2bnbpqN1wI7fM6tiEAA9HtbC9sugQNFZ6jBWtysJbOZ0Q NzwaELisfOi5knPYGJji1YNUFX00k7Ue3ZhuANzqpB7vxnI1ymErPbW8kqKrnWxPAC762D 6cNlhkVi875lDaAsodnHKPg/nKYqTiOb/Bmz0VYRHGr1bvSaxffDi6yO+P2ySskdiqO39y upTOuxLawDcjKCaaRCKz0+dkhqPW+jf6mdeuOf+bhZFNU27Zj3h/SCv3WvkNmw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648068044; a=rsa-sha256; cv=none; b=TbBoHYCLW4SDofMm0pb0Y8OWR9O91p39ulVAWordXHXra5KnPaRcYcKlerAr2UzhmuzbGA Tb2k5CadoPn5ra4XkrIMjQe/0U6tmUtkrYhzMIX0lka3g/pfu2efVdUpcJ+dywyoB4IBqr hJvHVlIac9HdWVhFWfpmlqEEbWLJ82/MylbYC6iEt9wzwZbz5a8jdH0i1fnJgKqmkQT4EW epoqb3eUIJVBQjfXTUPMY5A/77v24p/ce3mdhmRVRaOTDaCzQwhHzR7yrczWTexQ8rOF3n KsYFsRk4ZTWN/FOEhfmAbFs/nM8Km207MSJrx1DH9iX5XcyniaxgbA/hlGI++A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=J+apBRNC; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" X-Migadu-Spam-Score: 5.11 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=J+apBRNC; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" X-Migadu-Queue-Id: A10A643A3B X-Spam-Score: 5.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3CIhJ3dqeDWj 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))))) -- 2.34.0