Skip to content

Commit cda6d64

Browse files
lawli3tThomasLamprecht
authored andcommitted
firewall: add documentation for forward direction and vnet zone
Added a new direction section, mostly so I can write about the forward direction and explain its use cases. Signed-off-by: Stefan Hanreich <[email protected]>
1 parent 4f7c386 commit cda6d64

File tree

4 files changed

+112
-7
lines changed

4 files changed

+112
-7
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ GEN_SCRIPTS= \
6262
gen-pve-firewall-macros-adoc.pl \
6363
gen-pve-firewall-rules-opts.pl \
6464
gen-pve-firewall-vm-opts.pl \
65+
gen-pve-firewall-vnet-opts.pl \
6566
gen-output-format-opts.pl
6667

6768
API_VIEWER_FILES= \

gen-pve-firewall-vnet-opts.pl

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/perl
2+
3+
use lib '.';
4+
use strict;
5+
use warnings;
6+
7+
use PVE::Firewall;
8+
use PVE::RESTHandler;
9+
10+
my $prop = $PVE::Firewall::vnet_option_properties;
11+
12+
print PVE::RESTHandler::dump_properties($prop);

pve-firewall-vnet-opts.adoc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
`enable`: `<boolean>` ('default =' `0`)::
2+
3+
Enable/disable firewall rules.
4+
5+
`policy_forward`: `<ACCEPT | DROP>` ::
6+
7+
Forward policy.
8+

pve-firewall.adoc

+91-7
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,68 @@ transparent, and we filter traffic for both protocols by default. So
4545
there is no need to maintain a different set of rules for IPv6.
4646

4747

48+
Directions & Zones
49+
------------------
50+
51+
The Proxmox VE firewall groups the network into multiple logical zones. You can
52+
define rules for each zone independently. Depending on the zone, you can define
53+
rules for incoming, outgoing or forwarded traffic.
54+
55+
56+
Directions
57+
~~~~~~~~~~
58+
59+
There are 3 directions that you can choose from when defining rules for a zone:
60+
61+
In::
62+
63+
Traffic that is arriving in a zone.
64+
65+
Out::
66+
67+
Traffic that is leaving a zone.
68+
69+
Forward::
70+
71+
Traffic that is passing through a zone. In the host zone this can be routed
72+
traffic (when the host is acting as a gateway or performing NAT). At a
73+
VNet-level this affects all traffic that is passing by a VNet, including
74+
traffic from/to bridged network interfaces.
75+
76+
77+
IMPORTANT: Creating rules for forwarded traffic is currently only possible when
78+
using the new xref:pve_firewall_nft[nftables-based proxmox-firewall]. Any
79+
forward rules will be ignored by the stock `pve-firewall` and have no effect!
80+
81+
4882
Zones
49-
-----
83+
~~~~~
5084

51-
The Proxmox VE firewall groups the network into the following logical zones:
85+
There are 3 different zones that you can define firewall rules for:
5286

5387
Host::
5488

55-
Traffic from/to a cluster node
89+
Traffic going from/to a host, or traffic that is forwarded by a host.
90+
You can define rules for this zone either at the datacenter level or at the host
91+
level. Rules at host level take precedence over rules at datacenter level.
5692

5793
VM::
5894

59-
Traffic from/to a specific VM
95+
Traffic going from/to a VM or CT.
96+
You cannot define rules for forwarded traffic, only for incoming / outgoing
97+
traffic.
98+
99+
VNet::
100+
101+
Traffic passing through a SDN VNet, either from guest to guest or from host to
102+
guest and vice-versa.
103+
Since this traffic is always forwarded traffic, it is only possible to create
104+
rules with direction forward.
60105

61-
For each zone, you can define firewall rules for incoming and/or
62-
outgoing traffic.
106+
107+
IMPORTANT: Creating rules on a VNet-level is currently only possible when using
108+
the new xref:pve_firewall_nft[nftables-based proxmox-firewall]. Any VNet-level
109+
rules will be ignored by the stock `pve-firewall` and have no effect!
63110

64111

65112
Configuration Files
@@ -202,10 +249,46 @@ can selectively enable the firewall for each interface. This is
202249
required in addition to the general firewall `enable` option.
203250

204251

252+
[[pve_firewall_vnet_configuration]]
253+
VNet Configuration
254+
~~~~~~~~~~~~~~~~~~
255+
VNet related configuration is read from:
256+
257+
/etc/pve/sdn/firewall/<vnet_name>.fw
258+
259+
This can be used for setting firewall configuration globally on a VNet level,
260+
without having to set firewall rules for each VM inside the VNet separately. It
261+
can only contain rules for the `FORWARD` direction, since there is no notion of
262+
incoming or outgoing traffic. This affects all traffic travelling from one
263+
bridge port to another, including the host interface.
264+
265+
WARNING: This feature is currently only available for the new
266+
xref:pve_firewall_nft[nftables-based proxmox-firewall]
267+
268+
Since traffic passing the `FORWARD` chain is bi-directional, you need to create
269+
rules for both directions if you want traffic to pass both ways. For instance if
270+
HTTP traffic for a specific host should be allowed, you would need to create the
271+
following rules:
272+
273+
----
274+
FORWARD ACCEPT -dest 10.0.0.1 -dport 80
275+
FORWARD ACCEPT -source 10.0.0.1 -sport 80
276+
----
277+
278+
`[OPTIONS]`::
279+
280+
This is used to set VNet related firewall options.
281+
282+
include::pve-firewall-vnet-opts.adoc[]
283+
284+
`[RULES]`::
285+
286+
This section contains VNet specific firewall rules.
287+
205288
Firewall Rules
206289
--------------
207290
208-
Firewall rules consists of a direction (`IN` or `OUT`) and an
291+
Firewall rules consists of a direction (`IN`, `OUT` or `FORWARD`) and an
209292
action (`ACCEPT`, `DENY`, `REJECT`). You can also specify a macro
210293
name. Macros contain predefined sets of rules and options. Rules can be
211294
disabled by prefixing them with `|`.
@@ -639,6 +722,7 @@ Ports used by {pve}
639722
* live migration (VM memory and local-disk data): 60000-60050 (TCP)
640723

641724

725+
[[pve_firewall_nft]]
642726
nftables
643727
--------
644728

0 commit comments

Comments
 (0)