cruegge / pam-gnupg

Unlock GnuPG keys on login
GNU General Public License v3.0
269 stars 12 forks source link

Fail on non standard gnupg path #16

Closed fabius85 closed 4 years ago

fabius85 commented 4 years ago

Seems to fail if gnupg is not in standard ~/.gnupg, like this: export GNUPGHOME="$XDG_DATA_HOME"/gnupg

Also it would be nice to have the ability to move ~/.pam-gnupg somewhere else (maybe under gnupg folder, or "$XDG_CONFIG_HOME"/pam-gnupg or "$XDG_CONFIG_HOME"/pam-gnupg/config)

cruegge commented 4 years ago

export GNUPGHOME="$XDG_DATA_HOME"/gnupg

There's a short explanation at the end of the README. You need to set the environment variable via pam_env; shell init happens too late.

Also it would be nice to have the ability to move ~/.pam-gnupg somewhere else (maybe under gnupg folder, or "$XDG_CONFIG_HOME"/pam-gnupg or "$XDG_CONFIG_HOME"/pam-gnupg/config)

I'll add that. Also in this case, setting XDG_CONFIG_HOME needs to be done via pam_env (but of course I'll add a fallback on ~/.config).

fabius85 commented 4 years ago

There's a short explanation at the end of the README. You need to set the environment variable via pam_env; shell init happens too late.

Sorry, i really missed that. I shoul've double checked the readme before posting.

I'll add that. Also in this case, setting XDG_CONFIG_HOME needs to be done via pam_env (but of course I'll add a fallback on ~/.config).

Thank you!

cruegge commented 4 years ago

I just pushed a couple of commits, the last of which implements XDG_CONFIG_HOME. If you want to test it, you'll also get the other commits as a side effect, one of which is a bit larger. It moves some parts of the code into a helper binary. I've been testing it for a couple of days and am fairly convinced everything works, but if you encounter any issues, let me know.

fabius85 commented 4 years ago

Installed and tested. Seems to work flawlessly!

baj0k commented 4 years ago

Hey, sorry to reopen this. If you prefer I can create a new issue. I have a working configuration with ~/.pam-gnupg and ~/.pam_environment files. I saw that the latest commit implements support for $XDG_CONFIG_HOME so I moved my ~/.pam-gnupg to ~/.config/pam-gnupg and found that it doesn't work. Looking into the code the possible locations are $XDG_CONFIG_HOME/pam-gnupg, ~/.config/pam-gnupg and ~/.pam-gnupg (if I'm wrong please correct me).

I also added XDG_CONFIG_HOME to .pam_environment and replaced aur package with the one builded from source. Am I missing something?

cruegge commented 4 years ago

It sounds as if you did everything neccessary. Are there any error messages in your syslog?

baj0k commented 4 years ago

Hey man, just wanted to let you know that I got it working with pam-gnupg in XDG_CONFIG_HOME. You should add a line or two about XDG support in the README. Also would it be possible to move ~/.pam_environment to the XDG_CONFIG_HOME as well?

Great tool, I ll recommend it to everyone. Cheers!

cruegge commented 4 years ago

I added a note on XDG_CONFIG_HOME to the README. ~/.pam_environment can't be moved. There's an old-ish open ticket for that, https://github.com/linux-pam/linux-pam/issues/7, but it doesn't look like it's going to get implemened (and I personally think the arguments against it are pretty sensible).