|
|
843f86 |
From bc6ba9d59f8070b0e76f127f16ef1cd99da90ffc Mon Sep 17 00:00:00 2001
|
|
|
843f86 |
From: Thomas Woerner <twoerner@redhat.com>
|
|
|
843f86 |
Date: Fri, 19 May 2017 15:35:54 +0200
|
|
|
843f86 |
Subject: [PATCH 5/6] D-Bus interfaces: Fix GetAll for interfaces without
|
|
|
843f86 |
properties (RHBZ#1452017)
|
|
|
843f86 |
|
|
|
843f86 |
Also: Make D-Bus error messages consistent in all interfaces.
|
|
|
843f86 |
(cherry picked from commit fb44764d1275958401e2e69161d997bfb6e02899)
|
|
|
843f86 |
---
|
|
|
843f86 |
src/firewall/server/config.py | 115 +++++++++++++++++++--------------
|
|
|
843f86 |
src/firewall/server/config_helper.py | 15 ++---
|
|
|
843f86 |
src/firewall/server/config_icmptype.py | 15 ++---
|
|
|
843f86 |
src/firewall/server/config_ipset.py | 15 ++---
|
|
|
843f86 |
src/firewall/server/config_service.py | 15 ++---
|
|
|
843f86 |
src/firewall/server/config_zone.py | 15 ++---
|
|
|
843f86 |
src/firewall/server/firewalld.py | 71 ++++++++++++++------
|
|
|
843f86 |
7 files changed, 152 insertions(+), 109 deletions(-)
|
|
|
843f86 |
|
|
|
843f86 |
diff --git a/src/firewall/server/config.py b/src/firewall/server/config.py
|
|
|
843f86 |
index 55bfffbebe76..33f72027d048 100644
|
|
|
843f86 |
--- a/src/firewall/server/config.py
|
|
|
843f86 |
+++ b/src/firewall/server/config.py
|
|
|
843f86 |
@@ -486,8 +486,8 @@ class FirewallDConfig(slip.dbus.service.Object):
|
|
|
843f86 |
"Lockdown", "IPv6_rpfilter", "IndividualCalls",
|
|
|
843f86 |
"LogDenied", "AutomaticHelpers" ]:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % prop)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % prop)
|
|
|
843f86 |
|
|
|
843f86 |
value = self.config.get_firewalld_conf().get(prop)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -546,8 +546,8 @@ class FirewallDConfig(slip.dbus.service.Object):
|
|
|
843f86 |
return dbus.String(self._get_property(prop))
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % prop)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % prop)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -558,10 +558,17 @@ class FirewallDConfig(slip.dbus.service.Object):
|
|
|
843f86 |
property_name = dbus_to_python(property_name, str)
|
|
|
843f86 |
log.debug1("config.Get('%s', '%s')", interface_name, property_name)
|
|
|
843f86 |
|
|
|
843f86 |
- if interface_name != config.dbus.DBUS_INTERFACE_CONFIG:
|
|
|
843f86 |
+ if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
|
|
|
843f86 |
+ return self._get_dbus_property(property_name)
|
|
|
843f86 |
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
|
|
|
843f86 |
+ raise dbus.exceptions.DBusException(
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
return self._get_dbus_property(property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -572,16 +579,20 @@ class FirewallDConfig(slip.dbus.service.Object):
|
|
|
843f86 |
interface_name = dbus_to_python(interface_name, str)
|
|
|
843f86 |
log.debug1("config.GetAll('%s')", interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
- if interface_name != config.dbus.DBUS_INTERFACE_CONFIG:
|
|
|
843f86 |
+ ret = { }
|
|
|
843f86 |
+ if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
|
|
|
843f86 |
+ for x in [ "DefaultZone", "MinimalMark", "CleanupOnExit",
|
|
|
843f86 |
+ "Lockdown", "IPv6_rpfilter", "IndividualCalls",
|
|
|
843f86 |
+ "LogDenied", "AutomaticHelpers" ]:
|
|
|
843f86 |
+ ret[x] = self._get_property(x)
|
|
|
843f86 |
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
|
|
|
843f86 |
+ pass
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
- ret = { }
|
|
|
843f86 |
- for x in [ "DefaultZone", "MinimalMark", "CleanupOnExit", "Lockdown",
|
|
|
843f86 |
- "IPv6_rpfilter", "IndividualCalls", "LogDenied",
|
|
|
843f86 |
- "AutomaticHelpers" ]:
|
|
|
843f86 |
- ret[x] = self._get_property(x)
|
|
|
843f86 |
return dbus.Dictionary(ret, signature="sv")
|
|
|
843f86 |
|
|
|
843f86 |
@slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_CONFIG)
|
|
|
843f86 |
@@ -595,49 +606,55 @@ class FirewallDConfig(slip.dbus.service.Object):
|
|
|
843f86 |
property_name, new_value)
|
|
|
843f86 |
self.accessCheck(sender)
|
|
|
843f86 |
|
|
|
843f86 |
- if interface_name != config.dbus.DBUS_INTERFACE_CONFIG:
|
|
|
843f86 |
- raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
-
|
|
|
843f86 |
- if property_name in [ "MinimalMark", "CleanupOnExit", "Lockdown",
|
|
|
843f86 |
- "IPv6_rpfilter", "IndividualCalls", "LogDenied",
|
|
|
843f86 |
- "AutomaticHelpers" ]:
|
|
|
843f86 |
- if property_name == "MinimalMark":
|
|
|
843f86 |
+ if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
|
|
|
843f86 |
+ if property_name in [ "MinimalMark", "CleanupOnExit", "Lockdown",
|
|
|
843f86 |
+ "IPv6_rpfilter", "IndividualCalls",
|
|
|
843f86 |
+ "LogDenied", "AutomaticHelpers" ]:
|
|
|
843f86 |
+ if property_name == "MinimalMark":
|
|
|
843f86 |
+ try:
|
|
|
843f86 |
+ int(new_value)
|
|
|
843f86 |
+ except ValueError:
|
|
|
843f86 |
+ raise FirewallError(errors.INVALID_MARK, new_value)
|
|
|
843f86 |
try:
|
|
|
843f86 |
- int(new_value)
|
|
|
843f86 |
- except ValueError:
|
|
|
843f86 |
- raise FirewallError(errors.INVALID_MARK, new_value)
|
|
|
843f86 |
- try:
|
|
|
843f86 |
- new_value = str(new_value)
|
|
|
843f86 |
- except:
|
|
|
843f86 |
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
|
|
|
843f86 |
+ new_value = str(new_value)
|
|
|
843f86 |
+ except:
|
|
|
843f86 |
+ raise FirewallError(errors.INVALID_VALUE,
|
|
|
843f86 |
+ "'%s' for %s" % \
|
|
|
843f86 |
+ (new_value, property_name))
|
|
|
843f86 |
+ if property_name in [ "CleanupOnExit", "Lockdown",
|
|
|
843f86 |
+ "IPv6_rpfilter", "IndividualCalls" ]:
|
|
|
843f86 |
+ if new_value.lower() not in [ "yes", "no",
|
|
|
843f86 |
+ "true", "false" ]:
|
|
|
843f86 |
+ raise FirewallError(errors.INVALID_VALUE,
|
|
|
843f86 |
+ "'%s' for %s" % \
|
|
|
843f86 |
(new_value, property_name))
|
|
|
843f86 |
- if property_name in [ "CleanupOnExit", "Lockdown",
|
|
|
843f86 |
- "IPv6_rpfilter", "IndividualCalls" ]:
|
|
|
843f86 |
- if new_value.lower() not in [ "yes", "no", "true", "false" ]:
|
|
|
843f86 |
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
|
|
|
843f86 |
+ if property_name == "LogDenied":
|
|
|
843f86 |
+ if new_value not in config.LOG_DENIED_VALUES:
|
|
|
843f86 |
+ raise FirewallError(errors.INVALID_VALUE,
|
|
|
843f86 |
+ "'%s' for %s" % \
|
|
|
843f86 |
(new_value, property_name))
|
|
|
843f86 |
- if property_name == "LogDenied":
|
|
|
843f86 |
- if new_value not in config.LOG_DENIED_VALUES:
|
|
|
843f86 |
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
|
|
|
843f86 |
+ if property_name == "AutomaticHelpers":
|
|
|
843f86 |
+ if new_value not in config.AUTOMATIC_HELPERS_VALUES:
|
|
|
843f86 |
+ raise FirewallError(errors.INVALID_VALUE,
|
|
|
843f86 |
+ "'%s' for %s" % \
|
|
|
843f86 |
(new_value, property_name))
|
|
|
843f86 |
- if property_name == "AutomaticHelpers":
|
|
|
843f86 |
- if new_value not in config.AUTOMATIC_HELPERS_VALUES:
|
|
|
843f86 |
- raise FirewallError(errors.INVALID_VALUE, "'%s' for %s" % \
|
|
|
843f86 |
- (new_value, property_name))
|
|
|
843f86 |
- self.config.get_firewalld_conf().set(property_name, new_value)
|
|
|
843f86 |
- self.config.get_firewalld_conf().write()
|
|
|
843f86 |
- self.PropertiesChanged(interface_name,
|
|
|
843f86 |
- { property_name: new_value }, [ ])
|
|
|
843f86 |
- elif property_name in [ "DefaultZone" ]:
|
|
|
843f86 |
+ self.config.get_firewalld_conf().set(property_name, new_value)
|
|
|
843f86 |
+ self.config.get_firewalld_conf().write()
|
|
|
843f86 |
+ self.PropertiesChanged(interface_name,
|
|
|
843f86 |
+ { property_name: new_value }, [ ])
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
+ raise dbus.exceptions.DBusException(
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
- "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
diff --git a/src/firewall/server/config_helper.py b/src/firewall/server/config_helper.py
|
|
|
843f86 |
index e3683e9b7788..23e30e04ba26 100644
|
|
|
843f86 |
--- a/src/firewall/server/config_helper.py
|
|
|
843f86 |
+++ b/src/firewall/server/config_helper.py
|
|
|
843f86 |
@@ -92,9 +92,8 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
|
|
|
843f86 |
return dbus.Boolean(self.obj.builtin)
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % \
|
|
|
843f86 |
- property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -109,7 +108,7 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_HELPER:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
return self._get_property(property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -123,7 +122,7 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_HELPER:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
ret = { }
|
|
|
843f86 |
for x in [ "name", "filename", "path", "default", "builtin" ]:
|
|
|
843f86 |
@@ -144,11 +143,11 @@ class FirewallDConfigHelper(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_HELPER:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' is not settable" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
+ "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
diff --git a/src/firewall/server/config_icmptype.py b/src/firewall/server/config_icmptype.py
|
|
|
843f86 |
index 9f571ae98128..e1724550d740 100644
|
|
|
843f86 |
--- a/src/firewall/server/config_icmptype.py
|
|
|
843f86 |
+++ b/src/firewall/server/config_icmptype.py
|
|
|
843f86 |
@@ -92,9 +92,8 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
|
|
|
843f86 |
return dbus.Boolean(self.obj.builtin)
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % \
|
|
|
843f86 |
- property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -109,7 +108,7 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
return self._get_property(property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -123,7 +122,7 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
ret = { }
|
|
|
843f86 |
for x in [ "name", "filename", "path", "default", "builtin" ]:
|
|
|
843f86 |
@@ -144,11 +143,11 @@ class FirewallDConfigIcmpType(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ICMPTYPE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' is not settable" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
+ "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
diff --git a/src/firewall/server/config_ipset.py b/src/firewall/server/config_ipset.py
|
|
|
843f86 |
index a1613c6933ab..8c647bc29ab9 100644
|
|
|
843f86 |
--- a/src/firewall/server/config_ipset.py
|
|
|
843f86 |
+++ b/src/firewall/server/config_ipset.py
|
|
|
843f86 |
@@ -93,9 +93,8 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
|
|
|
843f86 |
return dbus.Boolean(self.obj.builtin)
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % \
|
|
|
843f86 |
- property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -110,7 +109,7 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_IPSET:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
return self._get_property(property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -124,7 +123,7 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_IPSET:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
ret = { }
|
|
|
843f86 |
for x in [ "name", "filename", "path", "default", "builtin" ]:
|
|
|
843f86 |
@@ -145,11 +144,11 @@ class FirewallDConfigIPSet(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_IPSET:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' is not settable" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
+ "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
diff --git a/src/firewall/server/config_service.py b/src/firewall/server/config_service.py
|
|
|
843f86 |
index 6745e253f88a..47530d319bdb 100644
|
|
|
843f86 |
--- a/src/firewall/server/config_service.py
|
|
|
843f86 |
+++ b/src/firewall/server/config_service.py
|
|
|
843f86 |
@@ -92,9 +92,8 @@ class FirewallDConfigService(slip.dbus.service.Object):
|
|
|
843f86 |
return dbus.Boolean(self.obj.builtin)
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % \
|
|
|
843f86 |
- property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -109,7 +108,7 @@ class FirewallDConfigService(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_SERVICE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
return self._get_property(property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -123,7 +122,7 @@ class FirewallDConfigService(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_SERVICE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
ret = { }
|
|
|
843f86 |
for x in [ "name", "filename", "path", "default", "builtin" ]:
|
|
|
843f86 |
@@ -144,11 +143,11 @@ class FirewallDConfigService(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_SERVICE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' is not settable" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
+ "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
diff --git a/src/firewall/server/config_zone.py b/src/firewall/server/config_zone.py
|
|
|
843f86 |
index 42ec963549d8..f98f700bec59 100644
|
|
|
843f86 |
--- a/src/firewall/server/config_zone.py
|
|
|
843f86 |
+++ b/src/firewall/server/config_zone.py
|
|
|
843f86 |
@@ -94,9 +94,8 @@ class FirewallDConfigZone(slip.dbus.service.Object):
|
|
|
843f86 |
return dbus.Boolean(self.obj.builtin)
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % \
|
|
|
843f86 |
- property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -111,7 +110,7 @@ class FirewallDConfigZone(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ZONE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
return self._get_property(property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@@ -125,7 +124,7 @@ class FirewallDConfigZone(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ZONE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
ret = { }
|
|
|
843f86 |
for x in [ "name", "filename", "path", "default", "builtin" ]:
|
|
|
843f86 |
@@ -146,11 +145,11 @@ class FirewallDConfigZone(slip.dbus.service.Object):
|
|
|
843f86 |
if interface_name != config.dbus.DBUS_INTERFACE_CONFIG_ZONE:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' is not settable" % property_name)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
+ "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
diff --git a/src/firewall/server/firewalld.py b/src/firewall/server/firewalld.py
|
|
|
843f86 |
index 2f1f8234ab9c..8c4bd4f0c66a 100644
|
|
|
843f86 |
--- a/src/firewall/server/firewalld.py
|
|
|
843f86 |
+++ b/src/firewall/server/firewalld.py
|
|
|
843f86 |
@@ -184,8 +184,8 @@ class FirewallD(slip.dbus.service.Object):
|
|
|
843f86 |
|
|
|
843f86 |
else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' isn't exported (or may not exist)" % prop)
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % prop)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='ss',
|
|
|
843f86 |
out_signature='v')
|
|
|
843f86 |
@@ -196,12 +196,19 @@ class FirewallD(slip.dbus.service.Object):
|
|
|
843f86 |
property_name = dbus_to_python(property_name, str)
|
|
|
843f86 |
log.debug1("Get('%s', '%s')", interface_name, property_name)
|
|
|
843f86 |
|
|
|
843f86 |
- if interface_name != config.dbus.DBUS_INTERFACE:
|
|
|
843f86 |
+ if interface_name == config.dbus.DBUS_INTERFACE:
|
|
|
843f86 |
+ return self._get_property(property_name)
|
|
|
843f86 |
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_ZONE,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_DIRECT,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_POLICIES,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_IPSET ]:
|
|
|
843f86 |
+ raise dbus.exceptions.DBusException(
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
-
|
|
|
843f86 |
- return self._get_property(property_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus_service_method(dbus.PROPERTIES_IFACE, in_signature='s',
|
|
|
843f86 |
out_signature='a{sv}')
|
|
|
843f86 |
@@ -210,17 +217,24 @@ class FirewallD(slip.dbus.service.Object):
|
|
|
843f86 |
interface_name = dbus_to_python(interface_name, str)
|
|
|
843f86 |
log.debug1("GetAll('%s')", interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
- if interface_name != config.dbus.DBUS_INTERFACE:
|
|
|
843f86 |
+ ret = { }
|
|
|
843f86 |
+ if interface_name == config.dbus.DBUS_INTERFACE:
|
|
|
843f86 |
+ for x in [ "version", "interface_version", "state",
|
|
|
843f86 |
+ "IPv4", "IPv6", "IPv6_rpfilter", "BRIDGE",
|
|
|
843f86 |
+ "IPSet", "IPSetTypes", "nf_conntrack_helper_setting",
|
|
|
843f86 |
+ "nf_conntrack_helpers", "IPv4ICMPTypes",
|
|
|
843f86 |
+ "IPv6ICMPTypes" ]:
|
|
|
843f86 |
+ ret[x] = self._get_property(x)
|
|
|
843f86 |
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_ZONE,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_DIRECT,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_POLICIES,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_IPSET ]:
|
|
|
843f86 |
+ pass
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
- ret = { }
|
|
|
843f86 |
- for x in [ "version", "interface_version", "state",
|
|
|
843f86 |
- "IPv4", "IPv6", "IPv6_rpfilter", "BRIDGE",
|
|
|
843f86 |
- "IPSet", "IPSetTypes", "nf_conntrack_helper_setting",
|
|
|
843f86 |
- "nf_conntrack_helpers", "IPv4ICMPTypes", "IPv6ICMPTypes" ]:
|
|
|
843f86 |
- ret[x] = self._get_property(x)
|
|
|
843f86 |
return dbus.Dictionary(ret, signature="sv")
|
|
|
843f86 |
|
|
|
843f86 |
@slip.dbus.polkit.require_auth(config.dbus.PK_ACTION_CONFIG)
|
|
|
843f86 |
@@ -234,14 +248,31 @@ class FirewallD(slip.dbus.service.Object):
|
|
|
843f86 |
new_value)
|
|
|
843f86 |
self.accessCheck(sender)
|
|
|
843f86 |
|
|
|
843f86 |
- if interface_name != config.dbus.DBUS_INTERFACE:
|
|
|
843f86 |
+ if interface_name == config.dbus.DBUS_INTERFACE:
|
|
|
843f86 |
+ if property_name in [ "version", "interface_version", "state",
|
|
|
843f86 |
+ "IPv4", "IPv6", "IPv6_rpfilter", "BRIDGE",
|
|
|
843f86 |
+ "IPSet", "IPSetTypes",
|
|
|
843f86 |
+ "nf_conntrack_helper_setting",
|
|
|
843f86 |
+ "nf_conntrack_helpers", "IPv4ICMPTypes",
|
|
|
843f86 |
+ "IPv6ICMPTypes" ]:
|
|
|
843f86 |
+ raise dbus.exceptions.DBusException(
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.PropertyReadOnly: "
|
|
|
843f86 |
+ "Property '%s' is read-only" % property_name)
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
+ raise dbus.exceptions.DBusException(
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
+ elif interface_name in [ config.dbus.DBUS_INTERFACE_ZONE,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_DIRECT,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_POLICIES,
|
|
|
843f86 |
+ config.dbus.DBUS_INTERFACE_IPSET ]:
|
|
|
843f86 |
+ raise dbus.exceptions.DBusException(
|
|
|
843f86 |
+ "org.freedesktop.DBus.Error.InvalidArgs: "
|
|
|
843f86 |
+ "Property '%s' does not exist" % property_name)
|
|
|
843f86 |
+ else:
|
|
|
843f86 |
raise dbus.exceptions.DBusException(
|
|
|
843f86 |
"org.freedesktop.DBus.Error.UnknownInterface: "
|
|
|
843f86 |
- "FirewallD does not implement %s" % interface_name)
|
|
|
843f86 |
-
|
|
|
843f86 |
- raise dbus.exceptions.DBusException(
|
|
|
843f86 |
- "org.freedesktop.DBus.Error.AccessDenied: "
|
|
|
843f86 |
- "Property '%s' is not settable" % property_name)
|
|
|
843f86 |
+ "Interface '%s' does not exist" % interface_name)
|
|
|
843f86 |
|
|
|
843f86 |
@dbus.service.signal(dbus.PROPERTIES_IFACE, signature='sa{sv}as')
|
|
|
843f86 |
def PropertiesChanged(self, interface_name, changed_properties,
|
|
|
843f86 |
--
|
|
|
843f86 |
2.12.0
|
|
|
843f86 |
|