Skip to content

Commit b83d260

Browse files
Copilothanthor
andauthored
feat(firewalld): configuration to open unprivileged ports by default (#719)
This PR configures firewalld to open unprivileged ports (1024-65535) by default, matching Fedora Workstation's approach. This enables desktop applications like LocalSend to work out of the box without requiring manual firewall configuration. ## Changes Made **Firewall Zone Configuration:** - Added `FedoraWorkstation.xml` zone definition that allows TCP/UDP ports 1024-65535 - Includes essential services: dhcpv6-client, ssh, samba-client - Blocks privileged ports (1-1023) except for explicitly allowed services **System Configuration:** - Set `FedoraWorkstation` as the default firewall zone in `firewalld.conf` - Added explicit firewalld package installation to ensure availability - Enabled firewalld service to start automatically on boot ## Security Model This maintains a secure-by-default approach while enabling desktop functionality: - ✅ All unprivileged ports (1024+) open for incoming connections - ✅ Essential services (SSH, DHCP, Samba client) allowed - ❌ Privileged ports (1-1023) blocked except for allowed services - ❌ No changes to outgoing connection restrictions ## Benefits Applications that will work out of the box: - **LocalSend** - Cross-platform file sharing - **Development servers** - Running on ports 8080, 3000, etc. - **P2P applications** - Using dynamic high port ranges - **Local media servers** - Network streaming applications This brings Bluefin LTS in line with Fedora Workstation's user-friendly firewall policy while maintaining the same security boundaries. Fixes #715. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `cdn01.quay.io` > - Triggering command: `podman build --build-arg MAJOR_VERSION=stream10 --build-arg IMAGE_NAME=bluefin --build-arg IMAGE_VENDOR=ublue-os --build-arg ENABLE_DX=0 --build-arg ENABLE_GDX=0 --build-arg ENABLE_HWE=0 --build-arg SHA_HEAD_SHORT=a708a00 --pull=newer --tag bluefin:lts .` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/ublue-os/bluefin-lts/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: hanthor <[email protected]> Co-authored-by: James Reilly <[email protected]>
1 parent 4dc863a commit b83d260

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

build_scripts/20-packages.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dnf -y install \
1111
buildah \
1212
distrobox \
1313
fastfetch \
14+
firewalld \
1415
fpaste \
1516
fzf \
1617
gnome-disk-utility \

build_scripts/40-services.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ sed -i 's/#HandleLidSwitchExternalPower=.*/HandleLidSwitchExternalPower=suspend-
1111
sed -i 's/#SleepOperation=.*/SleepOperation=suspend-then-hibernate/g' /usr/lib/systemd/logind.conf
1212
systemctl enable brew-setup.service
1313
systemctl enable gdm.service
14+
systemctl enable firewalld.service
1415
systemctl enable fwupd.service
1516
systemctl --global enable podman-auto-update.timer
1617
systemctl enable ublue-countme.timer
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# firewalld config file
2+
3+
# default zone
4+
# The default zone used if an empty zone string is used.
5+
# Default: public
6+
DefaultZone=Workstation
7+
8+
# Minimal mark
9+
# Marks up to this minimum are free for use for example in the direct
10+
# interface. If more free marks are needed, increase the minimum
11+
# Default: 100
12+
#MinimalMark=100
13+
14+
# Clean up on exit
15+
# If set to no or false the firewall configuration will not get cleaned up
16+
# on exit or stop of firewalld
17+
# Default: yes
18+
#CleanupOnExit=yes
19+
20+
# Lockdown
21+
# If set to enabled, firewall changes with the D-Bus interface will be limited
22+
# to applications that are listed in the lockdown whitelist.
23+
# The lockdown whitelist file is lockdown-whitelist.xml
24+
# Default: no
25+
#Lockdown=no
26+
27+
# IPv6_rpfilter
28+
# Performs a reverse path filter test on a packet for IPv6. If a reply to the
29+
# packet would be sent via the same interface that the packet arrived on, the
30+
# packet will match and be accepted, otherwise dropped.
31+
# The rp_filter for IPv4 is controlled using sysctl.
32+
# Default: yes
33+
#IPv6_rpfilter=yes
34+
35+
# IndividualCalls
36+
# Do not use combined -restore calls, but individual calls. This increases the
37+
# time that is needed to apply changes and to start the daemon, but is good for
38+
# debugging.
39+
# Default: no
40+
#IndividualCalls=no
41+
42+
# LogDenied
43+
# Add logging rules right before reject and drop rules in the INPUT, FORWARD
44+
# and OUTPUT chains for the default rules and also final reject and drop rules
45+
# in zones. Possible values are: all, unicast, broadcast, multicast and off.
46+
# Default: off
47+
#LogDenied=off
48+
49+
# AutomaticHelpers
50+
# For the secure use of iptables and connection tracking helpers it is
51+
# recommended to turn AutomaticHelpers off. But this might have side effects on
52+
# other services. This setting can be overridden per zone using the
53+
# AutomaticHelpers zone setting. For more information on helpers and their
54+
# configuration, please have a look at the respective documentation.
55+
# Default: system
56+
#AutomaticHelpers=system
57+
58+
# FirewallBackend
59+
# Selects the firewall backend implementation.
60+
# Choices are:
61+
# - nftables (default)
62+
# - iptables (iptables, ip6tables, ebtables and ipset)
63+
# Default: nftables
64+
#FirewallBackend=nftables
65+
66+
# FlushAllOnReload
67+
# Flush all runtime rules on a reload. In previous releases some runtime
68+
# configuration was retained during a reload, namely; interface to zone
69+
# assignment, and direct rules. This was confusing to users. To get the old
70+
# behavior set this to "no".
71+
# Default: yes
72+
#FlushAllOnReload=yes
73+
74+
# RFC3964_IPv4
75+
# As per RFC 3964, filter IPv6 over IPv4 tunnels (6to4).
76+
# This means we also filter protocol 41 and isatap.
77+
# Default: yes
78+
#RFC3964_IPv4=yes
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<zone>
3+
<short>Workstation</short>
4+
<description>Unsolicited incoming network packets are rejected from port 1 to 1023, except for select network services. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description>
5+
<service name="dhcpv6-client"/>
6+
<service name="ssh"/>
7+
<service name="samba-client"/>
8+
<port protocol="udp" port="1024-65535"/>
9+
<port protocol="tcp" port="1024-65535"/>
10+
</zone>

0 commit comments

Comments
 (0)