D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
im360
/
internals
/
core
/
rules
/
Filename :
log.py
back
Copy
"""Methods to generate logging iptables rules.""" from typing import Iterator from im360.internals.core import firewall from im360.internals.core.firewall import FirewallRules from im360.utils.validate import IPVersion from .types_ import FirewallRule def rules( ipset_name: str, ip_version: IPVersion, prefix: str, priority: int ) -> Iterator[FirewallRule]: """Logging iptables rules for ..{sync,ip}.IPSet ipsets.""" if firewall.firewall_logging_enabled(): yield FirewallRule( rule=FirewallRules.compose_rule( FirewallRules.ipset(ipset_name), action=FirewallRules.nflog_action( group=FirewallRules.nflog_group(ip_version), prefix=prefix, ), ), priority=priority, )