From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 3881D1FF15F for ; Mon, 18 Nov 2024 18:44:17 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0067716AEE; Mon, 18 Nov 2024 18:44:16 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Mon, 18 Nov 2024 18:43:33 +0100 Message-Id: <20241118174343.268165-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.243 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH docs/firewall/manager/network v5 00/10] add forward chain firewalling for hosts and vnets X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" ## Introduction This patch series introduces a new direction for firewall rules: forward. Additionally this patch series introduces defining firewall rules on a vnet level. ## Use Cases For hosts: * hosts utilizing NAT can define firewall rules for NATed traffic * hosts utilizing EVPN zones can define rules for exit node traffic * hosts acting as gateway can firewall the traffic that passes through them For vnets: * can create firewall rules globally without having to attach/update security groups to every newly created VM This patch series is particularly useful when combined with my other current RFC 'autogenerate ipsets for sdn objects'. It enables users to quickly define rules like: on the host level: * only SNAT HTTP traffic from hosts in this vnet to a specific host * restricting traffic routed from hosts in one vnet to another vnet on the vnet level: * only allow DHCP/DNS traffic inside a bridge to the gateway Not only does this streamline creating firewall rules, it also enables users to create firewall rules that haven't been possible before and needed to rely on external firewall appliances. Since forwarded traffic goes *both* ways, you generally have to create two rules in case of bi-directional traffic. It might make sense to simplify this in the future by adding an additional option to the firewall config scheme that specifies that rules in the other direction should also get automatically generated. ## Usage For creating forward rules on the cluster/host level, you simply create a new rule with the new 'forward' direction. It uses the existing configuration files. For creating them on a vnet level, there are new firewall configuration files located under '/etc/pve/sdn/firewall/.fw'. It utilizes the same configuration format as the existing firewall configuration files. You can only define rules with direction 'forward' on a vnet-level. ## Dependencies depends on my other patch series 'autogenerate ipsets for sdn objects', further instruction can be found there. Furthermore: * proxmox-firewall depends on proxmox-ve-rs * pve-manager depends on pve-firewall * pve-network depends on pve-firewall Changes from v4 to v5: * moved the check_vnet_access sub to the new Helpers module Changes from v3 to v4: * fix small bug that doesn't show warning when adding a new firewall rule on vnet-level with direction forward * improve documentation further, added a new section for directions Changes from v2 to v3: * do not allow REJECT rules in forward chains in UI and backend - thanks @Hannes * use arrow syntax for calling functions instead of &$ - thanks @Hannes * set width of new VNet firewall panel via flex, to avoid weird looking panel - thanks @Hannes * improve documentation - thanks @Hannes * show a warning in the frontend when creating forward rules - thanks @Thomas Changes from RFC to v2: * Fixed several bugs * SDN Firewall folder does not automatically created (thanks @Gabriel) * Firewall flushes the bridge table if no guest firewall is active, even though VNet-level rules exist * VNet-level firewall now matches on both input and output interface * Introduced log option for VNet firewall * Improved style of perl code (thanks @Thomas) * promox-firewall now verifies the directions of rules * added some additional tests to verify this behavior * added documentation pve-firewall: Stefan Hanreich (3): sdn: add vnet firewall configuration api: add vnet endpoints firewall: move to arrow syntax for calling functions src/PVE/API2/Firewall/Helpers.pm | 14 ++ src/PVE/API2/Firewall/Makefile | 1 + src/PVE/API2/Firewall/Rules.pm | 84 ++++++++++++ src/PVE/API2/Firewall/Vnet.pm | 156 +++++++++++++++++++++++ src/PVE/Firewall.pm | 211 ++++++++++++++++++++++++------- src/PVE/Firewall/Helpers.pm | 12 ++ 6 files changed, 434 insertions(+), 44 deletions(-) create mode 100644 src/PVE/API2/Firewall/Vnet.pm pve-manager: Stefan Hanreich (5): firewall: add forward direction to rule panel firewall: add vnet to firewall options component firewall: make base_url dynamically configurable in options component sdn: add firewall panel firewall: rules: show warning when creating forward rules www/manager6/Makefile | 2 + www/manager6/dc/Config.js | 9 +++ www/manager6/dc/SecurityGroups.js | 1 + www/manager6/grid/FirewallOptions.js | 74 +++++++++++++++---- www/manager6/grid/FirewallRules.js | 103 +++++++++++++++++++++++---- www/manager6/lxc/Config.js | 1 + www/manager6/node/Config.js | 1 + www/manager6/qemu/Config.js | 1 + www/manager6/sdn/FirewallPanel.js | 50 +++++++++++++ www/manager6/sdn/FirewallVnetView.js | 77 ++++++++++++++++++++ 10 files changed, 293 insertions(+), 26 deletions(-) create mode 100644 www/manager6/sdn/FirewallPanel.js create mode 100644 www/manager6/sdn/FirewallVnetView.js pve-network: Stefan Hanreich (1): firewall: add endpoints for vnet-level firewall src/PVE/API2/Network/SDN/Vnets.pm | 6 ++++++ 1 file changed, 6 insertions(+) pve-docs: Stefan Hanreich (1): firewall: add documentation for forward direction and vnet zone Makefile | 1 + gen-pve-firewall-vnet-opts.pl | 12 +++++ pve-firewall-vnet-opts.adoc | 8 +++ pve-firewall.adoc | 98 ++++++++++++++++++++++++++++++++--- 4 files changed, 112 insertions(+), 7 deletions(-) create mode 100755 gen-pve-firewall-vnet-opts.pl create mode 100644 pve-firewall-vnet-opts.adoc Summary over all repositories: 21 files changed, 845 insertions(+), 77 deletions(-) -- Generated by git-murpp 0.6.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel