<div dir="ltr"><div><div>Hi,<br><br>Addendum:</div><div><br>&gt; My current policy is the following :<br></div><div>&gt;<br></div><div>&gt; - All my users must have a password in ldap (that is used by<br>&gt;  applications other than ssh)<br></div><div>&gt;<br></div>&gt; - not all my users may have an ssh key (some never use ssh)<br>&gt;<br>&gt; Everything works as I want.<br><br></div><div>I realize that with my tuning ssh behave as such:<br><br></div><div>* if the user has no key in ldap then ssh ask for a login password<br><br>*  if the user has a correct key in ldap then ssh grant access and<br>   don&#39;t ask for any login/password<br><br>*   if the user has an incorrect key in ldap then ssh swithch to the<br>   login/password authentication process.<br><br></div><div>That means that if a bad sshkey is returned by<br>&quot;sss_ssh_authorizedkeys&quot;, then ppolicy will be checked and<br></div><div>updated if necessary through the &quot;login / password&quot; process.<br></div><div><br>May be that could help : with a given flag &quot;sss_ssh_authorizedkeys&quot;<br>could simply refuse to return the key in case of a &quot;ppolicy issue&quot;.<br><br></div><div>--<br></div><div>Olivier<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-15 12:10 GMT+02:00 Olivier <span dir="ltr">&lt;<a href="mailto:ldap@guillard.nom.fr" target="_blank">ldap@guillard.nom.fr</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi everyone,<br><br></div>I saw couple of discussion around in this list as well as others<br>about how to exploit ppolicy with ssh : here are some thought.<br></div><div><br></div><div>Currently, I am in a situation where I have inserted my users<br></div><div>public ssh keys in ldap (openssh-ldappubkey shema) and<br></div><div>instructed sshd to consult ldap for ssh public keys, adding in<br>ssh_config :<br><br>AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys<br><br><div>I also have authorized password authentication , in ssh_config:<br></div><br>PasswordAuthentication yes<br><br></div><div>My current policy is the following :<br></div><div><br></div><div>- All my users must have a password in ldap (that is used by<br>   applications other than ssh)<br></div><div><br></div><div>- not all my users may have an ssh key (some never use ssh)<br><br></div><div>Everything works as I want.<br></div><div><br>I now want to introduce ppolicy overlay and would like to enforce<br>rules for password management even for users that mainly use<br>ssh keys.<br></div><div><br></div><div>Practically and basically : when a user with valid ssh key ask for<br>an ssh connexion, I would like ssh to behave exactly as if this user<br>had typed a correct &quot;loging/password&quot;  and therefore check for<br>ppolicy situation before granting access.<br></div></div><div><br></div><div>aka :<br>- if the account is &#39;ppolicy desactivated&#39;, ssh would refuse to<br>   provide the session <br><br></div><div>- if the password is &quot;ppolicy oudated&quot;, then ssh would warn to<br>  change it (and decrease &#39;pwdGraceAuthnLimit<i>&#39;</i>?)<br></div><div><br></div><div>... and so on.<br><br></div><div>I thought about two options/alternatives to do that :<br><br></div><div>* try to tune pam (may be there would be a way to tell pam to check<br>   for user ppolicy fields once authentication has been done before<br></div><div>   granting access ?)<br><br></div><div>* add some sort of flag (aka: --ppolicy) to sss_ssh_authorizedkeys<br></div><div>   to instruct sss_ssh_authorizedkeys to check for user ppolicy (use<br>   &#39;ldap_default_bind_dn&#39; as a binding user) and if there is an issue<br>    return a &quot;ppolicy error message&quot; rather than  the user ssh key ?<br><br>These are just some thoughts.<br><br></div><div>I&#39;m currently exploring the first option (but I&#39;m not a &#39;pam&#39; expert and<br>I&#39;m even not sure that the ssh authentication process goes through<br></div><div>pam if a valid key is found, even with &#39;UsePAM yes&#39;).<br></div><div><br></div><div>I would appreciate any guidance, advices or experiences from you<br>on that particular issue.<br></div><div><br></div><div>Thank you,<br><br>--<br></div><div>Olivier<br></div><div><br></div></div>
</blockquote></div><br></div></div>