From nobody Mon Feb 9 12:25:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652285436749754.5931031509742; Wed, 11 May 2022 09:10:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-KvkwyljIPAyv-uEEGKzLdg-1; Wed, 11 May 2022 12:10:33 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D476E3C62B6C; Wed, 11 May 2022 16:10:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7443C4C47BF; Wed, 11 May 2022 16:10:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 41CC41937755; Wed, 11 May 2022 16:10:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5A7F4194975B for ; Wed, 11 May 2022 15:41:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3C6DA400E118; Wed, 11 May 2022 15:41:59 +0000 (UTC) Received: from egarver.remote.csb (unknown [10.22.10.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1451840C1421; Wed, 11 May 2022 15:41:58 +0000 (UTC) X-MC-Unique: KvkwyljIPAyv-uEEGKzLdg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Eric Garver To: libvir-list@redhat.com Subject: [PATCH 1/4] network: firewalld: convert to policies Date: Wed, 11 May 2022 11:41:52 -0400 Message-Id: <20220511154156.4036678-2-eric@garver.life> In-Reply-To: <20220511154156.4036678-1-eric@garver.life> References: <20220511154156.4036678-1-eric@garver.life> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mailman-Approved-At: Wed, 11 May 2022 16:10:28 +0000 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laine@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1652285438764100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Convert the existing behavior into policies. This commit has no functional changes. Signed-off-by: Eric Garver --- src/network/libvirt-nat-out.policy | 12 ++++++++++++ src/network/libvirt-to-host.policy | 20 ++++++++++++++++++++ src/network/libvirt.zone | 23 +++++------------------ src/network/meson.build | 10 ++++++++++ 4 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 src/network/libvirt-nat-out.policy create mode 100644 src/network/libvirt-to-host.policy diff --git a/src/network/libvirt-nat-out.policy b/src/network/libvirt-nat-o= ut.policy new file mode 100644 index 000000000000..7d1cf6dfb4c4 --- /dev/null +++ b/src/network/libvirt-nat-out.policy @@ -0,0 +1,12 @@ + + + libvirt-nat-out + + + This policy is used to allow NAT virtual machine traffic to the + rest of the network. + + + + + diff --git a/src/network/libvirt-to-host.policy b/src/network/libvirt-to-ho= st.policy new file mode 100644 index 000000000000..045b35d58d0d --- /dev/null +++ b/src/network/libvirt-to-host.policy @@ -0,0 +1,20 @@ + + + libvirt-to-host + + + This policy is used to filter traffic from virtual machines to the + host. + + + + + + + + + + + + + diff --git a/src/network/libvirt.zone b/src/network/libvirt.zone index b1e84b52ecc9..4c5639d8a84f 100644 --- a/src/network/libvirt.zone +++ b/src/network/libvirt.zone @@ -1,25 +1,12 @@ - + libvirt =20 - The default policy of "ACCEPT" allows all packets to/from - interfaces in the zone to be forwarded, while the (*low priority*) - reject rule blocks any traffic destined for the host, except those - services explicitly listed (that list can be modified as required - by the local admin). This zone is intended to be used only by - libvirt virtual networks - libvirt will add the bridge devices for - all new virtual networks to this zone by default. + This zone is intended to be used only by libvirt virtual networks - + libvirt will add the bridge devices for all new virtual networks to + this zone by default. =20 - - - - - - - - - - + diff --git a/src/network/meson.build b/src/network/meson.build index b5eff0c3ab6b..3dd342639a46 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -100,5 +100,15 @@ if conf.has('WITH_NETWORK') install_dir: prefix / 'lib' / 'firewalld' / 'zones', rename: [ 'libvirt.xml' ], ) + install_data( + 'libvirt-to-host.policy', + install_dir: prefix / 'lib' / 'firewalld' / 'policies', + rename: [ 'libvirt-to-host.xml' ], + ) + install_data( + 'libvirt-nat-out.policy', + install_dir: prefix / 'lib' / 'firewalld' / 'policies', + rename: [ 'libvirt-nat-out.xml' ], + ) endif endif --=20 2.33.0