build: install a firewalld zone for shared mode

Install a NM-specific firewalld zone to be used for interfaces that
are used for connection sharing. The zone blocks all traffic to the
local machine except some protocols (DHCP, DNS and ICMP) and allows
all forwarded traffic.
This commit is contained in:
Beniamino Galvani
2020-05-08 09:09:25 +02:00
parent fb0d59689c
commit c8b5bf402d
7 changed files with 57 additions and 0 deletions

View File

@@ -67,3 +67,10 @@ if enable_polkit
install_dir: polkit_gobject_policydir,
)
endif
if enable_firewalld_zone
install_data(
'nm-shared.xml',
install_dir: join_paths(nm_prefix, 'lib', 'firewalld', 'zones')
)
endif

23
data/nm-shared.xml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<zone target="ACCEPT">
<short>NetworkManager Shared</short>
<description>
This zone is used internally by NetworkManager when activating a
profile that uses connection sharing and doesn't have an explicit
firewall zone set.
Block all traffic to the local machine except ICMP, ICMPv6, DHCP
and DNS. Allow all forwarded traffic.
Note that future package updates may change the definition of the
zone unless you overwrite it with your own definition.
</description>
<rule priority='32767'>
<reject/>
</rule>
<protocol value='icmp'/>
<protocol value='ipv6-icmp'/>
<service name="dhcp"/>
<service name="dns"/>
</zone>