Beispiel #1
0
class Config(object):
    '''The top-level holder of audit configuration.'''

    def __init__(self, client):
        self.client = client
        self.auditd = AuditdConfig()
        self.rules = AuditRules()

    def read(self):
        '''Read all configuration files.

        Raise IOError on error.  Invalid lines are reported on stdout and
        otherwise ignored.

        '''
        self.auditd.read(self.client)
        self.rules.read(self.client)

    def write(self):
        '''Write all configuration files.

        Raise IOError on error, ValueError on invalid configuration.

        '''
        self.auditd.write(self.client)
        self.rules.write(self.client)

    def apply(self):
        '''Apply the current configuration.

        Raise IOError on error.

        '''
        self.client.apply()

    def __eq__(self, config):
        if type(config) is not Config:
            return NotImplemented
        # See AuditdConfig.__eq__, AuditRules.__eq__
        return self.auditd == config.auditd and self.rules == config.rules

    def __ne__(self, config):
        return not self.__eq__(config)
Beispiel #2
0
 def __init__(self, client):
     self.client = client
     self.auditd = AuditdConfig()
     self.rules = AuditRules()