I am writing a process that needs to periodically authenticate users (i.e. call pam_authenticate()). For security purposes I would prefer not to run this process with root privilege. I can use capabilities(7) for my other security requirements (i.e. it needs to bind to HTTPS port, so can use CAP_NET_BIND_SERVICE).I could start with root privs and drop them temporarily, raising them only when needed to call pam_authenticate and then dropping them again. But as long as the ability remains to raise privs this is really only security-by-obscurity, since an attacker who could gain control of the process could raise the privileges.Is the security restriction due to/driven by the specific PAM modules being utilized? Could it be only pam_unix.so's need to read the shadow password file that is causing issues?
Is there a Linux capabilities(7) to allow a process to execute pam_authenticate?
security;pam;capabilities