Firewall and NAT
Requires OPNsense Firmware >= 26.1.1
- async OPNsenseClient.get_firewall()
Return firewall filter rules and all supported NAT rule groups.
- async OPNsenseClient.toggle_firewall_rule(uuid, toggle_on_off=None)
Toggle a Firewall Rule on or off and apply the filter.
- Parameters:
- Returns:
- True when the Router acknowledged the save and confirmed
the apply. False when the save was not acknowledged (no apply is sent), the apply was not confirmed, or an error was suppressed. With
throw_errorsenabled, an invalidtoggle_on_offraisesOPNsenseInvalidArgumentand transport errors raiseOPNsenseError.
- Return type:
- async OPNsenseClient.toggle_nat_rule(nat_rule_type, uuid, toggle_on_off=None)
Toggle a NAT rule on or off and apply the NAT changes.
- Parameters:
- Returns:
- True when the Router acknowledged the save and confirmed
the apply. False when the save was not acknowledged (no apply is sent), the apply was not confirmed, or an error was suppressed. With
throw_errorsenabled, an invalidtoggle_on_offraisesOPNsenseInvalidArgumentand transport errors raiseOPNsenseError.
- Return type:
- async OPNsenseClient.kill_states(ip_addr)
Kill the active states of the IP address.
- async OPNsenseClient.toggle_alias(alias, toggle_on_off=None)
Toggle an alias on or off, commit it and reconfigure the aliases.
- Parameters:
- Returns:
- True when the Router acknowledged the toggle and the
commit and confirmed the reconfigure. False when the alias cannot be found, a save step was not acknowledged (nothing further is sent), the reconfigure was not confirmed, or an error was suppressed. With
throw_errorsenabled, an invalidtoggle_on_offraisesOPNsenseInvalidArgumentand transport errors raiseOPNsenseError.
- Return type: