NethServer firewall rules

Hi all,

Is it possible to extract only the firewall rules from NethServer-7.9 ?

Michel-André

Don’t know if you are referring to any of these options:

  • command line:

    db fwrules show
    
    db fwrules showjson
    
    db fwrules print
    
    db fwrules printjson
    
  • export file /var/lib/nethserver/db/fwrules (additionally other fw* files on same dir)

  • nethserver-firewall-migration: meant to migrate from ns7 to nethsecurity, it has some scripts to do the export in a format accepted by nethsecurity (generated file can be found at /var/lib/nethserver/firewall-migration/export.tar.gz):

    firewall-export
    

    … that’s for all it can export. It exports based on exec files found in /usr/share/nethserver-firewall-migration.
    Specifically for firewall rules, there’s a file in that dir (but without reading the full code I think it goes more or less with db/config commands and formatting it in a way compatible with nethsercurity). One could thing to install the migration package, rename folder, create folder with required file(s) like rules file and correct owner permissions and then run the above command, or just download and tweak the rules export script (and any other requirements, unknown to me without fully reading code or testing it).

  • Probably other options directly from shorewall (like to export to iptables…)

A short answer to a short question. :slight_smile:

db fwrules show

If you need more, please try to explain your target.