.. _vyos.rest.vyos_firewall_rules_module:
*****************************
vyos.rest.vyos_firewall_rules
*****************************
**Manage firewall rule sets on VyOS devices using REST API**
Version added: 1.0.0
.. contents::
:local:
:depth: 1
Synopsis
--------
- Manages named firewall rule sets on VyOS devices via the REST API.
- Supports both IPv4 (``ipv4``) and IPv6 (``ipv6``) rule sets.
- Uses REST API (``connection=httpapi``) instead of CLI.
- In VyOS 1.5+, firewall uses named rule sets under ``firewall.ipv4.name`` and ``firewall.ipv6.name``.
Parameters
----------
.. raw:: html
| Parameter |
Choices/Defaults |
Comments |
|
config
list
/ elements=dictionary
|
|
Firewall rule set configuration.
|
|
afi
string
/ required
|
|
Address family.
|
|
rule_sets
list
/ elements=dictionary
|
|
Named rule sets for this address family.
|
|
|
default_action
string
|
Choices:
- accept
- drop
- reject
|
Default action when no rule matches.
|
|
|
description
string
|
|
Rule set description.
|
|
|
name
string
/ required
|
|
Rule set name.
|
|
|
rules
list
/ elements=dictionary
|
|
Firewall rules in this rule set.
|
|
|
|
action
string
|
Choices:
- accept
- drop
- reject
- return
- queue
- continue
|
Rule action.
|
|
|
|
description
string
|
|
Rule description.
|
|
|
|
destination
dictionary
|
|
Destination match criteria.
|
|
|
|
|
address
string
|
|
Destination IP address or prefix.
|
|
|
|
|
group
string
|
|
Destination group name.
|
|
|
|
|
port
string
|
|
Destination port or range.
|
|
|
|
disable
boolean
|
|
Disable this rule.
|
|
|
|
icmp
dictionary
|
|
ICMP type/code to match.
|
|
|
|
|
code
integer
|
|
ICMP code.
|
|
|
|
|
type
integer
|
|
ICMP type.
|
|
|
|
log
boolean
|
|
Enable logging for this rule.
|
|
|
|
number
integer
/ required
|
|
Rule number.
|
|
|
|
protocol
string
|
|
Protocol to match.
|
|
|
|
source
dictionary
|
|
Source match criteria.
|
|
|
|
|
address
string
|
|
Source IP address or prefix.
|
|
|
|
|
group
string
|
|
Source group name.
|
|
|
|
|
port
string
|
|
Source port or range.
|
|
|
|
state
string
|
Choices:
- established
- invalid
- new
- related
|
Connection state to match.
|
|
state
string
|
Choices:
merged ←
- replaced
- overridden
- deleted
- gathered
|
Desired state of the firewall rules configuration.
merged adds or updates without removing existing config.
replaced replaces rule sets for named rule sets in config.
overridden replaces all firewall rule sets.
deleted removes firewall rule sets.
gathered returns current configuration as structured data.
|