<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 24 June 2016 at 15:07, Bruno Oliveira <span dir="ltr">&lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On 2016-06-23, Bill Burke wrote:<br>
&gt;<br>
&gt;<br>
&gt; On 6/23/16 2:56 PM, Bruno Oliveira wrote:<br>
&gt; &gt; On 2016-06-23, Bill Burke wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On 6/23/16 12:25 PM, John Dennis wrote:<br>
&gt; &gt; &gt; &gt; On 06/23/2016 10:00 AM, Bruno Oliveira wrote:<br>
&gt; &gt; &gt; &gt; &gt; Good morning,<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; One of the use case scenarios described for FreeIPA, is the integration via PAM<br>
&gt; &gt; &gt; &gt; &gt; and SSSD, which &quot;automagically&quot; handles the authentication against the IdM.<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; This first step requires pretty much an IPA setup, but<br>
&gt; &gt; &gt; &gt; &gt; works with libpam4j[1]. Now, thinking about Keycloak, I<br>
&gt; &gt; &gt; &gt; &gt; would like to have an Authenticator for PAM[2], which is pretty much our<br>
&gt; &gt; &gt; &gt; &gt; UsernamePasswordForm + PAM. Does it make sense?<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Current flow:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; * User logs into Web application with username/password<br>
&gt; &gt; &gt; &gt; &gt; * PAM authenticator collects data and authenticate against PAM<br>
&gt; &gt; &gt; &gt; &gt; * SSSD authenticates against IdM<br>
&gt; &gt; &gt; &gt; &gt; * Authentication is complete<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; After the last step, should we propagate that user to our database?<br>
&gt; &gt; &gt; &gt; &gt; Maybe, like Marek already mentioned, have a SSSDFederationProvider?<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; [1] -<br>
&gt; &gt; &gt; &gt; &gt; <a href="http://search.maven.org/#artifactdetails%7Corg.abstractj%7Clibpam4j%7C1.9.0%7Cjar" rel="noreferrer" target="_blank">http://search.maven.org/#artifactdetails%7Corg.abstractj%7Clibpam4j%7C1.9.0%7Cjar</a><br>
&gt; &gt; &gt; &gt; &gt; [2] - <a href="https://keycloak.gitbooks.io/server-developer-guide/content/topics/auth-spi.html" rel="noreferrer" target="_blank">https://keycloak.gitbooks.io/server-developer-guide/content/topics/auth-spi.html</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Simo brought up a concern after forwarding this to our internal identity<br>
&gt; &gt; &gt; &gt; team list. His comment is:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;  &gt;<br>
&gt; &gt; &gt; &gt;  &gt; Current flow:<br>
&gt; &gt; &gt; &gt;  &gt;<br>
&gt; &gt; &gt; &gt;  &gt; * User logs into Web application with username/password<br>
&gt; &gt; &gt; &gt;  &gt; * PAM authenticator collects data and authenticate against PAM<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I am worried about how these 2 steps are expressed, it seem to imply PAM<br>
&gt; &gt; &gt; &gt; is used only as a username/password verifier.<br>
&gt; &gt; &gt; &gt; There is no mention/awarness of PAM conversations where we can prompt<br>
&gt; &gt; &gt; &gt; for things like second factors or password changes.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Ok, I&#39;ve spent maybe 20 seconds googling into what PAM conversations are<br>
&gt; &gt; &gt; &quot;PAM example conversation code&quot;.   You&#39;ll have to explain to me why PAM<br>
&gt; &gt; &gt; conversations have any relevance to web login.  Just looking at this<br>
&gt; &gt; &gt; example:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; <a href="https://www.freebsd.org/doc/en_US.ISO8859-1/articles/pam/pam-sample-conv.html" rel="noreferrer" target="_blank">https://www.freebsd.org/doc/en_US.ISO8859-1/articles/pam/pam-sample-conv.html</a><br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; It looks as if PAM conversations are targeted to simple text logins<br>
&gt; &gt; &gt; (i.e. SSH, telnet, etc.).  Pushing and pulling text to and from stdin<br>
&gt; &gt; &gt; and stdout.  What does that have to do with web login?<br>
&gt; &gt;<br>
&gt; &gt; Your question is totally fair. And the reason why we have to integrate<br>
&gt; &gt; with PAM is pretty much because there&#39;s no DBus interface for SSSD<br>
&gt; &gt; to provide username/password. Otherwise we would just communicate<br>
&gt; &gt; directly with DBus and call it a day.<br>
&gt; &gt;<br>
&gt;<br>
&gt; This is solely to allow keycloak to update passwords?  Not really<br>
&gt; understanding here.<br>
<br>
</div></div>Not really Bill, to give you more context. Login through PAM is just one<br>
of the scenarios described by Dmitri at slide #19[1].<br>
<br>
* User starts browser and connects to a resource<br>
<span class="">* Resource redirects to Keycloak<br>
* User is presented with a login form<br>
* User fills username and password<br>
* User data is collected and passed to SSSD over D-Bus<br>
<br>
</span>Here, we can&#39;t provide username/password to SSSD, because we don&#39;t have<br>
a DBus interface for it. So instead, we make use of PAM to make it happen.<br></blockquote><div><br></div><div>Isn&#39;t the flow actually:</div><div><br></div><div>* User starts browser and connects to a resource<br><span class="">* Resource redirects to Keycloak<br>* User is presented with a login form<br>* User fills username and password</span></div><div><span class="">* Username and password is verified through PAM (in the future SSSD once that becomes available) - this should be a custom authenticator<br>* User profile is retrieved from SSSD over D-Bus - this should be a custom user federation provider</span><br></div><div><span class="">* Done</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><br>
* SSSD authenticates against AD<br>
</span>* Authentication complete (against FreeIPA)<br>
<br>
This is where I need some help to define what would be the best next<br>
step for us.<br>
<span class=""><br>
* Assertion/token is issued<br>
* User is redirected to the resource<br>
<br>
</span>In this scenario nothing is stored/updated on Keycloak.<br>
<span class=""><br>
&gt;<br>
&gt; &gt; The goal is pretty much to be used for Basic Authentication.<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; As for PAM itself, it looks like it is a library.  (again a 20 second<br>
&gt; &gt;<br>
&gt; &gt; It&#39;s pretty much a low level authentication module to support multiple<br>
&gt; &gt; schemes like: login, ftp, ssh, telnet...(you certainly found it already)<br>
&gt; &gt;<br>
&gt; &gt; &gt; Google search).  What I don&#39;t know is where PAM ends and SSSD takes<br>
&gt; &gt; &gt; over.  So its hard to give you advice.<br>
&gt; &gt;<br>
&gt; &gt; This is how it happens from my understanding:<br>
&gt; &gt;<br>
&gt; &gt; 1. We start the PAM conversation from our client application (a IPA client machine),<br>
&gt; &gt; pam_sss is contacted (SSSD)<br>
&gt; &gt; 2. SSSD&#39;s PAM responder receives the authentication request and forwards<br>
&gt; &gt; it to FreeIPA server<br>
&gt; &gt; 3. FreeIPA server process the request and returns the result back to PAM<br>
&gt; &gt; responder.<br>
&gt; &gt;<br>
&gt; &gt; The data flow is better described here (<a href="https://fedorahosted.org/sssd/wiki/InternalsDocs#a3.2.2.2.DataFlowPAMResponder" rel="noreferrer" target="_blank">https://fedorahosted.org/sssd/wiki/InternalsDocs#a3.2.2.2.DataFlowPAMResponder</a>).<br>
&gt; &gt;<br>
&gt;<br>
&gt; It looks like a conversation requires some sort of session object or session<br>
&gt; connection.  Remember, a web login can span multiple requests and could<br>
&gt; possibly be serviced on different machines.  Sounds like any integration<br>
&gt; with PAM is going to be quite limited.  Maybe that&#39;s what you are getting<br>
&gt; at?<br>
<br>
</span>I fully understand that, certainly something that requires more testing<br>
to see how SSSD will behave with PAM.<br>
<span class=""><br>
&gt;<br>
&gt; Or are you just talking about writing a client adapter and this has nothing<br>
&gt; to do with the Keycloak auth server?<br>
<br>
</span>Good question. My initial naive idea was to have an authenticator SPI<br>
for PAM and benefit from the work already done by Marek with LDAP and<br>
Kerberos. Plus, have a federation SPI to retrieve user&#39;s data from SSSD<br>
and propagate it to Keycloak.<br>
<span class=""><br>
&gt;<br>
&gt; Also, where does the identity data come into play (aka LDAP info)?  Is this<br>
&gt; also a part of the PAM/SSSD flow?<br>
<br>
</span>At the flow described here#17[2]:<br>
<br>
* User starts browser and connects to a resource<br>
<span class="">* Resource redirects to Keycloak<br>
* User is presented with a login form<br>
* User fills username and password<br>
* User data is collected and passed to SSSD over D-Bus<br>
</span>* SSSD authenticates against LDAP server<br>
<span class="">* Authentication complete<br>
* Assertion/token is issued<br>
* User is redirected to the resource<br>
<br>
&gt;<br>
</span>&gt; Bill<br>
<br>
[1] - <a href="https://docs.google.com/presentation/d/1-WvQTQ1M0Q9kfRl3d7FVWFn9GLL7vn8sAQmXGv0SVcs/edit#slide=id.g113bf6b186_1_130" rel="noreferrer" target="_blank">https://docs.google.com/presentation/d/1-WvQTQ1M0Q9kfRl3d7FVWFn9GLL7vn8sAQmXGv0SVcs/edit#slide=id.g113bf6b186_1_130</a><br>
[2] - <a href="https://docs.google.com/presentation/d/1-WvQTQ1M0Q9kfRl3d7FVWFn9GLL7vn8sAQmXGv0SVcs/edit#slide=id.g113bf6b186_1_107" rel="noreferrer" target="_blank">https://docs.google.com/presentation/d/1-WvQTQ1M0Q9kfRl3d7FVWFn9GLL7vn8sAQmXGv0SVcs/edit#slide=id.g113bf6b186_1_107</a><br>
--<br>
<br>
abstractj<br>
PGP: 0x84DC9914<br>
<div class=""><div class="h5">_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
</div></div></blockquote></div><br></div></div>