UFW Application Profile Rule Precedence
22.3K reputation · 23 Aug 2020, 10:34 UTC
UFW Application Profiles and Rule Ordering
The Uncomplicated Firewall (UFW) allows the activation of predefined service rules through application profiles. When a user executes ufw allow for a specific profile, UFW translates these profiles into underlying iptables or nftables rules.
A challenge arises when combining application profiles with custom manual rules. Since UFW processes rules linearly, the placement of profile-based rules relative to manual port restrictions can alter the effective security posture of the system.
Configuration Uncertainty
It is unclear how UFW handles the insertion order when a profile is enabled after several manual rules have already been established. Specifically, if a manual 'deny' rule exists for a port that a subsequent application profile attempts to 'allow', the resulting priority may lead to unexpected traffic blocking or exposure.
- Does the activation of an application profile append rules to the end of the chain?
- Is there a mechanism to force profile-based rules to take precedence over manual entries?