NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.96k stars 13.98k forks source link

XFCE: "lock screen before sleep" not working #38492

Open davidak opened 6 years ago

davidak commented 6 years ago

Issue description

this is a security issue

might be related to https://github.com/NixOS/nixpkgs/issues/38493

cc @yegortimoshenko

Steps to reproduce

  1. enable "lock screen before sleep" in settings

screenshot_2018-04-06_02-03-14

  1. suspend or hibernate
  2. hit start button
  3. you are logged in directly

Technical details

davidak commented 6 years ago

The setting uses xflock4.

[davidak@X230:~]$ xflock4 
Property "/general/LockCommand" does not exist on channel "xfce4-session".

The problem is described here: https://unix.stackexchange.com/questions/101806/why-doesnt-my-screen-lock-in-xfce

You get to this page: https://wiki.archlinux.org/index.php/Xfce#Lock_the_screen

xflock4 is the reference Bash script which is used to lock an Xfce session . It tries consecutively four screen lockers or exits with return code 1 if it fails to find any. Therefore, for xflock4 to succeed, either xscreensaver, gnome-screensaver, slock or xlockmore needs to be installed.

In particular the light-locker session locker integrates well with xfce4-power-manager:

[davidak@X230:~]$ light-locker-command -l
The program ‘light-locker-command’ is currently not installed. You can install it by typing:
  nix-env -iA nixos.lightlocker

I think the best method to solve this is to install this package when enabling xfce.

lukateras commented 6 years ago

lightlocker is not very light, perhaps slock would be a good default (it's very small, see https://github.com/slopjong/slock). I too would support adding something as a fallback to Xfce closure.

davidak commented 6 years ago

@yegortimoshenko was anything changed recently? locking worked in 17.09.

davidak commented 6 years ago

This also works now again. Was anything changed?

michalrus commented 6 years ago

@volth thank you for the kind words! That module has a lot of things hard-coded, though. :( I’ll add a note to maybe clean it up & contribute.

lukateras commented 6 years ago

@davidak: not really. You probably have some of the executables that it takes on PATH. There is still no default.

davidak commented 6 years ago

@yegortimoshenko you are right. i installed lightlocker for the user and locking works.

davidak commented 6 years ago

Same issue in GNOME. "Screen Lock" is "On", but it don't lock when suspending.

screenshot from 2018-05-09 21-38-16

Reproduced with:

davidak commented 6 years ago

Locking works in GNOME when GDM is used instead of lightdm.

alexeymuranov commented 6 years ago

As far as I understand, locking the screen and locking the login keychain is not the same thing, and the second is much more important. Are the keychains getting locked in GNOME with GDM on suspend?