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_succeed_if.so not worked correctly in auth stack of /etc/pam.d/crond #109

Closed
masa-murayama opened this issue Mar 30, 2022 · 4 comments
Closed
Labels

Comments

@masa-murayama
Copy link

masa-murayama commented Mar 30, 2022

I have a problem that pam_succeed_if.so always returns a error of ignore for auth stack in /etc/pam.d/crond.
I also found the pam setup in cron_start_pam() in src/security.c didn't call pam_authenticate().
So authentication in pam isn't executed correctly, I think.

It happened for CentOS6.8, CentOS7.3. and CentOS7.8.

To duplicate the issue, I used crontab -l command invoked by not root user.
When root user invoked crontab, it didn't use the pam.

thanks,

@t8m t8m added the invalid label Mar 30, 2022
@t8m
Copy link
Member

t8m commented Mar 30, 2022

crond or crontab does not invoke pam_authenticate at all. That is by design.

@t8m t8m closed this as completed Mar 30, 2022
@masa-murayama
Copy link
Author

Thank you very much for your quick response.
As crond or crontab don't invoke pam_authenticate(), it does not need to include the auth stack in password-auth file and/or system-auth file.
So, I changed the auth stack in /etc/pam.d/crond below.

#auth include system-auth
auth required pam_permit.so

It worked for me even if I used pam_succeed_if.so in password-auth and/or system-auth. Many thanks.
-masa

@t8m
Copy link
Member

t8m commented Mar 31, 2022

There is a reason the auth stack is included - that is for pam_setcred() call which uses the auth stack.
Not sure if it makes much sense for crontab, but for crond, that is needed.

@masa-murayama
Copy link
Author

thank you very much for your response.
I copied the original auth stack of system-auth into crond not to change the behaivior of pam_setcred():

#auth include system-auth
auth required pam_env.so
auth required pam_faildelay.so delay=2000000
auth sufficient pam_fprintd.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 1000 quiet_success
auth required pam_deny.so

It seems to work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants