I had tried granting the Connman permission directly (see @poetaster’s list) inside the .Desktop file.
After your comment, I found out that this is actually included in Internet permission. Which - in turn - is part of the default permissions set in the default profile (/etc/sailjail/config/50-default-profile.conf
).
Unfortunately neither of them yields the necessary DBus permissions. I am manually testing this with sailjail to see logs:
sailjail -v -p /usr/share/applications/WiFiKilL3r -- /usr/bin/WiFiKilL3r
Once tapping the WLAN button in the app, I get this error (code called by the UI is below):
[D] onError:81 - python error: Return value of PyObject call is NULL: Traceback (most recent call last):
File "/usr/share/WiFiKilL3r/qml/python/WiFiKilL3r.py", line 194, in disable_wifi
reply = wifi_interface.SetProperty("Powered", False)
File "/usr/lib64/python3.8/site-packages/dbus/proxies.py", line 72, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib64/python3.8/site-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib64/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: net.connman.Error.PermissionDenied: Permission denied
What I have come up with in Python so far (modified from @theyosh’s original sources):
def disable_wifi():
bus = dbus.SystemBus()
# connect to connman over dbus
connman = bus.get_object("net.connman", "/net/connman/technology/wifi")
wifi_interface = dbus.Interface(connman, "net.connman.Technology")
reply = wifi_interface.SetProperty("Powered", False)
logger('Disable wifi with DBUS')
logger(reply)
def enable_wifi():
if not is_wifi_enabled():
bus = dbus.SystemBus()
connman = bus.get_object("net.connman", "/net/connman/technology/wifi")
wifi_interface = dbus.Interface(connman, "net.connman.Technology")
reply = wifi_interface.SetProperty("Powered", True)
logger.info('Enable wifi with DBUS')
logger.info(reply)