From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH docs/firewall/manager/network/proxmox{-ve-rs, -firewall} v3 00/18] add forward chain firewalling for hosts and vnets
Date: Tue, 12 Nov 2024 13:25:57 +0100 [thread overview]
Message-ID: <20241112122615.88854-1-s.hanreich@proxmox.com> (raw)
## 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/<vnet>.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 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
proxmox-ve-rs:
Stefan Hanreich (4):
firewall: add forward direction
firewall: add bridge firewall config parser
config: firewall: add tests for interface and directions
host: add struct representing bridge names
proxmox-ve-config/src/firewall/bridge.rs | 64 +++++++++++++++++++
proxmox-ve-config/src/firewall/cluster.rs | 11 ++++
proxmox-ve-config/src/firewall/common.rs | 11 ++++
proxmox-ve-config/src/firewall/guest.rs | 66 ++++++++++++++++++++
proxmox-ve-config/src/firewall/host.rs | 12 +++-
proxmox-ve-config/src/firewall/mod.rs | 1 +
proxmox-ve-config/src/firewall/types/rule.rs | 10 ++-
proxmox-ve-config/src/host/mod.rs | 1 +
proxmox-ve-config/src/host/types.rs | 46 ++++++++++++++
9 files changed, 219 insertions(+), 3 deletions(-)
create mode 100644 proxmox-ve-config/src/firewall/bridge.rs
create mode 100644 proxmox-ve-config/src/host/types.rs
proxmox-firewall:
Stefan Hanreich (4):
nftables: derive additional traits for nftables types
sdn: add support for loading vnet-level firewall config
sdn: create forward firewall rules
use std::mem::take over drain()
.../resources/proxmox-firewall.nft | 54 ++++++++
proxmox-firewall/src/config.rs | 88 ++++++++++++-
proxmox-firewall/src/firewall.rs | 122 +++++++++++++++++-
proxmox-firewall/src/rule.rs | 7 +-
proxmox-firewall/tests/integration_tests.rs | 12 ++
.../integration_tests__firewall.snap | 86 ++++++++++++
proxmox-nftables/src/expression.rs | 8 ++
proxmox-nftables/src/types.rs | 14 +-
8 files changed, 378 insertions(+), 13 deletions(-)
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/Makefile | 1 +
src/PVE/API2/Firewall/Rules.pm | 84 +++++++++++++
src/PVE/API2/Firewall/Vnet.pm | 168 ++++++++++++++++++++++++++
src/PVE/Firewall.pm | 213 ++++++++++++++++++++++++++-------
src/PVE/Firewall/Helpers.pm | 12 ++
5 files changed, 433 insertions(+), 45 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 | 96 ++++++++++++++++++++++++----
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, 286 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
Makefile | 1 +
gen-pve-firewall-vnet-opts.pl | 12 +++++++
pve-firewall-vnet-opts.adoc | 8 +++++
pve-firewall.adoc | 65 +++++++++++++++++++++++++++++++----
4 files changed, 80 insertions(+), 6 deletions(-)
create mode 100755 gen-pve-firewall-vnet-opts.pl
create mode 100644 pve-firewall-vnet-opts.adoc
Summary over all repositories:
37 files changed, 1402 insertions(+), 93 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
next reply other threads:[~2024-11-12 12:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 12:25 Stefan Hanreich [this message]
2024-11-12 12:25 ` [pve-devel] [PATCH proxmox-ve-rs v3 01/18] firewall: add forward direction Stefan Hanreich
2024-11-12 12:25 ` [pve-devel] [PATCH proxmox-ve-rs v3 02/18] firewall: add bridge firewall config parser Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH proxmox-ve-rs v3 03/18] config: firewall: add tests for interface and directions Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH proxmox-ve-rs v3 04/18] host: add struct representing bridge names Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH proxmox-firewall v3 05/18] nftables: derive additional traits for nftables types Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH proxmox-firewall v3 06/18] sdn: add support for loading vnet-level firewall config Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH proxmox-firewall v3 07/18] sdn: create forward firewall rules Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH proxmox-firewall v3 08/18] use std::mem::take over drain() Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-firewall v3 09/18] sdn: add vnet firewall configuration Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-firewall v3 10/18] api: add vnet endpoints Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-firewall v3 11/18] firewall: move to arrow syntax for calling functions Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-manager v3 12/18] firewall: add forward direction to rule panel Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-manager v3 13/18] firewall: add vnet to firewall options component Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-manager v3 14/18] firewall: make base_url dynamically configurable in " Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-manager v3 15/18] sdn: add firewall panel Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-manager v3 16/18] firewall: rules: show warning when creating forward rules Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-network v3 17/18] firewall: add endpoints for vnet-level firewall Stefan Hanreich
2024-11-12 12:26 ` [pve-devel] [PATCH pve-docs v3 18/18] firewall: add documentation for forward direction Stefan Hanreich
2024-11-13 15:37 ` Hannes Duerr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241112122615.88854-1-s.hanreich@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox