DEV Community

Cover image for LLMNR and Firewalld Zones: Hardening Default Wi-Fi Profiles on Fedora Workstation
Guatu
Guatu

Posted on Originally published at guatulabs.dev

LLMNR and Firewalld Zones: Hardening Default Wi-Fi Profiles on Fedora Workstation

On a stock Fedora Workstation install, every new Wi-Fi network you join gets a firewall zone that accepts inbound TCP and UDP on ports 1025 through 65535. On top of that, systemd-resolved runs an LLMNR responder on UDP/TCP 5355, so your laptop answers name queries from anyone on the same coffee shop network. The Tailscale icon in the tray says "connected" the whole time, which makes it easy to assume none of this matters.

This post is for anyone who carries a Fedora laptop between home, hotels, airports and client sites, and who also runs a tailnet back to a homelab. If you've ever thought "I'm on Tailscale, so I'm covered," check what your laptop is exposing to the local network before you believe that. Fixing it isn't hard. The hard part is that most of the obvious fixes don't survive a reboot.

What's actually exposed by default

Fedora Workstation ships a custom firewalld zone called FedoraWorkstation, and it's the default zone. Check it yourself:

firewall-cmd --get-default-zone
# FedoraWorkstation

firewall-cmd --zone=FedoraWorkstation --list-all
# services: dhcpv6-client samba-client ssh
# ports: 1025-65535/udp 1025-65535/tcp
Enter fullscreen mode Exit fullscreen mode

The reasoning behind the open high ports is documented and defensible for a desktop. GNOME apps, games, media casting and dev servers bind to random high ports, and the Fedora Workstation working group decided that a firewall which silently breaks those apps is worse than one that lets them through. On a home LAN behind a router, I can live with that tradeoff.

The problem is that any interface without an explicit zone inherits the default zone. When you click a network in GNOME's Wi-Fi menu, NetworkManager creates a connection profile with connection.zone left empty:

nmcli -g connection.zone connection show "Airport_Free_WiFi"
# (empty line)

firewall-cmd --get-active-zones
# FedoraWorkstation
#   interfaces: wlp2s0
Enter fullscreen mode Exit fullscreen mode

Every SSID you've ever joined is a profile that inherits FedoraWorkstation. That includes the hotel network, the conference network, and your home network. GNOME Settings doesn't have any UI for zones, so most people never find out.

Then there's LLMNR. Fedora moved to systemd-resolved as the system resolver back in Fedora 33, and resolved's upstream default is LLMNR=yes. It does two things with that:

  1. Responder: it announces and answers queries for your hostname on every link, using multicast 224.0.0.252 / ff02::1:3 on port 5355.
  2. Resolver: single-label names (nas, printer, grafana) that don't resolve through unicast DNS get sent out as LLMNR queries to the local link.

The responder is an information leak: anyone on the network can learn your hostname, which is often firstname-laptop. The resolver is the worse half. LLMNR has no authentication, so whoever answers first wins. Tools like Responder have been poisoning LLMNR and NBT-NS on shared networks for over a decade. Windows gets most of the attention because of NTLM hash capture, but on Linux the failure looks like this: you type ssh nas out of habit on hotel Wi-Fi, your search domain doesn't resolve because you're off the tailnet's DNS, resolved falls back to LLMNR, and a stranger's machine answers "that's me."

See it on your own machine:

resolvectl status wlp2s0 | grep -E 'Protocols|Current Scopes'
# Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
#      Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS ...

ss -ulnp | grep 5355
# UNCONN 0 0  0.0.0.0:5355  0.0.0.0:*  users:(("systemd-resolve",...))
Enter fullscreen mode Exit fullscreen mode

Port 5355 sits inside 1025-65535, so the zone lets it through. The default zone and the default resolver config combine into the exposure.

What I tried first, and why it doesn't stick

The first instinct is to fix whatever is visible right now. Every one of these commands works when you run it. None of them is the fix.

resolvectl llmnr wlp2s0 no turns off LLMNR on the link immediately, and resolvectl status confirms it. Then NetworkManager reconnects (sleep/resume, roaming between access points, reboot) and pushes the link config back into resolved, and LLMNR is on again. resolvectl per-link settings are runtime state, owned by whoever manages the link, and on Fedora that's NetworkManager.

firewall-cmd --zone=public --change-interface=wlp2s0 moves the interface right away. Without --permanent it's runtime-only. Even with --permanent, firewalld and NetworkManager have a particular relationship: when NM manages an interface, the zone comes from the connection profile, and NM tells firewalld which zone to use when the connection activates. If the profile's zone is empty, you're back on the default zone the next time the connection comes up.

nmcli con mod "Hotel_Guest" connection.zone public is persistent, and it's correct. It also only covers one profile. The next SSID you join is a new profile with an empty zone. Hardening networks one SSID at a time is a list that only grows, and it fails open: you're exposed on every network you forgot about, which is exactly the set of networks you visit least and trust least.

Trusting the tailnet CIDR in a rich rule (source address="100.64.0.0/10" accept) looks clever, since it lets your other machines reach the laptop. But on a shared L2 network, source addresses are just bytes in a header. Whether a forged 100.x packet arriving on wlp2s0 gets dropped depends on reverse-path filtering doing its job for that address family. I don't want my security model to depend on a sysctl I'll forget about. Binding trust to the tailscale0 interface avoids the question entirely, because packets only show up on that interface after WireGuard has authenticated them.

So the rule is: fix the defaults, not the instances. Change what an unconfigured profile inherits, then make exceptions for the few networks you actually trust.

The actual fix

Step 1: Make public the default zone and tighten it

--set-default-zone is persistent on its own (it writes /etc/firewalld/firewalld.conf), so it doesn't need --permanent.

sudo firewall-cmd --set-default-zone=public

# Fedora's public zone still allows ssh and mdns. On a hostile network I want neither.
sudo firewall-cmd --permanent --zone=public --remove-service=ssh
sudo firewall-cmd --permanent --zone=public --remove-service=mdns

# Keep dhcpv6-client, or IPv6 breaks on networks that use DHCPv6.
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-all
Enter fullscreen mode Exit fullscreen mode

Optionally, set the zone target to DROP so unsolicited packets get silence instead of an ICMP reject:

sudo firewall-cmd --permanent --zone=public --set-target=DROP
sudo firewall-cmd --reload
Enter fullscreen mode Exit fullscreen mode

I do this on laptops. Rejects tell a scanner that a host exists, and a laptop on airport Wi-Fi has no reason to be polite.

Step 2: Pin tailscale0 to trusted before you lock yourself out

This is the step people skip, and they find out at the worst moment. If you SSH into your laptop from another tailnet machine, or run Syncthing or a dev server you hit over the tailnet, those connections arrive on tailscale0. Before Step 1, that interface got the permissive FedoraWorkstation default like everything else. After Step 1, it gets public with ssh removed, and your remote access goes dark.

sudo firewall-cmd --permanent --zone=trusted --add-interface=tailscale0
sudo firewall-cmd --reload
firewall-cmd --get-active-zones
# public
#   interfaces: wlp2s0
# trusted
#   interfaces: tailscale0
Enter fullscreen mode Exit fullscreen mode

trusted accepts everything. If that feels too broad, create a tailnet zone with just the services you need. I'm fine with trusted here because Tailscale ACLs already decide which tailnet devices can reach the laptop at all, so the firewall is the second layer, not the first. If your tailnet ACL is still the default allow-all, fix that before you trust the interface.

tailscale0 isn't managed by NetworkManager (Tailscale creates it itself), so the firewalld permanent config is what keeps the binding. That's what we want.

Step 3: Give your real home network an explicit zone

Your home LAN is now public as well, which may break casting, printing or whatever you relied on the open high ports for. Make it an explicit exception:

# Use 'home' (or FedoraWorkstation if you really want the old behaviour back)
sudo nmcli connection modify "HomeNet-5G" connection.zone home
sudo nmcli connection up "HomeNet-5G"
Enter fullscreen mode Exit fullscreen mode

Now the list of exceptions is short and deliberate, and everything new fails closed.

Step 4: Turn off LLMNR (and mDNS) globally

Kill it in resolved and in NetworkManager's per-connection defaults, so neither side turns it back on. First, resolved:

# /etc/systemd/resolved.conf.d/10-no-llmnr.conf
[Resolve]
LLMNR=no
MulticastDNS=no
Enter fullscreen mode Exit fullscreen mode

Then NetworkManager's global connection defaults:

# /etc/NetworkManager/conf.d/10-no-llmnr.conf
[connection]
# 0 = no, 1 = resolve-only, 2 = yes; applies to profiles left at "default"
connection.llmnr=0
connection.mdns=0
Enter fullscreen mode Exit fullscreen mode

Apply both:

sudo systemctl restart systemd-resolved
sudo systemctl reload NetworkManager
# Reconnect so the link config is re-pushed
nmcli connection up "$(nmcli -t -g NAME connection show --active | head -1)"
Enter fullscreen mode Exit fullscreen mode

The global resolved setting wins in the safe direction. A link can't enable a protocol that's disabled globally, so even if a profile says llmnr=yes, resolved won't run it. The NM default is there so resolvectl status stops reporting +LLMNR per link and you don't have to wonder which layer to believe.

If you actually use mDNS at home (printer.local, Chromecasts), turn it back on for that one profile with nmcli con mod "HomeNet-5G" connection.mdns yes and drop MulticastDNS=no from the resolved drop-in. A global no in resolved overrides the per-link setting, so you can't keep both.

Step 5: Make the tailnet actually carry traffic on untrusted links

Here the "Tailscale is connected" assumption breaks. Connected only means your tailnet routes (100.x addresses and any subnet routes you've accepted) go through tailscale0. With no exit node set, everything else (web traffic, and depending on your DNS config, DNS too) leaves through the hotel's router in the clear. Check it:

ip route get 1.1.1.1
# 1.1.1.1 via 10.0.0.1 dev wlp2s0 src 10.0.0.57   <- local Wi-Fi, not the tunnel

tailscale status --json | jq -r '.ExitNodeStatus.ID // "no exit node"'
# no exit node
Enter fullscreen mode Exit fullscreen mode

If you already run a node at home as an exit node (setup is in my Tailscale subnet router post), you could turn it on manually every time. You won't do that reliably, and you'll forget to turn it off at home, where hairpinning through your own exit node is pointless. Tailscale doesn't know which physical networks you trust, but NetworkManager does, because we just encoded trust in connection.zone. A dispatcher script connects the two.

Step 6: The dispatcher script

The script needs to do three things. It enables the exit node on any Wi-Fi profile not in the home zone. It waits out captive portals, because sending a hotel login page through an exit node in another city means the portal never loads and you never get online. And it only makes changes when the current state is wrong, so repeated connectivity-change events don't hammer tailscale set.

#!/bin/bash
# /etc/NetworkManager/dispatcher.d/50-wifi-safe
ACTION="$2"
EXIT_NODE="home-exit"          # tailnet name of your exit node
TRUSTED_ZONES="home"           # space-separated

case "$ACTION" in up|down|connectivity-change) ;; *) exit 0 ;; esac

CON=$(nmcli -t -f NAME,TYPE connection show --active \
      | awk -F: '$2=="802-11-wireless"{print $1; exit}')
[ -z "$CON" ] && exit 0        # no active Wi-Fi, wired/offline: leave it alone

ZONE=$(nmcli -g connection.zone connection show "$CON")
STATE=$(nmcli networking connectivity)
CURRENT=$(tailscale status --json 2>/dev/null | jq -r '.ExitNodeStatus.ID // empty')
log() { logger -t wifi-safe "$*"; }
Enter fullscreen mode Exit fullscreen mode

Second half:

if [[ " $TRUSTED_ZONES " == *" $ZONE "* ]]; then
  [ -n "$CURRENT" ] && { tailscale set --exit-node=; log "trusted '$CON': exit node off"; }
  exit 0
fi

case "$STATE" in
  portal|limited)
    log "untrusted '$CON' in $STATE state, deferring exit node until portal login"
    [ -n "$CURRENT" ] && tailscale set --exit-node=   # let the portal page load locally
    ;;
  full)
    [ -z "$CURRENT" ] && { tailscale set --exit-node="$EXIT_NODE"; log "untrusted '$CON': exit node on"; }
    ;;
esac
exit 0
Enter fullscreen mode Exit fullscreen mode

Install it with the permissions NetworkManager requires:

sudo install -o root -g root -m 0755 50-wifi-safe /etc/NetworkManager/dispatcher.d/
sudo restorecon -v /etc/NetworkManager/dispatcher.d/50-wifi-safe
sudo systemctl enable --now NetworkManager-dispatcher.service
Enter fullscreen mode Exit fullscreen mode

Some notes from writing this:

  • Permissions decide whether it runs. NetworkManager ignores dispatcher scripts that aren't owned by root, are writable by group or other, or aren't executable. It doesn't show an error in GNOME and doesn't complain loudly in the journal. The script just never runs and you stay exposed. install -m 0755 -o root handles all three. restorecon matters on Fedora because a file created in your home directory and then mv'd into place keeps its user_home_t label, and SELinux will block it.
  • The portal path deliberately clears the exit node. nmcli networking connectivity reports portal until NetworkManager's connectivity check succeeds. Once you log in, NM fires connectivity-change with state full, the script runs again, and the exit node comes on. The window between joining and logging in is unprotected. That's the honest cost of being able to use hotel Wi-Fi at all, and the firewall work in Steps 1 to 4 is what covers you during it.
  • logger -t wifi-safe gives you journalctl -t wifi-safe, which is the only realistic way to debug this later.
  • If you have an Ethernet dongle you use in hostile places, extend the awk match to 802-3-ethernet. I left it out because my wired connections are almost always at a desk I control.
  • Recent Tailscale clients also support automatic exit node selection (--exit-node=auto:any, and tailscale exit-node suggest to see what it would pick). That works if you have several exit nodes. The trusted-vs-untrusted decision still has to come from somewhere, and NetworkManager's zone is a better source of truth than anything Tailscale can see.

Verification: prove it survives a reboot

Every check here is something that used to pass in the current session and then fail after a reconnect. So run them after a reboot, then join a network you've never used before (a phone hotspot with a fresh SSID works):

# 1. Default zone persisted, and the new SSID inherited it
firewall-cmd --get-default-zone                  # public
firewall-cmd --get-active-zones                  # wlp2s0 in public, tailscale0 in trusted

# 2. Nothing listening on the LLMNR port
ss -ulnp | grep -c 5355                          # 0
resolvectl status | grep -i llmnr                # -LLMNR everywhere

# 3. Exit node engaged on the untrusted link
ip route get 1.1.1.1                             # ... dev tailscale0
tailscale status --json | jq -r '.ExitNodeStatus.ID'

# 4. Dispatcher actually ran
journalctl -t wifi-safe -b --no-pager | tail -5
Enter fullscreen mode Exit fullscreen mode

Then test it from outside. From another machine on the same hotspot, run nmap -Pn -p 22,5355 <laptop-ip> and a UDP probe of 5355. With the DROP target you should get filtered everywhere. Finally, from a tailnet peer, ssh to the laptop's 100.x address to confirm Step 2 kept your remote access working.

Why this works

All of this depends on understanding who owns which piece of state on Fedora:

Setting Runtime owner Persistent source of truth
Interface → zone firewalld NM profile connection.zone, else firewalld default zone
Per-link LLMNR/mDNS systemd-resolved NM profile, capped by resolved.conf global
Exit node tailscaled tailscaled prefs (set by dispatcher)
tailscale0 → zone firewalld firewalld permanent config (NM doesn't manage it)

Everything I tried first changed the runtime column. The fix changes the persistent column, and specifically the defaults in it, because defaults are what new and forgotten networks get. An empty connection.zone isn't a misconfiguration to correct profile by profile. It means "use the default," so you change the default.

The LLMNR fix works because resolved uses the most restrictive setting: a global no can't be overridden by a link. So the global setting is the security boundary, and the NM default just keeps the reporting consistent.

The interface binding for tailscale0 works because it moves trust from "what does this packet claim" to "which path did this packet arrive on." Packets on tailscale0 have already been decrypted and authenticated by WireGuard against a known peer key. Packets on wlp2s0 have been through nothing. The firewall should treat them differently based on that fact, not on a source address an attacker can type.

If you want to read more about why DNS defaults cause this many problems, the ndots and wildcard DNS post is the Kubernetes version of the same lesson: single-label names and fallback resolution paths do things you didn't ask for.

Lessons learned

Audit defaults, not instances. The useful question isn't "is this network's profile hardened?" It's "what does a profile I've never configured get?" On Fedora Workstation the answer is a zone built for a desk at home. Change that answer once and every future network benefits.

Fedora's defaults are reasonable for a desktop and wrong for a laptop that moves. I don't think the Workstation team got this wrong. Breaking GNOME apps on the 95% of networks that are someone's home router would generate a lot of bug reports. But the defaults assume one trusted network, and a laptop doesn't have one.

"Connected" in the Tailscale tray says nothing about your egress path. Use ip route get against a public IP. If it says dev wlp2s0, your traffic is going out the local network regardless of what the tray icon shows.

Pin tailscale0 before you tighten anything. Doing Step 1 before Step 2 is how you end up debugging remote access to a laptop you can't reach. Order matters here.

Dispatcher scripts fail silently. Wrong owner, wrong mode, or wrong SELinux label, and NetworkManager quietly skips the script. Always log from the script and always check journalctl -t after install. If there's no log line, assume the script didn't run.

Captive portals are a real gap, not an edge case. You can't fully close the window between joining and logging in without breaking the login itself. The firewall and LLMNR hardening matter most during that window, which is why I wouldn't rely on the exit node alone.

If you're building this kind of layered remote-access setup across a fleet of machines instead of one laptop, it's the sort of work I do for clients. For a single Fedora laptop, the six steps above take about fifteen minutes, and the post-reboot checks are what tell you whether they actually took.

Top comments (0)