Comment 29 for bug 262405

Revision history for this message
costales (costales) wrote :

Hi!
commands.getstatusoutput("/etc/init.d/ufw restart") : Restart ufw by command -> https://wiki.ubuntu.com/UbuntuFirewall
When enabling the firewall and/or using '/etc/init.d/ufw start', the chains are necessarily flushed and connections may be dropped (eg ssh connections). You can add rules to the firewall before enabling it however, so if you are testing ufw on a remote machine, it is recommended you perform:

And this for read ufw status/configuration:
paths.py:path_gufw_status = "/etc/ufw/ufw.conf":
    def check_gufw_status():
       if file_search_string(path_gufw_status, c_gufw_enabled_infile) == c_found:

paths.py:path_ufw_config = "/etc/default/ufw":
    def check_deny_all():
 if file_search_string(path_ufw_config, c_deny_all_infile) == c_found:
   def check_ipv6():
 if file_search_string(path_ufw_config, c_ipv6_infile) == c_found:

--------------
   and file_search_string only open for read ;)
     def file_search_string(p_file, p_string):
 try:
  l_file = open(p_file, "r")
---------------

I forget remove this residual code:
paths.py:path_hide_ip_copy = "/etc/ufw/before.rules_copy"
paths.py:path_ufw_config_copy = "/etc/default/ufw_copy"
paths.py:path_hide_ip = "/etc/ufw/before.rules"