Module sysbot.modules.linux.firewalld

Firewalld Module

This module provides methods for managing and querying the firewalld firewall service on RHEL/Fedora-based Linux systems, including zone management and rule configuration.

Classes

class Firewalld

Firewalld firewall management class for RHEL/Fedora-based Linux systems.

Ancestors

Methods

def getActiveZones(self, alias: str, **kwargs) ‑> Dict[str, List[str]]

Get active firewalld zones with their associated interfaces.

Args

alias
Session alias for the connection.
**kwargs
Additional command execution options.

Returns

Dictionary mapping zone names to lists of network interfaces.

def getDefaultZone(self, alias: str, **kwargs) ‑> str

Get the default firewalld zone.

Args

alias
Session alias for the connection.
**kwargs
Additional command execution options.

Returns

Name of the default zone.

def getForwardPorts(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of forward ports in a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of forward port rules.

def getInterface(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of interfaces bound to a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of network interface names.

def getPorts(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of open ports in a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of open ports (e.g., ['80/tcp', '443/tcp']).

def getProtocols(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of protocols allowed in a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of protocol names.

def getServices(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of services allowed in a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of service names (e.g., ['ssh', 'http', 'https']).

def getSourcePorts(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of source ports in a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of source port rules.

def getSources(self, alias: str, zone: str, **kwargs) ‑> List[str]

Get list of source addresses/networks in a zone.

Args

alias
Session alias for the connection.
zone
Zone name to query.
**kwargs
Additional command execution options.

Returns

List of source addresses or network ranges.

def getZones(self, alias: str, **kwargs) ‑> List[str]

Get list of all available firewalld zones.

Args

alias
Session alias for the connection.
**kwargs
Additional command execution options.

Returns

List of zone names.