opn_update_firewall_rule
Update specific properties of an existing OPNsense firewall rule by UUID, changing action, source/destination, protocol, or ports while preserving other settings.
Instructions
Update an existing MVC firewall rule by UUID with savepoint protection where supported.
Use this when you need to modify a firewall rule's action, source/destination, protocol, ports, or other properties. Only the parameters you provide are changed; all other settings are preserved.
Savepoint protection applies on OPNsense < 26.7 only: there changes auto-revert in 60 seconds unless confirmed with opn_confirm_changes. OPNsense 26.7 removed the savepoint API upstream, so on 26.7+ changes apply immediately and are NOT rolled back automatically. Check opn_mcp_info first: if 'savepoint_support' is false, take a config backup with opn_download_config before changing rules that could lock you out. Use opn_list_firewall_rules first to find the UUID.
Parameters:
uuid: rule UUID (from opn_list_firewall_rules)
action: 'pass', 'block', or 'reject'
direction: 'in' or 'out'
interface: interface name (e.g. 'lan', 'wan', 'opt1')
ip_protocol: 'inet' (IPv4), 'inet6' (IPv6), or 'inet46' (dual-stack)
protocol: 'any', 'TCP', 'UDP', 'TCP/UDP', 'ICMP', etc.
source_net: source address/network or 'any'
source_not: invert source match
source_port: source port number or range
destination_net: destination address/network or 'any'
destination_not: invert destination match
destination_port: port number or range
gateway: force traffic via specific gateway, or empty to clear
log: enable/disable logging
quick: first-match wins (True) or last-match-wins (False)
sequence: rule ordering within priority group
categories: comma-separated category UUIDs
description: human-readable rule description
enabled: enable/disable the rule
Returns: dict with 'revision' (str), 'uuid' (str), and 'result' (str).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| log | No | ||
| uuid | Yes | ||
| quick | No | ||
| action | No | ||
| enabled | No | ||
| gateway | No | ||
| protocol | No | ||
| sequence | No | ||
| direction | No | ||
| interface | No | ||
| categories | No | ||
| source_net | No | ||
| source_not | No | ||
| description | No | ||
| ip_protocol | No | ||
| source_port | No | ||
| destination_net | No | ||
| destination_not | No | ||
| destination_port | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||