<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>