Skip to content

Fix unlocker_daemon.py for Ubuntu 18.04 and onwards.#5

Open
appositeit wants to merge 1 commit intomaxchehab:masterfrom
appositeit:fixit
Open

Fix unlocker_daemon.py for Ubuntu 18.04 and onwards.#5
appositeit wants to merge 1 commit intomaxchehab:masterfrom
appositeit:fixit

Conversation

@appositeit
Copy link

From 18.04 Ubuntu changed back to the Gnome desktop, and a bunch of the
tooling used in the unlocker-daemon.py broke.

To fix this we need to:

  • Identify the user who's session we want to unlock
  • Get the DBUS_SESSION_BUS_ADDRESS for their dbus.SessionBus()
  • seteuid to their uid

The original script looks for the first 'real' user in /etc/shadow. I
look for the first process run by a non-daemon user process with a
DBUS_SESSION_BUS_ADDRESS in their environment and use that BUS_ADDRESS
and user's uid to seteuid.

The orginal script shells out to control the screensaver, I've modified
it to use python dbus commands to query screenlock status and
lock/unlock the screensaver. I think it should work with various window
managers, but it's only been tested on gnome. Behaviour is undefined if
there are several user sessions with window managers running.

From 18.04 Ubuntu changed back to the Gnome desktop, and a bunch of the
tooling used in the unlocker-daemon.py broke.

To fix this we need to:

* Identify the user who's session we want to unlock * Get the
DBUS_SESSION_BUS_ADDRESS for their dbus.SessionBus() * seteuid to their
uid

The original script looks for the first 'real' user in /etc/shadow. I
look for the first process run by a non-daemon user process with a
DBUS_SESSION_BUS_ADDRESS in their environment and use that BUS_ADDRESS
and user's uid to seteuid.

The orginal script shells out to control the screensaver, I've modified
it to use python dbus commands to query screenlock status and
lock/unlock the screensaver. I think it should work with various window
managers, but it's only been tested on gnome. Behaviour is undefined if
there are several user sessions with window managers running.
@appositeit appositeit mentioned this pull request Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant