+
    iC  c                   s2    ^ RI HtHtHt  ! R R]]4      tR# )    )PluginIndependentPluginSoSPredicatec                   sP   a  ] tR t^t o RtRtRtR
tRtRt	R t
R tR tR tRtV tR	# )FirewallTablesa  Collects information about local firewall tables, such as iptables,
and nf_tables (via nft). Note that this plugin does _not_ collect firewalld
information, which is handled by a separate plugin.

Collections from this plugin are largely gated byt the presence of relevant
kernel modules - for example,  the plugin will not collect the nf_tables
ruleset if both the `nf_tables` and `nfnetlink` kernel modules are not
currently loaded (unless using the --allow-system-changes option).
zfirewall tablesZfirewall_tablesc                v    RV,           pRV,           R,           pV P                  V\        WR.R7      R7       R# )zCollecting iptables rules for a table loads either kernel module
of the table name (for kernel <= 3), or nf_tables (for kernel >= 4).
If neither module is present, the rules must be empty.Ziptable_ziptables -t  -nvL	nf_tableskmodspredNadd_cmd_outputr   selfZ	tablenameZmodnameZcmd   &&  G/usr/lib/python3.14/site-packages/sos/report/plugins/firewall_tables.pycollect_iptableZFirewallTables.collect_iptable   sA    
 y(y(72dK*@A 	 	C    c                r   )z%Same as function above, but for ipv6 Z	ip6table_zip6tables -t r   r   r   r
   Nr   r   r   r   collect_ip6tableZFirewallTables.collect_ip6table*   sA     	)	)G3dK*@A 	 	Cr   c                sN    \        V RR.RR/R7      pV P                  RVRR7      # )	zJCollects nftables rulesets with 'nft' commands if the modules
are present r   	nfnetlinkr	   Zall)r	   Zrequiredznft -a list rulesetT)r   Zchanges)r   Zcollect_cmd_output)r   Znft_preds   & r   collect_nftablesZFirewallTables.collect_nftables3   sB    
  '2K&@*15)9; &&'<8/3 ' 5 	5r   c                s   V P                  4       pR . R. /pVR,          ^ 8X  d
   VR,          MRpVP                  4        Fq  pVP                  4       R,          p\        V4      ^8X  g   K,  V^ ,          R8X  g   K<  V^,          V9   g   KL  W%^,          ,          P	                  V^,          4       Ks  	  Rp Rp\        VR	R
R7      ;_uu_ 4       pVP                  4       p	RRR4       X	P                  4        F3  p
TR,          ^ 8X  g   K  YR ,          9   g   K"  T P                  T
4       K5  	   Rp\        TR	R
R7      ;_uu_ 4       pTP                  4       p	RRR4       T	P                  4        F3  p
TR,          ^ 8X  g   K  YR,          9   g   K"  T P                  T
4       K5  	  TR,          ^ 8w  g   RTR ,          9   d!   T P                  R\        T RR.R7      R7       TR,          ^ 8w  g   RTR,          9   d!   T P                  R\        T RR.R7      R7       T P                  . RO4       R#   + '       g   i     EL^; i  \         d    Tp	 ELqi ; i  + '       g   i     EL; i  \         d    Tp	 EL i ; i)ZipZip6ZstatusZoutputZ :r    i   Ntablezmangle
filter
nat
z/proc/net/ip_tables_namesZrzUTF-8)ZencodingNz/proc/net/ip6_tables_namesZfilterziptables -vnxLZiptable_filterr   r   r
   zip6tables -vnxLZip6table_filter)/etc/nftablesz/etc/sysconfig/nftables.confz/etc/nftables.conf)r   Z
splitlinesZsplitZlenZappendZopenZreadZIOErrorr   r   r   r   Zadd_copy_spec)r   Znft_listZnft_ip_tablesZ	nft_linesZlineZwordsZdefault_ip_tablesZproc_net_ip_tablesZifileZip_tables_namesr   Zproc_net_ip6_tablesZipfiles   &            r   setupZFirewallTables.setup>   sF   
 ((*r5"-*28*<*AHX&r	((*DJJL%E5zQ58w#6!H-Ah'..uQx8	 + 4	0!<(#@@E"'**, A %//1E!Q&5$4G+G$$U+ 2	0">)3AAV"(++- B %//1E!Q&5%4H+H%%e, 2 H"h-2E&E !$/?.MN    H"h-2F&F!!$/@+.NO   
 	 
 	E A@@ 	0/O	0 BAA 	0/O	0s`   8I
 H6!I
 1I2 	II2 6I	I
 I
 
III/	)I2 /I2 2JJ N)ZnetworkZsystem)r   )Z	ip_tablesZ
ip6_tablesr   r   Zebtables)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__Z
short_descZplugin_nameZprofilesZfilesZkernel_modsr   r   r   r   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      sB      #J#K$HEK	CC	59 9r   r   N)Zsos.report.pluginsr   r   r   r   r   r   r   <module>r      s    I HkV. kr   