From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6CfVGvG/NWK4wAAAgWs5BA (envelope-from ) for ; Sat, 19 Mar 2022 12:35:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id oBxTGPG/NWIYWwEA9RJhRA (envelope-from ) for ; Sat, 19 Mar 2022 12:35:13 +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 09D333F5C2 for ; Sat, 19 Mar 2022 12:35:12 +0100 (CET) Received: from localhost ([::1]:59400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVXMV-0002QK-K1 for larch@yhetil.org; Sat, 19 Mar 2022 07:35:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVXMM-0002PB-8K for guix-patches@gnu.org; Sat, 19 Mar 2022 07:35:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVXML-0000kZ-Vt for guix-patches@gnu.org; Sat, 19 Mar 2022 07:35:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nVXML-0001IV-SP for guix-patches@gnu.org; Sat, 19 Mar 2022 07:35:01 -0400 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: Sat, 19 Mar 2022 11:35:01 +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.16476896874961 (code B ref 54309); Sat, 19 Mar 2022 11:35:01 +0000 Received: (at 54309) by debbugs.gnu.org; 19 Mar 2022 11:34:47 +0000 Received: from localhost ([127.0.0.1]:59163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVXM7-0001Hx-Ab for submit@debbugs.gnu.org; Sat, 19 Mar 2022 07:34:47 -0400 Received: from mail-ej1-f48.google.com ([209.85.218.48]:46818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVXM5-0001Hi-Bo for 54309@debbugs.gnu.org; Sat, 19 Mar 2022 07:34:45 -0400 Received: by mail-ej1-f48.google.com with SMTP id qx21so21386927ejb.13 for <54309@debbugs.gnu.org>; Sat, 19 Mar 2022 04:34:45 -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=uKNaWvlncFhUDTgle8JtNcbH0aqqfFmIyj95YQb9gCc=; b=emhO0YsUQsvL4uh7sdEudM0pUyyTEPc4I6a/gWFr286VPrTNtg351W1u7HB77UgxgW tvH1zON83V48NUDwEf/aEl9tNC0s7czI9oKN7P3HVlXTG3UqJAegEoxKhwuRB7rdYicL 8dF4fIS1Ut2i7Uyxf84gQs8URoWnXDszJkZ0w+7p9OnbXRZwoo+BxbgvU8skSkuTlmxM FozrhgtuOMo8++nV2E/L7lSXJoCmy/aBe5+9r33BQgK4sMoujq7U16b4oI+cgDE7sZ0f NHQb8FUFLx3C28C5EJ5k1RJTaKyHwguTktec9MZOEJhZQoyXTmIIzKqh9DP3erDJc05P hc3g== 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=uKNaWvlncFhUDTgle8JtNcbH0aqqfFmIyj95YQb9gCc=; b=NjNBxZuEX8PDWAXCBj4e2uAV9QXkZuNQYpH+zso/LtfLpzhsnY/NJ4OdItZK3JOvk8 1sLkfSwNCUSySHFVCHxKqPk5ImG7jYDom2ZhToFipG/eAWp1CyGpSmKOUW94ethK2i7s BxciQJtBhOKh20C/q4iMgyF1rioTTBuDSR0xbYAWVf+CydPG78JccCfNRUugahxbpw0i SDDwAyV4yPP3LdJE051sQdeFxEFhJ4EYlX1kLTt72s6HoDhIYtfXjwNyWLyupwWUvexL Kfs/lSnYgrOjSIWhj8ScUjb+bCBXFFxLPfCfDlnvGvK7z4VaqoifUs2xRwoj17Xs5hDG seJw== X-Gm-Message-State: AOAM530criElChXr6N/a0fVn8nvuaJN3sbh3RfBcoiaeS1LxH1F0oldS KkUdagaWhE3mgL1cuIyIt6nP3y56Rq8= X-Google-Smtp-Source: ABdhPJx/v+Yrf6/quVp15RQ0aOy4rr3uwRC0mZm2RLT7fzQpAmYRuyR9ghbrfZGCXDL7xNo1oDBrNQ== X-Received: by 2002:a17:907:6e8d:b0:6d7:1261:d468 with SMTP id sh13-20020a1709076e8d00b006d71261d468mr12736261ejc.390.1647689679321; Sat, 19 Mar 2022 04:34:39 -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 ka6-20020a170907990600b006ce54c95e3csm4733533ejc.161.2022.03.19.04.34.38 for <54309@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Mar 2022 04:34:38 -0700 (PDT) Message-ID: Date: Sat, 19 Mar 2022 12:34:38 +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=1647689713; 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=uKNaWvlncFhUDTgle8JtNcbH0aqqfFmIyj95YQb9gCc=; b=NCQdRzLX7DQgN9b/ddYTyjo1L3Q3Cv++4iL6e5KR1OQjUE+b3ojRPb9nTgEAmr6FP1gmrp GX2Pv7pVip2TXvHjw/YSMv2cI0e3Yf0ZziQRBz1vUAsGNDlB3/BxqT4jCvLoD7YCngljqZ 28fJd1p6amDAnptHZGIimXBnd/2KP3xwwdYZglpBODmICJ8g7mZEH9aosHHEkCEsrSPnjS YjOx3cDIeSTmOXU5tS86CxhcpTVJF87kURX/VcnuMHgzrhjHQv8O5Cj7sVLR4s0O/PxRlZ eE6Y0BSwGcSvlyvCDsw19Hv/rMpdiwpTS5iYDAlA6MYYswuV5HbBTS6Qgddovg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647689713; a=rsa-sha256; cv=none; b=RV/U94K60vM2PCdFR3IY6qsqq0v8/tMg7k3EF8nPPJodzr7K5dDf8Q6n+TkaxxnoLx8T4d +/gaKxV0MjjsZT1dBjSo0A/Yv2oU9ivV481DjFIhVxsBF4Pbxx+T7Vj0NAZ+hdYfezERVb Z3BWvuXJkJ+8GmvyXl6ilxqB6j5oFWTJFZjqdx0u5nqeHdJRbwLpVCbE3m88UKsjT3yrPt D4S/KPNr3Uyl7X7j3WTu5drl/KP0Zrrx+AKaVmvR6RT4tOFsTmeuHLINvfbV7lB0U+lm6a XhSRVTiMfb0JzQ5hds47wb3buHPEg9SVml9Hj5ZVgBQlnJLG3EydCeCog6OPeA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=emhO0YsU; 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.66 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=emhO0YsU; 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: 09D333F5C2 X-Spam-Score: 5.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: kbV9y9gDPybS Use /var/log/audit for auditd. This is the upstream default. Further, make the inline config file more readable. * gnu/services/auditd.scm: add auditd-activation function and extend activation-service-type. --- gnu/services/auditd.scm | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/gnu/services/auditd.scm b/gnu/services/auditd.scm index abde811f51..e9e19c61be 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,16 @@ (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)) + ;; make sure /var/log exists before changing umask + (mkdir-p "/var/log") + (let* ((previous-umask (umask #o077))) + (mkdir-p "/var/log/audit") + (umask previous-umask))))) + (define (auditd-shepherd-service config) (let* ((audit (auditd-configuration-audit config)) (configuration-directory (auditd-configuration-configuration-directory config))) @@ -67,7 +82,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