Skip to main content
← Back to list
01Issue
FeatureShippedExtensionsPublicTeam
Assigneesstack72

Relationships

#4334 cfgmgmt firewall (ufw): an input for rule position (insert before/after)

Opened by nckrtl · 11/3/2026· Shipped 11/17/2026

What I'm trying to do. Orbit converges UFW rules on its Nodes with @swamp/cfgmgmt firewall. UFW stops at the first matching rule, so order matters: an operator's deny for one address has to sit above a broader allow, and narrower sources (one address, then a CIDR) above "anywhere".

What I do today. As far as I can tell, the ufw backend always appends a new rule, and there's no input for its position. So I keep one small script on each Node that reads ufw status numbered, works out the right position, and runs ufw insert N … under a lock. It's the last piece of my firewall handling that isn't a plain cfgmgmt step. I may have missed an existing way to do this; if so, a pointer would be great.

What would help. An optional position input for the ufw backend, for example one of:

  • insertAt: <number>, passed through to ufw insert;
  • before: <match> / after: <match>, using the same destination/comment matching #4230 added (thank you for that one).

It would also help if check reported drift when the rule exists but sits in the wrong position, so a converge can repair the order.

With that, I could drop the script and keep the whole firewall flow in official steps.

Upstream repository: https://github.com/swamp-club/swamp-extensions

Environment

  • Extension: @swamp/cfgmgmt@2026.10.27.1
  • swamp: 20261031.063736.0-sha.e459d219
  • OS: linux (x86_64)
  • Deno: 2.9.8
  • Shell: /usr/bin/zsh
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 10 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

11/17/2026, 5:35:03 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7211/17/2026, 4:24:42 PM
Editable. Press Enter to edit.

system commented 11/3/2026, 5:46:19 AM

Classified automatically when this issue was filed.

  • Source: Extensions

If you feel this classification is incorrect, add a ripple to tell us so.

stack72 commented 11/17/2026, 5:35:06 PM

Thanks @nckrtl for reporting this! We shipped: Add optional rule placement to the cfgmgmt firewall model on the ufw backend: before/after an anchor rule identified by its comment, or first. check reports a rule that exists but is misplaced (current.misplaced); apply inserts new rules at the right position and repairs misplaced ones by delete then insert, restoring the rule if the insert fails. firewalld and iptables refuse the inputs; iptables follows in a separate issue.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.