Through an instance of this class, you have complete control over
your firewall.
Methods
|
|
|
|
__init__
|
__init__ ( self, subDict={} )
Return an instance of the Firewall class.
Initialize the firewall object.
- subDict
the dictionary used to substitute some predefined strings
in XML files.
|
|
_initRuleBuilder
|
_initRuleBuilder (
self,
Rbc,
subDict,
)
Set the RuleBuilder object.
|
|
_initRuleClass
|
_initRuleClass ( self, rc )
Set the Rule class.
|
|
_loadFirewall
|
_loadFirewall ( self, brand=None )
Detect the firewall, and import related modules.
Exceptions
|
|
DetectFirewallError( 'unable to detect the firewall' )
|
|
|
_runCommand
|
_runCommand ( self, cmd )
Execute a given command.
|
|
checkRule
|
checkRule ( self, r )
If a rule is actually running, return the rule number,
otherwise -1.
|
|
createNewRules
|
createNewRules (
self,
action='append',
pos='-1',
target='DROP',
chain='INPUT',
source='0.0.0.0/0.0.0.0',
destination='0.0.0.0/0.0.0.0',
interface='',
proto='all',
sport='',
dport='',
log=0,
)
Create new rules with the given parameters.
|
|
forceFirewall
|
forceFirewall ( self, firewallBrand )
Force DAXFi to use firewallBrand.
|
|
getFirewallName
|
getFirewallName ( self )
Return the name of the running firewall.
|
|
getRuleBuilderClass
|
getRuleBuilderClass ( self )
Return the RuleBuilder object used to create new rules..
|
|
getRuleClass
|
getRuleClass ( self )
Return the class that represents a Rule for this firewall.
|
|
getSubstitutionDict
|
getSubstitutionDict ( self )
Get the substitution dictionary.
|
|
listChains
|
listChains ( self )
Return the list of active chains.
|
|
listCommandRules
|
listCommandRules ( self, chain )
Return a list of commands for the given chain.
|
|
listRules
|
listRules ( self, chain )
Return the list of rules in the given chain.
|
|
listXMLRules
|
listXMLRules ( self, chain )
Return a list of XML strings; one for every running rule.
|
|
newRulesFromXMLFile
|
newRulesFromXMLFile ( self, fileName )
Parse XML file.
Parse a XML file, and return a list of rules.
- fileName
the name of the file to parse.
|
|
newRulesFromXMLString
|
newRulesFromXMLString ( self, s )
New rules from XML strings.
Parse a XML string and return a list of rules.
|
|
printRules
|
printRules ( self, l )
Return a list of strings.
|
|
printXMLRules
|
printXMLRules ( self, l )
Return a list of XML strings.
|
|
runNewRules
|
runNewRules (
self,
action='append',
pos='-1',
target='DROP',
chain='INPUT',
source='0.0.0.0/0.0.0.0',
destination='0.0.0.0/0.0.0.0',
interface='',
proto='all',
sport='',
dport='',
log=0,
)
Create and run new rules with the given parameters.
|
|
runRules
|
runRules ( self, l )
Execute a given list of rules.
|
|
runXMLFile
|
runXMLFile ( self, fileName )
Parse an XML file and run the resulting set of rules.
|
|
runXMLString
|
runXMLString ( self, s )
Parse an XML string and run the resulting set of rules.
|
|
setSubstitutionDict
|
setSubstitutionDict ( self, subDict )
Set the substitution dictionary.
|