#NEWLINE# def firewall( zones = None , interfaces = None , policy = None , rules = None , routestopped = None , masq = None ) : #NEWLINE# #INDENT# "\n    Ensure that a firewall is configured.\n\n    Example::\n\n        from fabtools.shorewall import *\n        from fabtools import require\n\n        # We need a firewall with some custom rules\n        require.shorewall.firewall(\n            rules=[\n                Ping(),\n                SSH(),\n                HTTP(),\n                HTTPS(),\n                SMTP(),\n                rule(port=1234, source=hosts(['example.com'])),\n            ]\n        )\n\n    " #NEWLINE# family = distrib_family ( ) #NEWLINE# if ( family != 'debian' ) : #NEWLINE# #INDENT# raise UnsupportedFamily ( supported = [ 'debian' ] ) #NEWLINE# #UNINDENT# require_deb_package ( 'shorewall' ) #NEWLINE# with watch ( CONFIG_FILES ) as config : #NEWLINE# #INDENT# _zone_config ( zones ) #NEWLINE# _interfaces_config ( config ) #NEWLINE# _policy_config ( policy ) #NEWLINE# _rules_config ( rules ) #NEWLINE# _routestopped_config ( routestopped ) #NEWLINE# _masq_config ( masq ) #NEWLINE# #UNINDENT# if config . changed : #NEWLINE# #INDENT# puts ( 'Shorewall configuration changed' ) #NEWLINE# if is_started ( ) : #NEWLINE# #INDENT# restart ( 'shorewall' ) #NEWLINE# #UNINDENT# #UNINDENT# with settings ( hide ( 'running' ) , shell_env ( ) ) : #NEWLINE# #INDENT# sed ( '/etc/default/shorewall' , 'startup=0' , 'startup=1' , use_sudo = True )