Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pam-test: set PAM_RUSER when running an auth test and allow skipping stack config checks #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

korfuri
Copy link

@korfuri korfuri commented Sep 17, 2022

PAM_RUSER is important in contexts where a local user is escalating to a higher-privilege local user (e.g. su, sudo). Modules like pam_ssh_agent_auth rely on it to drop their privileges to those of the requesting user when accessing files.

Also, I'm testing my auth module under pam_wrapper (https://cwrap.org/pam_wrapper.html) and this allows using an alternative config. This PR includes another commit to allow optionally skipping the stack config checks.

Happy to unbundle these 2 changes if you'd rather I do that.

PAM_RUSER is important in contexts where a local user is escalating
to a higher-privilege local user (e.g. su, sudo). Modules like
pam_ssh_agent_auth rely on it to drop their privileges to those of
the requesting user when accessing files.
@korfuri
Copy link
Author

korfuri commented Sep 17, 2022

Let me use this space to say, thanks a lot for pam-test! It's made my life much easier today!

There are scenarios under which it makes sense not to check the config:

* A system may locate its pam config in a non-standard place;
* One may want to test what happens if the caller application has no
  config (e.g. to test /etc/pam.d/other);
* One may be running under `https://cwrap.org/pam_wrapper.html` and using
  an alternative configuration in the context of a test.

But this check is useful in 90% of cases, so it's worth keeping enabled
by default.
@korfuri korfuri changed the title pam-test: set PAM_RUSER when running an auth test. pam-test: set PAM_RUSER when running an auth test and allow skipping stack config checks Sep 17, 2022
getlogin(3) returns the username of the user owning the controlling terminal of the process. When running pam-test in a CI environment, it's quite possible for the program to run without a controlling terminal at all, which returns NULL, which segfaults pam-test. Instead, cuserid(3) returns the username of the geteuid(2) user.
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