From nobody Wed Aug 31 17:18:35 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MHrVg6jjsz4Zgsw for ; Wed, 31 Aug 2022 17:18:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MHrVg4yMCz43PR for ; Wed, 31 Aug 2022 17:18:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MHrVg3wWGz1BNZ for ; Wed, 31 Aug 2022 17:18:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 27VHIZG7078553 for ; Wed, 31 Aug 2022 17:18:35 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 27VHIZ62078552 for bugs@FreeBSD.org; Wed, 31 Aug 2022 17:18:35 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 266137] rc.firewall: Make it so it supports a directory of rules as well as a monolithic file Date: Wed, 31 Aug 2022 17:18:35 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: conf X-Bugzilla-Version: 12.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: freebsd@gushi.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661966315; h=from:from: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; bh=hftOn5Ii+iDrthq+jhy249CbpgGO6jfs9ZbnjnZxFPU=; b=YaUX06tl3ajslHEOyBVP2nJ92lqo4rfTB8dy959D1/LBPjVGxwDngl0PjjyKgXFInamik3 fooQ73hhvvcauXwgcyLqjozoAhe8PlW9NFAn/lg4My1rLJVi2l4BG0Yhlul2NnQBSOfIPK k2+sNYMpeGSNm+h6Cb8Hb8AZZLpXfedj8f695tap1e5+rIduIpqLODkLmwwXDCRTp53svm jnm6sT09Dqhum5H5oX8Yf4Mko/NRF6z80LRM6vuonIwZ0+73P+AEVZloZG5GALbRJyFBi2 vo6LzsKNdzTlpSVeOu9g3ZKE7mO6H8yAngV/EMT3L1KT4n9Kfca1XSwqcLDuHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661966315; a=rsa-sha256; cv=none; b=NCvf+lXlaKCirPTx5Sml/sUqW2t748tGPNVtuXlTYozXMVc/H0xVisNtJcU8UYlRJosCT3 MZau4dCgflVVvMAAJhr3SR5Nu/c1Yh3xFmM48KWdTMOEkAXmqQjx1qFKsmkrMKMrxEJOlo 0fza07tUGjWUrATjQqwnQ42XF+NiTxT5wEvfgk8Tt2aarfoagsh6IR8r9FKWxPiQP1Okuc q72V7w8bDzy7q6KSlWuny5vFNSPI/MkpAAmXh+Jbb2F4rwGTMqd4S/jG/geL6mgYtxo5ol 8qShEPChf09I8MCm1F40Tp9pADw0kdj27w0dSdbCQ+ZcNEsO90ZER7debN5B4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266137 Bug ID: 266137 Summary: rc.firewall: Make it so it supports a directory of rules as well as a monolithic file Product: Base System Version: 12.3-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: conf Assignee: bugs@FreeBSD.org Reporter: freebsd@gushi.org At the day job, we have taken to deploying our firewall rules as service related, which means we have an /etc/ipfw.d directory that has all our rule= s in it, which are run through rcorder. (This way, when we deploy a service with puppet, we can drop in the corresponding rules as well). This would bring = ipfw into harmony with rc.d, syslog.d, newsyslog.d, etc. This is a remarkably simple addition to the stock system: @@ -550,8 +532,21 @@ [Uu][Nn][Kk][Nn][Oo][Ww][Nn]) ;; *) - if [ -r "${firewall_type}" ]; then - ${fwcmd} ${firewall_flags} ${firewall_type} - fi + if [ -r "${firewall_type}" ]; then + if [ -f "${firewall_type}" ]; then + ${fwcmd} ${firewall_flags} ${firewall_type} + else + if [ -d "${firewall_type}" ]; then + for fwfile in `rcorder $firewall_type/*` + do + ipfw -q $fwfile; + done + fi + fi + fi Would there be interest in making this mainline? (I can formally patch aga= inst -CURRENT if that's useful). --=20 You are receiving this mail because: You are the assignee for the bug.=