Hello. I want to replace the default secret service, because it seems KeePassXC better protects the credentials. I use Cinnamon DE, LightDM with automatic login enabled and LUKS passphrase-encrypted drive.
I managed to temporary register KeePassXC as a secret service by killing gnome-keyring-daemon. Then I turned on KeePassXC autostart. Now to avoid conflict I need to disable gnome-keyring-daemon and unfortunately can’t find any way. I tried overriding /usr/share/dbus-1/services/org.freedesktop.secrets.service with ~/.local/share/dbus-1/services/org.freedesktop.secrets.service, overriding systemd user service gnome-keyring-daemon.service, removing /etc/xdg/autostart/gnome-keyring-secrets.desktop, greping /etc/X11. Despite that, after logging there is always a running process /usr/bin/gnome-keyring-daemon --daemonize --login.
First of all, the Internet doesn’t tell a lot about these things in Linux desktop, even though they’re so common. How it works, that the LUKS decryption passphrase somehow magically gets transported to GNOME keyring? What spawn it? Systemd? PAM? LightDM? D-Bus? How secure is this? And what is the correct way of replacing it with a different program?
I see this command for the first time. There’s indeed pam_gnome_keyring.so in /etc/pam.d files: cinnamon-screensaver, gdm-autologin, gdm-password and lightdm. Still don’t know what to do.
Hmm, you might have found a bug. It looks like gnome-keyring shouldn’t be in the PAM stack if it isn’t enabled.
$ grep pam_gnome_keyring /usr/share/authselect/default/sssd/*
/usr/share/authselect/default/sssd/fingerprint-auth:auth optional pam_gnome_keyring.so only_if=login auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/fingerprint-auth:session optional pam_gnome_keyring.so only_if=login auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/password-auth:auth optional pam_gnome_keyring.so auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/password-auth:session optional pam_gnome_keyring.so auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/REQUIREMENTS:- with-pam-gnome-keyring is selected, make sure the pam_gnome_keyring module {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/smartcard-auth:auth optional pam_gnome_keyring.so only_if=login auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/smartcard-auth:session optional pam_gnome_keyring.so only_if=login auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/system-auth:auth optional pam_gnome_keyring.so only_if=login auto_start {include if "with-pam-gnome-keyring"}
/usr/share/authselect/default/sssd/system-auth:session optional pam_gnome_keyring.so only_if=login auto_start {include if "with-pam-gnome-keyring"}
Edit: Ah, I see, authselect doesn’t manage those services (cinnamon-screensaver, gdm-autologin, gdm-password, and lightdm). I guess you’ll have to edit those files manually to get rid of it.
Be very careful editing those files. You can easily lock yourself out of your system. Also, beware that those files might get updated when their system packages are updated.
Since all those lines show “optional”, I think you will be OK just commenting them out. However, watch out for things like [default=<N>] on earlier lines in the same stack. You might have to reduce <N> by 1 if that pam_gnome_keyring line was included before but no longer is (the <N> is the number of subsequent lines to jump over).
Again, I’ve never done this, so I don’t know how well trying to remove that will go. (It could go badly.)
I have written a script that in theory should disable gnome-keyring-daemon, but I’m afraid to actually run it. Can anyone review it? And where do I test it in? A VM?
Tested it in a FSB40 VM. No changes. KeePassXC still can’t start because of gnome-keyring-daemon.
Doing sudo chmod -x /usr/bin/gnome-keyring-daemon is impossible on atomic ostree systems.
Obviously, same with sudo sed -i -E 's/Exec=.*/Exec=\/usr\/bin\/keepassxc/g' /usr/share/dbus-1/services/org.freedesktop.secrets.service. /usr is read-only.
Sure, but since these scripts I dug up are old, I need to give them a try again. So give me some time to come back to this. couple hours - tomorrow morning.