generate_files

Author: Athanasios Gkaraliakos email: a.gkaraliakos@gmail.com email: athanasios.gkaraliakos@cern.ch

The script is written on python >=2.6

class iptables_manager_modules.generate_files.IPTablesFileGenerator[source]

Here we generate iptables.gen and ip6tables.gen files to be used with the restore command. The class objects receives two lists for iptables and ip6tables and generates the files.

static get_current_rules()[source]

This method copies the current iptables and ip6tables configuration that is in memory and write it to files with ‘.orig’ extension.

Returns:None
write_iptables_files(default_rules, user_rules)[source]

This method receives 2 lists. By applying proper formatting on the lists it extracts the info to populate the ‘final’ lists so to write their contents in the ‘iptables.gen’ and ‘ip6tables.gen’ generated rule files.

Parameters:
  • default_rules – This list contains all the rules that will be applied on each machine
  • user_rules – This list contains all the rules generated from the user that are defined in the provided config files
Returns:

None