|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/client.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/client.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/client.py.RHBZ#1127706 2014-09-30 01:05:32.495984835 +0200
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/client.py 2014-09-30 01:09:08.587824840 +0200
|
|
|
06cdf6 |
@@ -323,6 +323,271 @@ class FirewallClientConfigZone(object):
|
|
|
06cdf6 |
def rename(self, name):
|
|
|
06cdf6 |
self.fw_zone.rename(name)
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ # version
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getVersion(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getVersion()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setVersion(self, version):
|
|
|
06cdf6 |
+ self.fw_zone.setVersion(version)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # short
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getShort(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getShort()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setShort(self, short):
|
|
|
06cdf6 |
+ self.fw_zone.setShort(short)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # description
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getDescription(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getDescription()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setDescription(self, description):
|
|
|
06cdf6 |
+ self.fw_zone.setDescription(description)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # target
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getTarget(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getTarget()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setTarget(self, target):
|
|
|
06cdf6 |
+ self.fw_zone.setTarget(target)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # service
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getServices(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getServices()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setServices(self, services):
|
|
|
06cdf6 |
+ self.fw_zone.setServices(services)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addService(self, service):
|
|
|
06cdf6 |
+ self.fw_zone.addService(service)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeService(self, service):
|
|
|
06cdf6 |
+ self.fw_zone.removeService(service)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryService(self, service):
|
|
|
06cdf6 |
+ return self.fw_zone.queryService(service)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # port
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getPorts(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getPorts()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setPorts(self, ports):
|
|
|
06cdf6 |
+ self.fw_zone.setPorts(ports)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addPort(self, port, protocol):
|
|
|
06cdf6 |
+ self.fw_zone.addPort(port, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removePort(self, port, protocol):
|
|
|
06cdf6 |
+ self.fw_zone.removePort(port, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryPort(self, port, protocol):
|
|
|
06cdf6 |
+ return self.fw_zone.queryPort(port, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # icmp block
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getIcmpBlocks(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getIcmpBlocks()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setIcmpBlocks(self, icmptypes):
|
|
|
06cdf6 |
+ self.fw_zone.setIcmpBlocks(icmptypes)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addIcmpBlock(self, icmptype):
|
|
|
06cdf6 |
+ self.fw_zone.addIcmpBlock(icmptype)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeIcmpBlock(self, icmptype):
|
|
|
06cdf6 |
+ self.fw_zone.removeIcmpBlock(icmptype)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryIcmpBlock(self, icmptype):
|
|
|
06cdf6 |
+ return self.fw_zone.queryIcmpBlock(icmptype)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # masquerade
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getMasquerade(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getMasquerade()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setMasquerade(self, masquerade):
|
|
|
06cdf6 |
+ self.fw_zone.setMasquerades(masquerade)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addMasquerade(self):
|
|
|
06cdf6 |
+ self.fw_zone.addMasquerade()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeMasquerade(self):
|
|
|
06cdf6 |
+ self.fw_zone.removeMasquerade()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryMasquerade(self):
|
|
|
06cdf6 |
+ return self.fw_zone.queryMasquerade()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # forward port
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getForwardPorts(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getForwardPorts()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setForwardPorts(self, ports):
|
|
|
06cdf6 |
+ self.fw_zone.setForwardPorts(ports)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addForwardPort(self, port, protocol, toport, toaddr):
|
|
|
06cdf6 |
+ self.fw_zone.addForwardPort(port, protocol, toport, toaddr)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeForwardPort(self, port, protocol, toport, toaddr):
|
|
|
06cdf6 |
+ self.fw_zone.removeForwardPort(port, protocol, toport, toaddr)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryForwardPort(self, port, protocol, toport, toaddr):
|
|
|
06cdf6 |
+ return self.fw_zone.queryForwardPort(port, protocol, toport, toaddr)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # interface
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getInterfaces(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getInterfaces()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setInterfaces(self, interfaces):
|
|
|
06cdf6 |
+ self.fw_zone.setInterfaces(interfaces)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addInterface(self, interface):
|
|
|
06cdf6 |
+ self.fw_zone.addInterface(interface)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeInterface(self, interface):
|
|
|
06cdf6 |
+ self.fw_zone.removeInterface(interface)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryInterface(self, interface):
|
|
|
06cdf6 |
+ return self.fw_zone.queryInterface(interface)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # source
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getSources(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getSources()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setSources(self, sources):
|
|
|
06cdf6 |
+ self.fw_zone.setSources(sources)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addSource(self, source):
|
|
|
06cdf6 |
+ self.fw_zone.addSource(source)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeSource(self, source):
|
|
|
06cdf6 |
+ self.fw_zone.removeSource(source)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def querySource(self, source):
|
|
|
06cdf6 |
+ return self.fw_zone.querySource(source)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # rich rule
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getRichRules(self):
|
|
|
06cdf6 |
+ return self.fw_zone.getRichRules()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setRichRules(self, rules):
|
|
|
06cdf6 |
+ self.fw_zone.setRichRules(rules)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addRichRule(self, rule):
|
|
|
06cdf6 |
+ self.fw_zone.addRichRule(rule)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeRichRule(self, rule):
|
|
|
06cdf6 |
+ self.fw_zone.removeRichRule(rule)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryRichRule(self, rule):
|
|
|
06cdf6 |
+ return self.fw_zone.queryRichRule(rule)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# service config settings
|
|
|
06cdf6 |
|
|
|
06cdf6 |
class FirewallClientServiceSettings(object):
|
|
|
06cdf6 |
@@ -467,6 +732,130 @@ class FirewallClientConfigService(object
|
|
|
06cdf6 |
def rename(self, name):
|
|
|
06cdf6 |
self.fw_service.rename(name)
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ # version
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getVersion(self):
|
|
|
06cdf6 |
+ return self.fw_service.getVersion()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setVersion(self, version):
|
|
|
06cdf6 |
+ self.fw_service.setVersion(version)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # short
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getShort(self):
|
|
|
06cdf6 |
+ return self.fw_service.getShort()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setShort(self, short):
|
|
|
06cdf6 |
+ self.fw_service.setShort(short)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # description
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getDescription(self):
|
|
|
06cdf6 |
+ return self.fw_service.getDescription()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setDescription(self, description):
|
|
|
06cdf6 |
+ self.fw_service.setDescription(description)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # port
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getPorts(self):
|
|
|
06cdf6 |
+ return self.fw_service.getPorts()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setPorts(self, ports):
|
|
|
06cdf6 |
+ self.fw_service.setPorts(ports)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addPort(self, port, protocol):
|
|
|
06cdf6 |
+ self.fw_service.addPort(port, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removePort(self, port, protocol):
|
|
|
06cdf6 |
+ self.fw_service.removePort(port, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryPort(self, port, protocol):
|
|
|
06cdf6 |
+ return self.fw_service.queryPort(port, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # module
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getModules(self):
|
|
|
06cdf6 |
+ return self.fw_service.getModules()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setModules(self, modules):
|
|
|
06cdf6 |
+ self.fw_service.setModules(modules)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addModule(self, module, protocol):
|
|
|
06cdf6 |
+ self.fw_service.addModule(module, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeModule(self, module, protocol):
|
|
|
06cdf6 |
+ self.fw_service.removeModule(module, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryModule(self, module, protocol):
|
|
|
06cdf6 |
+ return self.fw_service.queryModule(module, protocol)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # destination
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getDestinations(self):
|
|
|
06cdf6 |
+ return self.fw_service.getDestinations()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setDestinations(self, destinations):
|
|
|
06cdf6 |
+ self.fw_service.setDestinations(destinations)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getDestination(self, destination):
|
|
|
06cdf6 |
+ return self.fw_service.getDestination(destination)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setDestination(self, destination, address):
|
|
|
06cdf6 |
+ self.fw_service.setDestination(destination, address)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeDestination(self, destination):
|
|
|
06cdf6 |
+ self.fw_service.removeDestination(destination, address)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryDestination(self, destination, address):
|
|
|
06cdf6 |
+ return self.fw_service.queryDestination(destination, address)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# icmptype config settings
|
|
|
06cdf6 |
|
|
|
06cdf6 |
class FirewallClientIcmpTypeSettings(object):
|
|
|
06cdf6 |
@@ -582,6 +971,70 @@ class FirewallClientConfigIcmpType(objec
|
|
|
06cdf6 |
def rename(self, name):
|
|
|
06cdf6 |
self.fw_icmptype.rename(name)
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ # version
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getVersion(self):
|
|
|
06cdf6 |
+ return self.fw_icmptype.getVersion()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setVersion(self, version):
|
|
|
06cdf6 |
+ self.fw_icmptype.setVersion(version)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # short
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getShort(self):
|
|
|
06cdf6 |
+ return self.fw_icmptype.getShort()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setShort(self, short):
|
|
|
06cdf6 |
+ self.fw_icmptype.setShort(short)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # description
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getDescription(self):
|
|
|
06cdf6 |
+ return self.fw_icmptype.getDescription()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setDescription(self, description):
|
|
|
06cdf6 |
+ self.fw_icmptype.setDescription(description)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # destination
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getDestinations(self):
|
|
|
06cdf6 |
+ return self.fw_icmptype.getDestinations()
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setDestinations(self, destinations):
|
|
|
06cdf6 |
+ self.fw_icmptype.setDestinations(destinations)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addDestination(self, destination, address):
|
|
|
06cdf6 |
+ self.fw_icmptype.addDestination(destination, address)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeDestination(self, destination):
|
|
|
06cdf6 |
+ self.fw_icmptype.removeDestination(destination, address)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryDestination(self, destination, address):
|
|
|
06cdf6 |
+ return self.fw_icmptype.queryDestination(destination, address)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# config.policies lockdown whitelist
|
|
|
06cdf6 |
|
|
|
06cdf6 |
class FirewallClientPoliciesLockdownWhitelist(object):
|
|
|
06cdf6 |
@@ -690,6 +1143,99 @@ class FirewallClientConfigPolicies(objec
|
|
|
06cdf6 |
def setLockdownWhitelist(self, settings):
|
|
|
06cdf6 |
self.fw_policies.setLockdownWhitelist(tuple(settings.settings))
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ # command
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistCommand(self, command):
|
|
|
06cdf6 |
+ self.fw_policies.addLockdownWhitelistCommand(command)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistCommand(self, command):
|
|
|
06cdf6 |
+ self.fw_policies.removeLockdownWhitelistCommand(command)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistCommand(self, command):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.queryLockdownWhitelistCommand(command))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistCommands(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.getLockdownWhitelistCommands())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # context
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistContext(self, context):
|
|
|
06cdf6 |
+ self.fw_policies.addLockdownWhitelistContext(context)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistContext(self, context):
|
|
|
06cdf6 |
+ self.fw_policies.removeLockdownWhitelistContext(context)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistContext(self, context):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.queryLockdownWhitelistContext(context))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistContexts(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.getLockdownWhitelistContexts())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # user
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistUser(self, user):
|
|
|
06cdf6 |
+ self.fw_policies.addLockdownWhitelistUser(user)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistUser(self, user):
|
|
|
06cdf6 |
+ self.fw_policies.removeLockdownWhitelistUser(user)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistUser(self, user):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.queryLockdownWhitelistUser(user))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistUsers(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.getLockdownWhitelistUsers())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # uid
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistUids(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.getLockdownWhitelistUids())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def setLockdownWhitelistUids(self, uids):
|
|
|
06cdf6 |
+ self.fw_policies.setLockdownWhitelistUids(uids)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistUid(self, uid):
|
|
|
06cdf6 |
+ self.fw_policies.addLockdownWhitelistUid(uid)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistUid(self, uid):
|
|
|
06cdf6 |
+ self.fw_policies.removeLockdownWhitelistUid(uid)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistUid(self, uid):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_policies.queryLockdownWhitelistUid(uid))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# config.direct
|
|
|
06cdf6 |
|
|
|
06cdf6 |
class FirewallClientDirect(object):
|
|
|
06cdf6 |
@@ -810,6 +1356,92 @@ class FirewallClientConfigDirect(object)
|
|
|
06cdf6 |
def update(self, settings):
|
|
|
06cdf6 |
self.fw_direct.update(tuple(settings.settings))
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ # direct chain
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addChain(self, ipv, table, chain):
|
|
|
06cdf6 |
+ self.fw_direct.addChain(ipv, table, chain)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeChain(self, ipv, table, chain):
|
|
|
06cdf6 |
+ self.fw_direct.removeChain(ipv, table, chain)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryChain(self, ipv, table, chain):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.queryChain(ipv, table, chain))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getChains(self, ipv, table):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.getChains(ipv, table))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getAllChains(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.getAllChains())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # direct rule
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addRule(self, ipv, table, chain, priority, args):
|
|
|
06cdf6 |
+ self.fw_direct.addRule(ipv, table, chain, priority, args)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeRule(self, ipv, table, chain, priority, args):
|
|
|
06cdf6 |
+ self.fw_direct.removeRule(ipv, table, chain, priority, args)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removeRules(self, ipv, table, chain):
|
|
|
06cdf6 |
+ self.fw_direct.removeRules(ipv, table, chain)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryRule(self, ipv, table, chain, priority, args):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.queryRule(ipv, table, chain, priority, args))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getRules(self, ipv, table, chain):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.getRules(ipv, table, chain))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getAllRules(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.getAllRules())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # tracked passthrough
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def addPassthrough(self, ipv, args):
|
|
|
06cdf6 |
+ self.fw_direct.addPassthrough(ipv, args)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def removePassthrough(self, ipv, args):
|
|
|
06cdf6 |
+ self.fw_direct.removePassthrough(ipv, args)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def queryPassthrough(self, ipv, args):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.queryPassthrough(ipv, args))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getPassthroughs(self, ipv):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.getPassthroughs(ipv))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @slip.dbus.polkit.enable_proxy
|
|
|
06cdf6 |
+ @handle_exceptions
|
|
|
06cdf6 |
+ def getAllPassthroughs(self):
|
|
|
06cdf6 |
+ return dbus_to_python(self.fw_direct.getAllPassthroughs())
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# config
|
|
|
06cdf6 |
|
|
|
06cdf6 |
class FirewallClientConfig(object):
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/core/io/direct.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/core/io/direct.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/core/io/direct.py.RHBZ#1127706 2014-09-30 01:05:32.434984627 +0200
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/core/io/direct.py 2014-09-30 01:09:08.587824840 +0200
|
|
|
06cdf6 |
@@ -140,17 +140,17 @@ class Direct(IO_Object):
|
|
|
06cdf6 |
x = [ ]
|
|
|
06cdf6 |
for key in self.chains:
|
|
|
06cdf6 |
for chain in self.chains[key]:
|
|
|
06cdf6 |
- x.append(list(key) + list([chain]))
|
|
|
06cdf6 |
+ x.append(tuple(list(key) + list([chain])))
|
|
|
06cdf6 |
ret.append(x)
|
|
|
06cdf6 |
x = [ ]
|
|
|
06cdf6 |
for key in self.rules:
|
|
|
06cdf6 |
for rule in self.rules[key]:
|
|
|
06cdf6 |
- x.append(list(key) + list(rule))
|
|
|
06cdf6 |
+ x.append(tuple((key[0], key[1], key[2], rule[0], list(rule[1]))))
|
|
|
06cdf6 |
ret.append(x)
|
|
|
06cdf6 |
x = [ ]
|
|
|
06cdf6 |
for key in self.passthroughs:
|
|
|
06cdf6 |
for rule in self.passthroughs[key]:
|
|
|
06cdf6 |
- x.append((key, rule))
|
|
|
06cdf6 |
+ x.append(tuple((key, list(rule))))
|
|
|
06cdf6 |
ret.append(x)
|
|
|
06cdf6 |
return tuple(ret)
|
|
|
06cdf6 |
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/core/io/service.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/core/io/service.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/core/io/service.py.RHBZ#1127706 2014-09-30 01:05:32.325984256 +0200
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/core/io/service.py 2014-09-30 01:09:57.697013002 +0200
|
|
|
06cdf6 |
@@ -100,6 +100,13 @@ class Service(IO_Object):
|
|
|
06cdf6 |
if not check_address(destination, config[destination]):
|
|
|
06cdf6 |
raise FirewallError(INVALID_ADDR, config[destination])
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ elif item == "modules":
|
|
|
06cdf6 |
+ for module in config:
|
|
|
06cdf6 |
+ if not module.startswith("nf_conntrack_"):
|
|
|
06cdf6 |
+ raise FirewallError(INVALID_MODULE, module)
|
|
|
06cdf6 |
+ elif len(module.replace("nf_conntrack_", "")) < 1:
|
|
|
06cdf6 |
+ raise FirewallError(INVALID_MODULE, module)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# PARSER
|
|
|
06cdf6 |
|
|
|
06cdf6 |
class service_ContentHandler(IO_Object_ContentHandler):
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/core/io/zone.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/core/io/zone.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/core/io/zone.py.RHBZ#1127706 2014-09-30 01:05:32.335984290 +0200
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/core/io/zone.py 2014-09-30 01:09:08.589824849 +0200
|
|
|
06cdf6 |
@@ -25,7 +25,7 @@ import shutil
|
|
|
06cdf6 |
|
|
|
06cdf6 |
from firewall.config import ETC_FIREWALLD
|
|
|
06cdf6 |
from firewall.errors import *
|
|
|
06cdf6 |
-from firewall.functions import checkIP, uniqify, max_zone_name_len, u2b_if_py2
|
|
|
06cdf6 |
+from firewall.functions import checkIP, checkIPnMask, checkIP6nMask, checkInterface, uniqify, max_zone_name_len, u2b_if_py2
|
|
|
06cdf6 |
from firewall.core.base import DEFAULT_ZONE_TARGET, ZONE_TARGETS
|
|
|
06cdf6 |
from firewall.core.io.io_object import *
|
|
|
06cdf6 |
from firewall.core.rich import *
|
|
|
06cdf6 |
@@ -184,6 +184,17 @@ class Zone(IO_Object):
|
|
|
06cdf6 |
elif item == "target":
|
|
|
06cdf6 |
if config not in ZONE_TARGETS:
|
|
|
06cdf6 |
raise FirewallError(INVALID_TARGET, config)
|
|
|
06cdf6 |
+ elif item == "interfaces":
|
|
|
06cdf6 |
+ for interface in config:
|
|
|
06cdf6 |
+ if not checkInterface(interface):
|
|
|
06cdf6 |
+ raise FirewallError(INVALID_INTERFACE, interface)
|
|
|
06cdf6 |
+ elif item == "sources":
|
|
|
06cdf6 |
+ for source in config:
|
|
|
06cdf6 |
+ if not checkIPnMask(source) and not checkIP6nMask(source):
|
|
|
06cdf6 |
+ raise FirewallError(INVALID_ADDR, source)
|
|
|
06cdf6 |
+ elif item == "rules_str":
|
|
|
06cdf6 |
+ for rule in config:
|
|
|
06cdf6 |
+ r = Rich_Rule(rule_str=rule)
|
|
|
06cdf6 |
|
|
|
06cdf6 |
def check_name(self, name):
|
|
|
06cdf6 |
super(Zone, self).check_name(name)
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/errors.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/errors.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/errors.py.RHBZ#1127706 2014-09-30 01:05:32.434984627 +0200
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/errors.py 2014-09-30 01:09:08.589824849 +0200
|
|
|
06cdf6 |
@@ -73,6 +73,7 @@ INVALID_CONTEXT = 128
|
|
|
06cdf6 |
INVALID_COMMAND = 129
|
|
|
06cdf6 |
INVALID_USER = 130
|
|
|
06cdf6 |
INVALID_UID = 131
|
|
|
06cdf6 |
+INVALID_MODULE = 132
|
|
|
06cdf6 |
|
|
|
06cdf6 |
MISSING_TABLE = 200
|
|
|
06cdf6 |
MISSING_CHAIN = 201
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/server/config_icmptype.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/server/config_icmptype.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/server/config_icmptype.py.RHBZ#1127706 2014-01-13 16:12:35.000000000 +0100
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/server/config_icmptype.py 2014-09-30 01:09:08.591824854 +0200
|
|
|
06cdf6 |
@@ -219,3 +219,113 @@ class FirewallDConfigIcmpType(slip.dbus.
|
|
|
06cdf6 |
@dbus_handle_exceptions
|
|
|
06cdf6 |
def Renamed(self, name):
|
|
|
06cdf6 |
log.debug1("config.icmptype.%d.Renamed('%s')" % (self.id, name))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # version
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getVersion(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.getVersion()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setVersion(self, version, sender=None):
|
|
|
06cdf6 |
+ version = dbus_to_python(version, str)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.setVersion('%s')", self.id, version)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[0] = version
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # short
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getShort(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.getShort()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setShort(self, short, sender=None):
|
|
|
06cdf6 |
+ short = dbus_to_python(short, str)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.setShort('%s')", self.id, short)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[1] = short
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # description
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getDescription(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.getDescription()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[2]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setDescription(self, description, sender=None):
|
|
|
06cdf6 |
+ description = dbus_to_python(description, str)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.setDescription('%s')", self.id,
|
|
|
06cdf6 |
+ description)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[2] = description
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # destination
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getDestinations(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.getDestinations()", self.id)
|
|
|
06cdf6 |
+ return sorted(self.getSettings()[3])
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setDestinations(self, destinations, sender=None):
|
|
|
06cdf6 |
+ destinations = dbus_to_python(destinations, list)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.setDestinations('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(destinations))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[3] = destinations
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addDestination(self, destination, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.addDestination('%s')", self.id,
|
|
|
06cdf6 |
+ destination)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if destination in settings[3]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, destination)
|
|
|
06cdf6 |
+ settings[3].append(destination)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeDestination(self, destination, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.removeDestination('%s')", self.id,
|
|
|
06cdf6 |
+ destination)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if destination not in settings[3]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, destination)
|
|
|
06cdf6 |
+ settings[3].remove(destination)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ICMPTYPE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryDestination(self, destination, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ log.debug1("config.icmptype.%d.queryDestination('%s')", self.id,
|
|
|
06cdf6 |
+ destination)
|
|
|
06cdf6 |
+ settings = self.getSettings()
|
|
|
06cdf6 |
+ return (destination in self.settings[3])
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/server/config.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/server/config.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/server/config.py.RHBZ#1127706 2014-09-30 01:05:32.503984862 +0200
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/server/config.py 2014-09-30 01:09:08.590824851 +0200
|
|
|
06cdf6 |
@@ -419,6 +419,166 @@ class FirewallDConfig(slip.dbus.service.
|
|
|
06cdf6 |
def LockdownWhitelistUpdated(self):
|
|
|
06cdf6 |
log.debug1("config.policies.LockdownWhitelistUpdated()")
|
|
|
06cdf6 |
|
|
|
06cdf6 |
+ # command
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistCommand(self, command, sender=None):
|
|
|
06cdf6 |
+ command = dbus_to_python(command)
|
|
|
06cdf6 |
+ log.debug1("config.policies.addLockdownWhitelistCommand('%s')", command)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if command in settings[0]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, command)
|
|
|
06cdf6 |
+ settings[0].append(command)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistCommand(self, command, sender=None):
|
|
|
06cdf6 |
+ command = dbus_to_python(command)
|
|
|
06cdf6 |
+ log.debug1("config.policies.removeLockdownWhitelistCommand('%s')", command)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if command not in settings[0]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, command)
|
|
|
06cdf6 |
+ settings[0].remove(command)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistCommand(self, command, sender=None):
|
|
|
06cdf6 |
+ command = dbus_to_python(command)
|
|
|
06cdf6 |
+ log.debug1("config.policies.queryLockdownWhitelistCommand('%s')", command)
|
|
|
06cdf6 |
+ return command in self.getLockdownWhitelist()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistCommands(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.policies.getLockdownWhitelistCommands()")
|
|
|
06cdf6 |
+ return self.getLockdownWhitelist()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # context
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistContext(self, context, sender=None):
|
|
|
06cdf6 |
+ context = dbus_to_python(context)
|
|
|
06cdf6 |
+ log.debug1("config.policies.addLockdownWhitelistContext('%s')", context)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if context in settings[1]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, context)
|
|
|
06cdf6 |
+ settings[1].append(context)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistContext(self, context, sender=None):
|
|
|
06cdf6 |
+ context = dbus_to_python(context)
|
|
|
06cdf6 |
+ log.debug1("config.policies.removeLockdownWhitelistContext('%s')", context)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if context not in settings[1]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, context)
|
|
|
06cdf6 |
+ settings[1].remove(context)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistContext(self, context, sender=None):
|
|
|
06cdf6 |
+ context = dbus_to_python(context)
|
|
|
06cdf6 |
+ log.debug1("config.policies.queryLockdownWhitelistContext('%s')", context)
|
|
|
06cdf6 |
+ return context in self.getLockdownWhitelist()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistContexts(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.policies.getLockdownWhitelistContexts()")
|
|
|
06cdf6 |
+ return self.getLockdownWhitelist()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # user
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistUser(self, user, sender=None):
|
|
|
06cdf6 |
+ user = dbus_to_python(user)
|
|
|
06cdf6 |
+ log.debug1("config.policies.addLockdownWhitelistUser('%s')", user)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if user in settings[2]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, user)
|
|
|
06cdf6 |
+ settings[2].append(user)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistUser(self, user, sender=None):
|
|
|
06cdf6 |
+ user = dbus_to_python(user)
|
|
|
06cdf6 |
+ log.debug1("config.policies.removeLockdownWhitelistUser('%s')", user)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if user not in settings[2]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, user)
|
|
|
06cdf6 |
+ settings[2].remove(user)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistUser(self, user, sender=None):
|
|
|
06cdf6 |
+ user = dbus_to_python(user)
|
|
|
06cdf6 |
+ log.debug1("config.policies.queryLockdownWhitelistUser('%s')", user)
|
|
|
06cdf6 |
+ return user in self.getLockdownWhitelist()[2]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistUsers(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.policies.getLockdownWhitelistUsers()")
|
|
|
06cdf6 |
+ return self.getLockdownWhitelist()[2]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # uid
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='i')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addLockdownWhitelistUid(self, uid, sender=None):
|
|
|
06cdf6 |
+ uid = dbus_to_python(uid)
|
|
|
06cdf6 |
+ log.debug1("config.policies.addLockdownWhitelistUid(%d)", uid)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if uid in settings[3]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, uid)
|
|
|
06cdf6 |
+ settings[3].append(uid)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='i')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeLockdownWhitelistUid(self, uid, sender=None):
|
|
|
06cdf6 |
+ uid = dbus_to_python(uid)
|
|
|
06cdf6 |
+ log.debug1("config.policies.removeLockdownWhitelistUid(%d)", uid)
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getLockdownWhitelist())
|
|
|
06cdf6 |
+ if uid not in settings[3]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, uid)
|
|
|
06cdf6 |
+ settings[3].remove(uid)
|
|
|
06cdf6 |
+ self.setLockdownWhitelist(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, in_signature='i',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryLockdownWhitelistUid(self, uid, sender=None):
|
|
|
06cdf6 |
+ uid = dbus_to_python(uid)
|
|
|
06cdf6 |
+ log.debug1("config.policies.queryLockdownWhitelistUid(%d)", uid)
|
|
|
06cdf6 |
+ return uid in self.getLockdownWhitelist()[3]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_POLICIES, out_signature='ai')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getLockdownWhitelistUids(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.policies.getLockdownWhitelistUids()")
|
|
|
06cdf6 |
+ return self.getLockdownWhitelist()[3]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
06cdf6 |
|
|
|
06cdf6 |
# I C M P T Y P E S
|
|
|
06cdf6 |
@@ -612,3 +772,213 @@ class FirewallDConfig(slip.dbus.service.
|
|
|
06cdf6 |
@dbus_handle_exceptions
|
|
|
06cdf6 |
def Updated(self):
|
|
|
06cdf6 |
log.debug1("config.direct.Updated()")
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # chain
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addChain(self, ipv, table, chain, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ log.debug1("config.direct.addChain('%s', '%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain))
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ idx = tuple((ipv, table, chain))
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if idx in settings[0]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED,
|
|
|
06cdf6 |
+ "chain '%s' already is in '%s:%s'" % (chain, ipv, table))
|
|
|
06cdf6 |
+ settings[0].append(idx)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeChain(self, ipv, table, chain, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ log.debug1("config.direct.removeChain('%s', '%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain))
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ idx = tuple((ipv, table, chain))
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if idx not in settings[0]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED,
|
|
|
06cdf6 |
+ "chain '%s' is not in '%s:%s'" % (chain, ipv, table))
|
|
|
06cdf6 |
+ settings[0].remove(idx)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sss',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryChain(self, ipv, table, chain, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ log.debug1("config.direct.queryChain('%s', '%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain))
|
|
|
06cdf6 |
+ idx = tuple((ipv, table, chain))
|
|
|
06cdf6 |
+ return idx in self.getSettings()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='ss',
|
|
|
06cdf6 |
+ out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getChains(self, ipv, table, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ log.debug1("config.direct.getChains('%s', '%s')" % (ipv, table))
|
|
|
06cdf6 |
+ ret = [ ]
|
|
|
06cdf6 |
+ for idx in self.getSettings()[0]:
|
|
|
06cdf6 |
+ if idx[0] == ipv and idx[1] == table:
|
|
|
06cdf6 |
+ ret.append(idx[2])
|
|
|
06cdf6 |
+ return ret
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='',
|
|
|
06cdf6 |
+ out_signature='a(sss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getAllChains(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.direct.getAllChains()")
|
|
|
06cdf6 |
+ return self.getSettings()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # rule
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sssias')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addRule(self, ipv, table, chain, priority, args, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ priority = dbus_to_python(priority)
|
|
|
06cdf6 |
+ args = dbus_to_python(args)
|
|
|
06cdf6 |
+ log.debug1("config.direct.addRule('%s', '%s', '%s', %d, '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain, priority, "','".join(args)))
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ idx = (ipv, table, chain, priority, args)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if idx in settings[1]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED,
|
|
|
06cdf6 |
+ "rule '%s' already is in '%s:%s:%s'" % \
|
|
|
06cdf6 |
+ (args, ipv, table, chain))
|
|
|
06cdf6 |
+ settings[1].append(idx)
|
|
|
06cdf6 |
+ self.update(tuple(settings))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sssias')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeRule(self, ipv, table, chain, priority, args, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ priority = dbus_to_python(priority)
|
|
|
06cdf6 |
+ args = dbus_to_python(args)
|
|
|
06cdf6 |
+ log.debug1("config.direct.removeRule('%s', '%s', '%s', %d, '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain, priority, "','".join(args)))
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ idx = (ipv, table, chain, priority, args)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if idx not in settings[1]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED,
|
|
|
06cdf6 |
+ "rule '%s' is not in '%s:%s:%s'" % \
|
|
|
06cdf6 |
+ (args, ipv, table, chain))
|
|
|
06cdf6 |
+ settings[1].remove(idx)
|
|
|
06cdf6 |
+ self.update(tuple(settings))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sssias',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryRule(self, ipv, table, chain, priority, args, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ priority = dbus_to_python(priority)
|
|
|
06cdf6 |
+ args = dbus_to_python(args)
|
|
|
06cdf6 |
+ log.debug1("config.direct.queryRule('%s', '%s', '%s', %d, '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain, priority, "','".join(args)))
|
|
|
06cdf6 |
+ idx = (ipv, table, chain, priority, args)
|
|
|
06cdf6 |
+ return idx in self.getSettings()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sss',
|
|
|
06cdf6 |
+ out_signature='a(ias)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getRules(self, ipv, table, chain, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ table = dbus_to_python(table)
|
|
|
06cdf6 |
+ chain = dbus_to_python(chain)
|
|
|
06cdf6 |
+ log.debug1("config.direct.getRules('%s', '%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, table, chain))
|
|
|
06cdf6 |
+ ret = [ ]
|
|
|
06cdf6 |
+ for idx in self.getSettings()[1]:
|
|
|
06cdf6 |
+ if idx[0] == ipv and idx[1] == table and idx[2] == chain:
|
|
|
06cdf6 |
+ ret.append((idx[3], idx[4]))
|
|
|
06cdf6 |
+ return ret
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='',
|
|
|
06cdf6 |
+ out_signature='a(sssias)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getAllRules(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.direct.getAllRules()")
|
|
|
06cdf6 |
+ return self.getSettings()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # passthrough
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sas')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addPassthrough(self, ipv, args, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ args = dbus_to_python(args)
|
|
|
06cdf6 |
+ log.debug1("config.direct.addPassthrough('%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, "','".join(args)))
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ idx = (ipv, args)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if idx in settings[2]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED,
|
|
|
06cdf6 |
+ "passthrough '%s', '%s'" % (ipv, args))
|
|
|
06cdf6 |
+ settings[2].append(idx)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sas')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removePassthrough(self, ipv, args, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ args = dbus_to_python(args)
|
|
|
06cdf6 |
+ log.debug1("config.direct.removePassthrough('%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, "','".join(args)))
|
|
|
06cdf6 |
+ self.accessCheck(sender)
|
|
|
06cdf6 |
+ idx = (ipv, args)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if idx not in settings[2]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED,
|
|
|
06cdf6 |
+ "passthrough '%s', '%s'" % (ipv, args))
|
|
|
06cdf6 |
+ settings[2].remove(idx)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='sas',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryPassthrough(self, ipv, args, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ args = dbus_to_python(args)
|
|
|
06cdf6 |
+ log.debug1("config.direct.queryPassthrough('%s', '%s')" % \
|
|
|
06cdf6 |
+ (ipv, "','".join(args)))
|
|
|
06cdf6 |
+ idx = (ipv, args)
|
|
|
06cdf6 |
+ return idx in self.getSettings()[2]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='aas')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getPassthroughs(self, ipv, sender=None):
|
|
|
06cdf6 |
+ ipv = dbus_to_python(ipv)
|
|
|
06cdf6 |
+ log.debug1("config.direct.getPassthroughs('%s')" % (ipv))
|
|
|
06cdf6 |
+ ret = [ ]
|
|
|
06cdf6 |
+ for idx in self.getSettings()[2]:
|
|
|
06cdf6 |
+ if idx[0] == ipv:
|
|
|
06cdf6 |
+ ret.append(idx[1])
|
|
|
06cdf6 |
+ return ret
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_DIRECT, out_signature='a(sas)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getAllPassthroughs(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.direct.getAllPassthroughs()")
|
|
|
06cdf6 |
+ return self.getSettings()[2]
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/server/config_service.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/server/config_service.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/server/config_service.py.RHBZ#1127706 2014-01-13 16:12:35.000000000 +0100
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/server/config_service.py 2014-09-30 01:09:08.591824854 +0200
|
|
|
06cdf6 |
@@ -219,3 +219,244 @@ class FirewallDConfigService(slip.dbus.s
|
|
|
06cdf6 |
@dbus_handle_exceptions
|
|
|
06cdf6 |
def Renamed(self, name):
|
|
|
06cdf6 |
log.debug1("config.service.%d.Renamed('%s')" % (self.id, name))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # version
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getVersion(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getVersion()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setVersion(self, version, sender=None):
|
|
|
06cdf6 |
+ version = dbus_to_python(version, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setVersion('%s')", self.id, version)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[0] = version
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # short
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getShort(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getShort()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setShort(self, short, sender=None):
|
|
|
06cdf6 |
+ short = dbus_to_python(short, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setShort('%s')", self.id, short)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[1] = short
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # description
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getDescription(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getDescription()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[2]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setDescription(self, description, sender=None):
|
|
|
06cdf6 |
+ description = dbus_to_python(description, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setDescription('%s')", self.id,
|
|
|
06cdf6 |
+ description)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[2] = description
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # port
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, out_signature='a(ss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getPorts(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getPorts()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[3]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='a(ss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setPorts(self, ports, sender=None):
|
|
|
06cdf6 |
+ _ports = [ ]
|
|
|
06cdf6 |
+ # convert embedded lists to tuples
|
|
|
06cdf6 |
+ for port in dbus_to_python(ports, list):
|
|
|
06cdf6 |
+ if type(port) == list:
|
|
|
06cdf6 |
+ _ports.append(tuple(port))
|
|
|
06cdf6 |
+ else:
|
|
|
06cdf6 |
+ _ports.append(port)
|
|
|
06cdf6 |
+ ports = _ports
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setPorts('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join("('%s, '%s')" % (port[0], port[1]) for port in ports))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[3] = ports
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='ss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addPort(self, port, protocol, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.addPort('%s', '%s')", self.id, port,
|
|
|
06cdf6 |
+ protocol)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if (port,protocol) in settings[3]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, "%s:%s" % (port, protocol))
|
|
|
06cdf6 |
+ settings[3].append((port,protocol))
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='ss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removePort(self, port, protocol, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.removePort('%s', '%s')", self.id, port,
|
|
|
06cdf6 |
+ protocol)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if (port,protocol) not in settings[3]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, "%s:%s" % (port, protocol))
|
|
|
06cdf6 |
+ settings[3].remove((port,protocol))
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='ss',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryPort(self, port, protocol, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.queryPort('%s', '%s')", self.id, port,
|
|
|
06cdf6 |
+ protocol)
|
|
|
06cdf6 |
+ return (port,protocol) in self.getSettings()[3]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # module
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getModules(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getModules()", self.id)
|
|
|
06cdf6 |
+ return sorted(self.getSettings()[4])
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setModules(self, modules, sender=None):
|
|
|
06cdf6 |
+ modules = dbus_to_python(modules, list)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setModules('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(modules))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[4] = modules
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addModule(self, module, sender=None):
|
|
|
06cdf6 |
+ module = dbus_to_python(module, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.addModule('%s')", self.id, module)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if module in settings[4]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, module)
|
|
|
06cdf6 |
+ settings[4].append(module)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeModule(self, module, sender=None):
|
|
|
06cdf6 |
+ module = dbus_to_python(module, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.removeModule('%s')", self.id, module)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if module not in settings[4]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, module)
|
|
|
06cdf6 |
+ settings[4].remove(module)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryModule(self, module, sender=None):
|
|
|
06cdf6 |
+ module = dbus_to_python(module, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.queryModule('%s')", self.id, module)
|
|
|
06cdf6 |
+ return module in self.getSettings()[4]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # destination
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, out_signature='a{ss}')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getDestinations(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getDestinations()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[5]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setDestinations(self, destinations, sender=None):
|
|
|
06cdf6 |
+ destinations = dbus_to_python(destinations, list)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setDestinations('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(destinations))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[5] = destinations
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getDestination(self, destination, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.getDestination('%s')", self.id,
|
|
|
06cdf6 |
+ destination)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if destination not in settings[5]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, destination)
|
|
|
06cdf6 |
+ return settings[5][destination]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='ss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setDestination(self, destination, address, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ address = dbus_to_python(address, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.setDestination('%s', '%s')", self.id,
|
|
|
06cdf6 |
+ destination, address)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if destination in settings[5]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, destination)
|
|
|
06cdf6 |
+ settings[5][destination] = address
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeDestination(self, destination, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.removeDestination('%s')", self.id,
|
|
|
06cdf6 |
+ destination)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if destination not in settings[5]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, destination)
|
|
|
06cdf6 |
+ settings[5].remove(destination)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_SERVICE, in_signature='ss',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryDestination(self, destination, address, sender=None):
|
|
|
06cdf6 |
+ destination = dbus_to_python(destination, str)
|
|
|
06cdf6 |
+ address = dbus_to_python(address, str)
|
|
|
06cdf6 |
+ log.debug1("config.service.%d.queryDestination('%s', '%s')", self.id,
|
|
|
06cdf6 |
+ destination, address)
|
|
|
06cdf6 |
+ settings = self.getSettings()
|
|
|
06cdf6 |
+ return (destination in self.settings[5] and \
|
|
|
06cdf6 |
+ address == self.settings[5][destination])
|
|
|
06cdf6 |
diff -up firewalld-0.3.9/src/firewall/server/config_zone.py.RHBZ#1127706 firewalld-0.3.9/src/firewall/server/config_zone.py
|
|
|
06cdf6 |
--- firewalld-0.3.9/src/firewall/server/config_zone.py.RHBZ#1127706 2014-01-13 16:12:35.000000000 +0100
|
|
|
06cdf6 |
+++ firewalld-0.3.9/src/firewall/server/config_zone.py 2014-09-30 01:09:08.591824854 +0200
|
|
|
06cdf6 |
@@ -36,6 +36,9 @@ from firewall.core.io.zone import Zone
|
|
|
06cdf6 |
from firewall.core.logger import log
|
|
|
06cdf6 |
from firewall.server.decorators import *
|
|
|
06cdf6 |
from firewall.errors import *
|
|
|
06cdf6 |
+from firewall.core.base import DEFAULT_ZONE_TARGET
|
|
|
06cdf6 |
+from firewall.core.rich import Rich_Rule
|
|
|
06cdf6 |
+from firewall.functions import portStr
|
|
|
06cdf6 |
|
|
|
06cdf6 |
############################################################################
|
|
|
06cdf6 |
#
|
|
|
06cdf6 |
@@ -238,3 +241,527 @@ class FirewallDConfigZone(slip.dbus.serv
|
|
|
06cdf6 |
@dbus_handle_exceptions
|
|
|
06cdf6 |
def Renamed(self, name):
|
|
|
06cdf6 |
log.debug1("config.zone.%d.Renamed('%s')" % (self.id, name))
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # version
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getVersion(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getVersion()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[0]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setVersion(self, version, sender=None):
|
|
|
06cdf6 |
+ version = dbus_to_python(version, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setVersion('%s')", self.id, version)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[0] = version
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # short
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getShort(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getShort()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[1]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setShort(self, short, sender=None):
|
|
|
06cdf6 |
+ short = dbus_to_python(short, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setShort('%s')", self.id, short)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[1] = short
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # description
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getDescription(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getDescription()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[2]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setDescription(self, description, sender=None):
|
|
|
06cdf6 |
+ description = dbus_to_python(description, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setDescription('%s')", self.id, description)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[2] = description
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # immutable (deprecated)
|
|
|
06cdf6 |
+ # settings[3] was used for 'immutable'
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # target
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getTarget(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getTarget()", self.id)
|
|
|
06cdf6 |
+ settings = self.getSettings()
|
|
|
06cdf6 |
+ return settings[4] if settings[4] != DEFAULT_ZONE_TARGET else "default"
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setTarget(self, target, sender=None):
|
|
|
06cdf6 |
+ target = dbus_to_python(target, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setTarget('%s')", self.id, target)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[4] = target if target != "default" else DEFAULT_ZONE_TARGET
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # service
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getServices(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getServices()", self.id)
|
|
|
06cdf6 |
+ return sorted(self.getSettings()[5])
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setServices(self, services, sender=None):
|
|
|
06cdf6 |
+ services = dbus_to_python(services, list)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setServices('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(services))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[5] = services
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addService(self, service, sender=None):
|
|
|
06cdf6 |
+ service = dbus_to_python(service, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addService('%s')", self.id, service)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if service in settings[5]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, service)
|
|
|
06cdf6 |
+ settings[5].append(service)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeService(self, service, sender=None):
|
|
|
06cdf6 |
+ service = dbus_to_python(service, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeService('%s')", self.id, service)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if service not in settings[5]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, service)
|
|
|
06cdf6 |
+ settings[5].remove(service)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryService(self, service, sender=None):
|
|
|
06cdf6 |
+ service = dbus_to_python(service, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.queryService('%s')", self.id, service)
|
|
|
06cdf6 |
+ return service in self.getSettings()[5]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # port
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='a(ss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getPorts(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getPorts()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[6]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='a(ss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setPorts(self, ports, sender=None):
|
|
|
06cdf6 |
+ _ports = [ ]
|
|
|
06cdf6 |
+ # convert embedded lists to tuples
|
|
|
06cdf6 |
+ for port in dbus_to_python(ports, list):
|
|
|
06cdf6 |
+ if type(port) == list:
|
|
|
06cdf6 |
+ _ports.append(tuple(port))
|
|
|
06cdf6 |
+ else:
|
|
|
06cdf6 |
+ _ports.append(port)
|
|
|
06cdf6 |
+ ports = _ports
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setPorts('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join("('%s, '%s')" % (port[0], port[1]) for port in ports))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[6] = ports
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='ss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addPort(self, port, protocol, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addPort('%s', '%s')", self.id, port,
|
|
|
06cdf6 |
+ protocol)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if (port,protocol) in settings[6]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, "%s:%s" % (port, protocol))
|
|
|
06cdf6 |
+ settings[6].append((port,protocol))
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='ss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removePort(self, port, protocol, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removePort('%s', '%s')", self.id, port,
|
|
|
06cdf6 |
+ protocol)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if (port,protocol) not in settings[6]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, "%s:%s" % (port, protocol))
|
|
|
06cdf6 |
+ settings[6].remove((port,protocol))
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='ss',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryPort(self, port, protocol, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.queryPort('%s', '%s')", self.id, port,
|
|
|
06cdf6 |
+ protocol)
|
|
|
06cdf6 |
+ return (port,protocol) in self.getSettings()[6]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # icmp block
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getIcmpBlocks(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getIcmpBlocks()", self.id)
|
|
|
06cdf6 |
+ return sorted(self.getSettings()[7])
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setIcmpBlocks(self, icmptypes, sender=None):
|
|
|
06cdf6 |
+ icmptypes = dbus_to_python(icmptypes, list)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setIcmpBlocks('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(icmptypes))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[7] = icmptypes
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addIcmpBlock(self, icmptype, sender=None):
|
|
|
06cdf6 |
+ icmptype = dbus_to_python(icmptype, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addIcmpBlock('%s')", self.id, icmptype)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if icmptype in settings[7]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, icmptype)
|
|
|
06cdf6 |
+ settings[7].append(icmptype)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeIcmpBlock(self, icmptype, sender=None):
|
|
|
06cdf6 |
+ icmptype = dbus_to_python(icmptype, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeIcmpBlock('%s')", self.id, icmptype)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if icmptype not in settings[7]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, icmptype)
|
|
|
06cdf6 |
+ settings[7].remove(icmptype)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryIcmpBlock(self, icmptype, sender=None):
|
|
|
06cdf6 |
+ icmptype = dbus_to_python(icmptype, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeIcmpBlock('%s')", self.id, icmptype)
|
|
|
06cdf6 |
+ return icmptype in self.getSettings()[7]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # masquerade
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getMasquerade(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getMasquerade()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[8]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setMasquerade(self, masquerade, sender=None):
|
|
|
06cdf6 |
+ masquerade = dbus_to_python(masquerade, bool)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setMasquerade('%s')", self.id, masquerade)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[8] = masquerade
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE)
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addMasquerade(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addMasquerade()", self.id)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if settings[8]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, "masquerade")
|
|
|
06cdf6 |
+ settings[8] = True
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE)
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeMasquerade(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeMasquerade()", self.id)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if not settings[8]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, "masquerade")
|
|
|
06cdf6 |
+ settings[8] = False
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryMasquerade(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.queryMasquerade()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[8]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # forward port
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='a(ssss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getForwardPorts(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getForwardPorts()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[9]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='a(ssss)')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setForwardPorts(self, ports, sender=None):
|
|
|
06cdf6 |
+ _ports = [ ]
|
|
|
06cdf6 |
+ # convert embedded lists to tuples
|
|
|
06cdf6 |
+ for port in dbus_to_python(ports, list):
|
|
|
06cdf6 |
+ if type(port) == list:
|
|
|
06cdf6 |
+ _ports.append(tuple(port))
|
|
|
06cdf6 |
+ else:
|
|
|
06cdf6 |
+ _ports.append(port)
|
|
|
06cdf6 |
+ ports = _ports
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setForwardPorts('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join("('%s, '%s', '%s', '%s')" % (port[0], port[1], \
|
|
|
06cdf6 |
+ port[2], port[3]) for port in ports))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[9] = ports
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='ssss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addForwardPort(self, port, protocol, toport, toaddr, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ toport = dbus_to_python(toport, str)
|
|
|
06cdf6 |
+ toaddr = dbus_to_python(toaddr, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addForwardPort('%s', '%s', '%s', '%s')",
|
|
|
06cdf6 |
+ self.id, port, protocol, toport, toaddr)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ fwp_id = (portStr(port, "-"), protocol, portStr(toport, "-"),
|
|
|
06cdf6 |
+ str(toaddr))
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if fwp_id in settings[9]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED,
|
|
|
06cdf6 |
+ "%s:%s:%s:%s" % (port, protocol, toport, toaddr))
|
|
|
06cdf6 |
+ settings[9].append(fwp_id)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='ssss')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeForwardPort(self, port, protocol, toport, toaddr, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ toport = dbus_to_python(toport, str)
|
|
|
06cdf6 |
+ toaddr = dbus_to_python(toaddr, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeForwardPort('%s', '%s', '%s', '%s')",
|
|
|
06cdf6 |
+ self.id, port, protocol, toport, toaddr)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ fwp_id = (portStr(port, "-"), protocol, portStr(toport, "-"),
|
|
|
06cdf6 |
+ str(toaddr))
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if fwp_id not in settings[9]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED,
|
|
|
06cdf6 |
+ "%s:%s:%s:%s" % (port, protocol, toport, toaddr))
|
|
|
06cdf6 |
+ settings[9].remove(fwp_id)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='ssss',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryForwardPort(self, port, protocol, toport, toaddr, sender=None):
|
|
|
06cdf6 |
+ port = dbus_to_python(port, str)
|
|
|
06cdf6 |
+ protocol = dbus_to_python(protocol, str)
|
|
|
06cdf6 |
+ toport = dbus_to_python(toport, str)
|
|
|
06cdf6 |
+ toaddr = dbus_to_python(toaddr, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.queryForwardPort('%s', '%s', '%s', '%s')",
|
|
|
06cdf6 |
+ self.id, port, protocol, toport, toaddr)
|
|
|
06cdf6 |
+ fwp_id = (portStr(port, "-"), protocol, portStr(toport, "-"),
|
|
|
06cdf6 |
+ str(toaddr))
|
|
|
06cdf6 |
+ return fwp_id in self.getSettings()[9]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # interface
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getInterfaces(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getInterfaces()", self.id)
|
|
|
06cdf6 |
+ return sorted(self.getSettings()[10])
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setInterfaces(self, interfaces, sender=None):
|
|
|
06cdf6 |
+ interfaces = dbus_to_python(interfaces, list)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setInterfaces('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(interfaces))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[10] = interfaces
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addInterface(self, interface, sender=None):
|
|
|
06cdf6 |
+ interface = dbus_to_python(interface, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addInterface('%s')", self.id, interface)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if interface in settings[10]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, interface)
|
|
|
06cdf6 |
+ settings[10].append(interface)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeInterface(self, interface, sender=None):
|
|
|
06cdf6 |
+ interface = dbus_to_python(interface, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeInterface('%s')", self.id, interface)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if interface not in settings[10]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, interface)
|
|
|
06cdf6 |
+ settings[10].remove(interface)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryInterface(self, interface, sender=None):
|
|
|
06cdf6 |
+ interface = dbus_to_python(interface, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.queryInterface('%s')", self.id, interface)
|
|
|
06cdf6 |
+ return interface in self.getSettings()[10]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # source
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getSources(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getSources()", self.id)
|
|
|
06cdf6 |
+ return sorted(self.getSettings()[11])
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setSources(self, sources, sender=None):
|
|
|
06cdf6 |
+ sources = dbus_to_python(sources, list)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setSources('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(sources))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ settings[11] = sources
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addSource(self, source, sender=None):
|
|
|
06cdf6 |
+ source = dbus_to_python(source, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addSource('%s')", self.id, source)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if source in settings[11]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, source)
|
|
|
06cdf6 |
+ settings[11].append(source)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeSource(self, source, sender=None):
|
|
|
06cdf6 |
+ source = dbus_to_python(source, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeSource('%s')", self.id, source)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ if source not in settings[11]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, source)
|
|
|
06cdf6 |
+ settings[11].remove(source)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def querySource(self, source, sender=None):
|
|
|
06cdf6 |
+ source = dbus_to_python(source, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.querySource('%s')", self.id, source)
|
|
|
06cdf6 |
+ return source in self.getSettings()[11]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ # rich rule
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, out_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def getRichRules(self, sender=None):
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.getRichRules()", self.id)
|
|
|
06cdf6 |
+ return self.getSettings()[12]
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='as')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def setRichRules(self, rules, sender=None):
|
|
|
06cdf6 |
+ rules = dbus_to_python(rules, list)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.setRichRules('[%s]')", self.id,
|
|
|
06cdf6 |
+ ",".join(rules))
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ rules = [ str(Rich_Rule(rule_str=r)) for r in rules ]
|
|
|
06cdf6 |
+ settings[12] = rules
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def addRichRule(self, rule, sender=None):
|
|
|
06cdf6 |
+ rule = dbus_to_python(rule, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.addRichRule('%s')", self.id, rule)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ rule_str = str(Rich_Rule(rule_str=rule))
|
|
|
06cdf6 |
+ if rule_str in settings[12]:
|
|
|
06cdf6 |
+ raise FirewallError(ALREADY_ENABLED, rule)
|
|
|
06cdf6 |
+ settings[12].append(rule_str)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def removeRichRule(self, rule, sender=None):
|
|
|
06cdf6 |
+ rule = dbus_to_python(rule, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.removeRichRule('%s')", self.id, rule)
|
|
|
06cdf6 |
+ self.parent.accessCheck(sender)
|
|
|
06cdf6 |
+ settings = list(self.getSettings())
|
|
|
06cdf6 |
+ rule_str = str(Rich_Rule(rule_str=rule))
|
|
|
06cdf6 |
+ if rule_str not in settings[12]:
|
|
|
06cdf6 |
+ raise FirewallError(NOT_ENABLED, rule)
|
|
|
06cdf6 |
+ settings[12].remove(rule_str)
|
|
|
06cdf6 |
+ self.update(settings)
|
|
|
06cdf6 |
+
|
|
|
06cdf6 |
+ @dbus_service_method(DBUS_INTERFACE_CONFIG_ZONE, in_signature='s',
|
|
|
06cdf6 |
+ out_signature='b')
|
|
|
06cdf6 |
+ @dbus_handle_exceptions
|
|
|
06cdf6 |
+ def queryRichRule(self, rule, sender=None):
|
|
|
06cdf6 |
+ rule = dbus_to_python(rule, str)
|
|
|
06cdf6 |
+ log.debug1("config.zone.%d.queryRichRule('%s')", self.id, rule)
|
|
|
06cdf6 |
+ rule_str = str(Rich_Rule(rule_str=rule))
|
|
|
06cdf6 |
+ return rule_str in self.getSettings()[12]
|