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

Permit unix_chkpwd & pam_unix.so to run without being setuid-root. #373

Merged
merged 1 commit into from
Jun 29, 2021
Merged

Permit unix_chkpwd & pam_unix.so to run without being setuid-root. #373

merged 1 commit into from
Jun 29, 2021

Conversation

AndrewGMorgan
Copy link
Contributor

Remove the hard-coding of the idea that the only way pam_unix.so can
read the shadow file is if it can, in some way, run setuid-root.
Linux capabilities only require cap_dac_override to read the /etc/shadow
file.

This change achieves two things: it opens a path for a linux-pam
application to run without being setuid-root; further, it allows
unix_chkpwd to run non-setuid-root if it is installed:

sudo setcap cap_dac_override=ep unix_chkpwd

If we wanted to link against libcap, we could install this binary with
cap_dac_override=p, and use cap_set_proc() to raise the effective bit
at runtime. However, some distributions already link unix_chkpwd
against libcap-ng for some, likely spurious, reason so "ep" is fine
for now.

Signed-off-by: Andrew G. Morgan [email protected]

Remove the hard-coding of the idea that the only way pam_unix.so can
read the shadow file is if it can, in some way, run setuid-root.
Linux capabilities only require cap_dac_override to read the /etc/shadow
file.

This change achieves two things: it opens a path for a linux-pam
application to run without being setuid-root; further, it allows
unix_chkpwd to run non-setuid-root if it is installed:

   sudo setcap cap_dac_override=ep unix_chkpwd

If we wanted to link against libcap, we could install this binary with
cap_dac_override=p, and use cap_set_proc() to raise the effective bit
at runtime. However, some distributions already link unix_chkpwd
against libcap-ng for some, likely spurious, reason so "ep" is fine
for now.

Signed-off-by: Andrew G. Morgan <[email protected]>
@t8m
Copy link
Member

t8m commented Jun 29, 2021

@ldv-alt This LGTM so I'll merge unless you have any comments, objections.

@t8m t8m merged commit f220cac into linux-pam:master Jun 29, 2021
@t8m
Copy link
Member

t8m commented Jun 29, 2021

Merged to master. Thank you for the pull request!

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.

3 participants