<div dir="ltr"><div><div>Hi,<br><br>Addendum:</div><div><br>> 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>> - not all my users may have an ssh key (some never use ssh)<br>><br>> 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'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>"sss_ssh_authorizedkeys", then ppolicy will be checked and<br></div><div>updated if necessary through the "login / password" process.<br></div><div><br>May be that could help : with a given flag "sss_ssh_authorizedkeys"<br>could simply refuse to return the key in case of a "ppolicy issue".<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"><<a href="mailto:ldap@guillard.nom.fr" target="_blank">ldap@guillard.nom.fr</a>></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 "loging/password" and therefore check for<br>ppolicy situation before granting access.<br></div></div><div><br></div><div>aka :<br>- if the account is 'ppolicy desactivated', ssh would refuse to<br> provide the session <br><br></div><div>- if the password is "ppolicy oudated", then ssh would warn to<br> change it (and decrease 'pwdGraceAuthnLimit<i>'</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> 'ldap_default_bind_dn' as a binding user) and if there is an issue<br> return a "ppolicy error message" rather than the user ssh key ?<br><br>These are just some thoughts.<br><br></div><div>I'm currently exploring the first option (but I'm not a 'pam' expert and<br>I'm even not sure that the ssh authentication process goes through<br></div><div>pam if a valid key is found, even with 'UsePAM yes').<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>