<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 24, 2023 at 9:42 AM Lal, Arun <<a href="mailto:arun.lal@intel.com">arun.lal@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg8828308755988033123">
<div style="overflow-wrap: break-word;" lang="EN-US">
<div class="m_8828308755988033123WordSection1">
<p class="MsoNormal">Hi All,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I was trying to authenticate a user from a deamon running in my machine. And I found systemd-login can be used.
<u></u><u></u></p>
<p class="MsoNormal">I went through documentation for interface org.freedesktop.login1, but I am not clear on how it can be used.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Lets assume that there is a deamon called xyz running in my device which has a webserver component. And it receives a request to login from https side.
<u></u><u></u></p>
<p class="MsoNormal">And once the deamon has username and password, I would like to invoke some dbus calls to org.freedesktop.login1 to perform the authentication.
</p></div></div></div></blockquote><div><br></div><div>systemd-logind does not have that functionality. It's a session manager, not an authentication service. (And the sessions it manages are meant for mostly interactive connections; not for webapp sessions.)</div><div><br></div><div>Usually system authentication is done by loading libpam in-process (must be done from a privileged process running as root). If that is not possible (e.g. if you're using an unprivileged webapp), the *saslauthd* daemon from Cyrus-SASL would be one option – it is designed to be used by various network services to validate passwords over a Unix socket interface and has a PAM backend (`saslauthd -a pam`).<br></div><div><br></div><div>I don't know of other such daemons (surprisingly, SSSD doesn't expose an authenticate call through its D-Bus interface either, keeping it internal to PAM only), but that's the general approach if you plan on writing your own.<br></div></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>