Page MenuHomeVyOS Platform

Configuring a dynamic address group, config script did not check whether the group was created
Closed, ResolvedPublicBUG

Description

I added a rule to dynamically add the source address to the dynamic address group through the command line.

# set firewall ipv4 name WAN_IN rule 30 action continue
# set firewall ipv4 name WAN_IN rule 30 add-address-to-group source-address timeout 1m
# set firewall ipv4 name WAN_IN rule 30 add-address-to-group source-address address-group tempGroup
# set firewall ipv4 name WAN_IN rule 30 icmp
# set firewall ipv4 name WAN_IN rule 30 packet-length 1052

The following is the content added to the configuration file:

# show 
+            rule 30 {
+                action continue
+                add-address-to-group {
+                    source-address {
+                        address-group tempGroup
+                        timeout 1m
+                    }
+                }
+                icmp {
+                }
+                packet-length 1052
+            }

When I execute 'commit', the vyos system reports an error, the error is as follows

# commit
Failed to apply firewall: /run/nftables.conf:45:65-77: Error: No such
file or directory; did you mean set ‘DA_tempGroup’ in table ip
‘vyos_conntrack’?         ip length {1052} counter set update ip saddr
timeout 1m @DA_tempGroup continue comment "ipv4-NAM-WAN_IN-30"
^^^^^^^^^^^^^

[[firewall]] failed
Commit failed

When I create the dynamic address group manually and then commit, everything works fine.

# set firewall group dynamic-group address-group tempGroup
# commit

My suggestion: when the user uses a dynamic (static) address group when creating a firewall rule, first check whether the address group exists. If it does not exist, tell user to create it or the system automatically creates the address group for the user.

Details

Difficulty level
Unknown (require assessment)
Version
1.4.0-epa2, 1.5-rolling-202403180024
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Improvement (missing useful functionality)

Event Timeline

Viacheslav changed the task status from Open to Confirmed.Mar 18 2024, 9:06 AM
Viacheslav triaged this task as High priority.
n.fort changed Version from vyos 1.4 ep1 to vyos 1.5 to 1.4.0-epa2, 1.5-rolling-202403180024.

And a simple note for your usage @wenzk
Change
set firewall ipv4 name WAN_IN rule 30 icmp
to this:
set firewall ipv4 name WAN_IN rule 30 protocol icmp

n.fort changed the task status from Confirmed to In progress.Mar 18 2024, 3:01 PM

And a simple note for your usage @wenzk
Change
set firewall ipv4 name WAN_IN rule 30 icmp
to this:
set firewall ipv4 name WAN_IN rule 30 protocol icmp

thanks for your note

n.fort changed the task status from In progress to Needs testing.Mar 19 2024, 8:36 AM
n.fort moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.
n.fort moved this task from Need Triage to Finished on the VyOS 1.5 Circinus board.