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 ms5.migadu.com with LMTPS id oEOuJx+LFGO5LAAAbAwnHQ (envelope-from ) for ; Sun, 04 Sep 2022 13:25:19 +0200 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 QIi6Jx+LFGOQDAEA9RJhRA (envelope-from ) for ; Sun, 04 Sep 2022 13:25:19 +0200 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 362C822BE2 for ; Sun, 4 Sep 2022 13:25:19 +0200 (CEST) Received: from localhost ([::1]:60838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUnka-0000by-HW for larch@yhetil.org; Sun, 04 Sep 2022 07:25:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUnkM-0000a4-TK for guix-patches@gnu.org; Sun, 04 Sep 2022 07:25:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54886) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUnkM-00029l-L1 for guix-patches@gnu.org; Sun, 04 Sep 2022 07:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUnkM-0001j3-Gp for guix-patches@gnu.org; Sun, 04 Sep 2022 07:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57575] [PATCH] gnu: fail2ban-service-type: Improve extra-content fields. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Sep 2022 11:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57575 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57575@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16622906986618 (code B ref -1); Sun, 04 Sep 2022 11:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Sep 2022 11:24:58 +0000 Received: from localhost ([127.0.0.1]:43585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUnkG-0001ic-7q for submit@debbugs.gnu.org; Sun, 04 Sep 2022 07:24:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:49000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUnkB-0001iR-82 for submit@debbugs.gnu.org; Sun, 04 Sep 2022 07:24:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUnkA-0000WX-AP for guix-patches@gnu.org; Sun, 04 Sep 2022 07:24:50 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:60018 helo=nomad-cl1.muradm.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUnk7-00025h-CE for guix-patches@gnu.org; Sun, 04 Sep 2022 07:24:48 -0400 Received: from localhost ([127.0.0.1]:44794) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oUnjx-00033m-0f; Sun, 04 Sep 2022 11:24:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=o/A4fvyl6KBxyJjcWYloKbhjEMSRsAWtAXkhF1glAFw=; b=wJCY3XVR5CeMMLAeYnqUzpYqhh hR1vaJeHHnDk7TVP/aN9pGwunCXrXvjy1Xkx4dYqkqM/TbiYsCudmUEI7PxQDyxqoKepavlLNt3GT JoBmyruNogwR/X8GnxG2xIpOH3eRPOYMOxzIJBHpU71wdtEZCbddypdCVDGcS/ACpZPuzZ4averXG UAatIbUT/wMDZfntKTqS3BfHLUvKYUr0b/RP0khwNU+o28hYEpLyDdlPV/odsEQsfXQb9bmm/lvJe 9e2ztKxA6KghZ13DY6mPLds/dFd4+ylBPhrJsTvkwz7xGfDxFYu5D4n0SPrMA/+WpZ/lXC4yhEt0b tpYvbH1t8+G0Qqh8GsgL0sEwCVMcIrdTz0R4y96oLou1eBh1aQbj8IlGNde2Y6B+qAqkbUA8B0fd9 KyKaM0eT0NYHkXIrRUSaSjf+YgwIv1US9zFOv/Nm9XShVL27/MP30fGjR4fClkjNL1F8ia/yErvan qehgbJkJmyDnE/iSTICWY7r6; Received: from muradm by localhost with local (Exim 4.96) (envelope-from ) id 1oUnk2-0008CD-2Y; Sun, 04 Sep 2022 14:24:42 +0300 From: muradm Date: Sun, 4 Sep 2022 14:24:42 +0300 Message-Id: <20220904112442.31501-1-mail@muradm.net> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=139.162.159.157; envelope-from=mail@muradm.net; helo=nomad-cl1.muradm.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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=1662290719; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=o/A4fvyl6KBxyJjcWYloKbhjEMSRsAWtAXkhF1glAFw=; b=huiEz5MpfFBIrZmuSIks+4iZwjOfO3Kykwi7gLShYPBZGw9hlz3gw45J9ncQmra444cqhu ZjojJKGW3ZSjyqC9X2iVNFSDfy/hyVZEcWLzD3+lILC/hzy7XqxGuRo9prINgRcB+DST1S PSfyzOTOURfff8b2XhZeaxs7Kfqh8qF5Dmwbk3sfabTTRuIbgQoKgmo/OT2KMzGsUS3Lit t1bTBJXDrAwfUzSm7ko0E+ilw7YACRS9tg83kNnD/7zzxXIPoRvVif8eiFbXOr5jq7MPVl RGzPB4/Ei34oUuoHxtalZvPCF5SgnkjiBd/SX8MwQbx3kwJhU2ZzUjkgr9Lb7w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662290719; a=rsa-sha256; cv=none; b=DDfufFJo7+So8r5p+2rW50wh2r0IaBmLhCdSDT1SDhLRidyn9fArh3Cov65Ct4VLXsdi27 ZdZpAw7nq7I/PuHaCNzfivWczVHXcQmgFbAkizhY03PXeUVijkVgwT9dCXdev2lfh0Cjn3 9QzQSQhtt4ClpYhC+/UK3QQi0qxfVs89YtIgbBC4iubKoeNQ3t+cuFNnM8Agcw/OWYvpwG cFAF72so1dELmaaREaQ9/QqhVBxuud9ZrNH4fL4cR5SD1UODCcanhpDnoplgxN36q/DtRV u4YslGARX9P6XSb2zRdeNseSRFKpnhrq6KK8yJGjF4Aoq6l1nCj2rkJxwbgaLg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=muradm.net header.s=mail header.b=wJCY3XVR; dmarc=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: 2.52 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=muradm.net header.s=mail header.b=wJCY3XVR; dmarc=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: 362C822BE2 X-Spam-Score: 2.52 X-Migadu-Scanner: scn1.migadu.com X-TUID: 40wVIrImrkIR * gnu/services/security.scm: (fail2ban-jail-configuration)[extra-content]: Change to text-config. (fail2ban-configuration)[extra-content]: Change to text-config. * gnu/doc/guix.texi: Update type of extra-content fields. --- doc/guix.texi | 4 ++-- gnu/services/security.scm | 15 ++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 80ca017599..b0a309efc2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -36619,7 +36619,7 @@ extensions. @item @code{extra-jails} (default: @code{()}) (type: list-of-fail2ban-jail-configurations) Instances of @code{} explicitly provided. -@item @code{extra-content} (type: maybe-string) +@item @code{extra-content} (default: @code{()}) (type: text-config) Extra raw content to add to the end of the @file{jail.local} file. @end table @@ -36747,7 +36747,7 @@ The file names of the log files to be monitored. @item @code{action} (default: @code{()}) (type: list-of-fail2ban-jail-actions) A list of @code{}. -@item @code{extra-content} (type: maybe-string) +@item @code{extra-content} (default: @code{()}) (type: text-config) Extra content for the jail configuration. @end table diff --git a/gnu/services/security.scm b/gnu/services/security.scm index fd5bf19730..e6b59442ca 100644 --- a/gnu/services/security.scm +++ b/gnu/services/security.scm @@ -179,11 +179,6 @@ (define (fail2ban-jail-configuration-serialize-list-of-fail2ban-jail-actions fie (define (fail2ban-jail-configuration-serialize-symbol field-name value) (fail2ban-jail-configuration-serialize-string field-name (symbol->string value))) -(define (fail2ban-jail-configuration-serialize-extra-content field-name value) - (if (maybe-value-set? value) - (string-append "\n" value "\n") - "")) - (define-maybe integer (prefix fail2ban-jail-configuration-)) (define-maybe string (prefix fail2ban-jail-configuration-)) (define-maybe boolean (prefix fail2ban-jail-configuration-)) @@ -281,9 +276,9 @@ (define-configuration fail2ban-jail-configuration (list-of-fail2ban-jail-actions '()) "A list of @code{}.") (extra-content - maybe-string + (text-config '()) "Extra content for the jail configuration." - fail2ban-jail-configuration-serialize-extra-content) + serialize-text-config) (prefix fail2ban-jail-configuration-)) (define list-of-fail2ban-jail-configurations? @@ -312,7 +307,7 @@ (define-configuration/no-serialization fail2ban-configuration (list-of-fail2ban-jail-configurations '()) "Instances of @code{} explicitly provided.") (extra-content - maybe-string + (text-config '()) "Extra raw content to add to the end of the @file{jail.local} file.")) (define (serialize-fail2ban-configuration config) @@ -322,9 +317,7 @@ (define (serialize-fail2ban-configuration config) (interpose (append (map serialize-fail2ban-jail-configuration (append jails extra-jails)) - (list (if (maybe-value-set? extra-content) - extra-content - "")))))) + (list (serialize-text-config 'extra-content extra-content)))))) (define (config->fail2ban-etc-directory config) (let* ((fail2ban (fail2ban-configuration-fail2ban config)) -- 2.37.2