ldx / python-iptables

Python bindings for iptables
730 stars 182 forks source link

can't dump rules #343

Open ezbik opened 6 months ago

ezbik commented 6 months ago

Ubuntu 22.04 python-iptables-1.0.1

>>> import iptc 
>>> iptc.easy.dump_all(  ipv6=False) 
{'filter': {'INPUT': [], 'FORWARD': [], 'OUTPUT': []}, 'mangle': {'PREROUTING': [], 'INPUT': [], 'FORWARD': [], 'OUTPUT': [], 'POSTROUTING': []}, 'raw': {'PREROUTING': [], 'OUTPUT': []}, 'nat': {'PREROUTING': [], 'INPUT': [], 'OUTPUT': [], 'POSTROUTING': []}, 'security': {'INPUT': [], 'FORWARD': [], 'OUTPUT': []}}

the list is empty.

But the rules are installed.

# iptables-save  -t filter 
# Generated by iptables-save v1.8.7 on Wed Feb 21 16:24:01 2024
*filter
:INPUT ACCEPT [46235906:3534156413]
:FORWARD ACCEPT [2:333]
:OUTPUT ACCEPT [45417451:3296793074]
-A INPUT -i eth+ ...icmp-port-unreachable
-A INPUT -p tcp ..-reject-with icmp-port-unreachable
COMMIT
# Completed on Wed Feb 21 16:24:01 2024
# Warning: iptables-legacy tables present, use iptables-legacy-save to see them