コード例 #1
0
ファイル: fw_config.py プロジェクト: ntadmin/firewalld
 def set_ipset_config(self, obj, config):
     if obj.default:
         x = copy.copy(obj)
         x.import_config(config)
         x.path = ETC_FIREWALLD_IPSETS
         x.default = False
         self.add_ipset(x)
         ipset_writer(x)
         return x
     else:
         obj.import_config(config)
         ipset_writer(obj)
         return obj
コード例 #2
0
ファイル: fw_config.py プロジェクト: mrostecki/firewalld
    def set_ipset_config(self, obj, conf):
        x = copy.copy(obj)
        if obj.builtin:
            x.path = config.ETC_FIREWALLD_IPSETS
            x.builtin = False
            if obj.path != x.path:
                x.default = False

        x.import_config(conf, self.get_all_io_objects_dict())
        self.full_check_config({"ipsets": [x]})
        self.add_ipset(x)
        ipset_writer(x)
        return x
コード例 #3
0
ファイル: fw_config.py プロジェクト: tomzhic/firewalld
 def set_ipset_config(self, obj, config):
     if obj.default:
         x = copy.copy(obj)
         x.import_config(config)
         x.path = ETC_FIREWALLD_IPSETS
         x.default = False
         self.add_ipset(x)
         ipset_writer(x)
         return x
     else:
         obj.import_config(config)
         ipset_writer(obj)
         return obj
コード例 #4
0
ファイル: fw_config.py プロジェクト: symious/firewalld
 def set_ipset_config(self, obj, conf):
     if obj.builtin:
         x = copy.copy(obj)
         x.import_config(conf)
         x.path = config.ETC_FIREWALLD_IPSETS
         x.builtin = False
         if obj.path != x.path:
             x.default = False
         self.add_ipset(x)
         ipset_writer(x)
         return x
     else:
         obj.import_config(conf)
         ipset_writer(obj)
         return obj
コード例 #5
0
ファイル: fw_config.py プロジェクト: AndersBlomdell/firewalld
 def set_ipset_config(self, obj, conf):
     if obj.builtin:
         x = copy.copy(obj)
         x.import_config(conf)
         x.path = config.ETC_FIREWALLD_IPSETS
         x.builtin = False
         if obj.path != x.path:
             x.default = False
         self.add_ipset(x)
         ipset_writer(x)
         return x
     else:
         obj.import_config(conf)
         ipset_writer(obj)
         return obj
コード例 #6
0
ファイル: fw_config.py プロジェクト: symious/firewalld
    def new_ipset(self, name, conf):
        if name in self._ipsets or name in self._builtin_ipsets:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(conf)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = config.ETC_FIREWALLD_IPSETS
        # It is not possible to add a new one with a name of a buitin
        x.builtin = False
        x.default = True

        ipset_writer(x)
        self.add_ipset(x)
        return x
コード例 #7
0
ファイル: fw_config.py プロジェクト: AndersBlomdell/firewalld
    def new_ipset(self, name, conf):
        if name in self._ipsets or name in self._builtin_ipsets:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(conf)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = config.ETC_FIREWALLD_IPSETS
        # It is not possible to add a new one with a name of a buitin
        x.builtin = False
        x.default = True

        ipset_writer(x)
        self.add_ipset(x)
        return x
コード例 #8
0
ファイル: fw_config.py プロジェクト: ntadmin/firewalld
    def new_ipset(self, name, config):
        try:
            self.get_ipset(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(config)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = ETC_FIREWALLD_IPSETS
        x.default = False

        ipset_writer(x)
        self.add_ipset(x)
        return x
コード例 #9
0
ファイル: fw_config.py プロジェクト: tomzhic/firewalld
    def new_ipset(self, name, config):
        try:
            self.get_ipset(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(config)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = ETC_FIREWALLD_IPSETS
        x.default = False

        ipset_writer(x)
        self.add_ipset(x)
        return x
コード例 #10
0
ファイル: fw_config.py プロジェクト: adrianbroher/firewalld
    def new_ipset(self, name, config):
        try:
            self.get_ipset(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(config)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = ETC_FIREWALLD_IPSETS
        # It is not possible to add a new one with a name of a buitin
        x.default = True

        ipset_writer(x)
        self.add_ipset(x)
        return x