Hi, first of: my familiarity with OpenSSH/Pam code-base is very limited.. Please excuse me if some of this does not make any sense or seems stupid! I'm investigating if it is possible for a PAM module to find out which public key was accepted (when 'AuthenticationMethods publickey,keyboard-interactive' is used). From my digging in the source, it seems it is currently not. Would it be possible to provide this information? Maybe using do_pam_putenv()? Would there be any security implications of doing this? The reason I'm asking is that I'm looking into using 2FA (i.e. pubkey + pam_google_authenticator) for *some* of my SSH keys. For example, a SSH privkey on my trusted box can login without verification code, but another SSH privkey on my not-as-trusted box requires a verification code to login. My initial thought was to implemented it through a pubkey whitelist in the specific PAM module, but other solutions might also be possible. Maybe a PAM module configured as "sufficient", which looks in a pubkey whitelist and accepts immediately, skipping any further PAM modules would work. Thanks for any feedback! Regards Johan (who is not on the list and appreciates a direct CC!)
On Thu, 18 Feb 2016, Johan Str?m wrote:> Hi, > > first of: my familiarity with OpenSSH/Pam code-base is very limited.. Please > excuse me if some of this does not make any sense or seems stupid! > > I'm investigating if it is possible for a PAM module to find out which public > key was accepted (when 'AuthenticationMethods publickey,keyboard-interactive' > is used). From my digging in the source, it seems it is currently not. > > Would it be possible to provide this information? Maybe using do_pam_putenv()? > Would there be any security implications of doing this?There is an open bug about this. I do hope to make the public keys used during authentication available in the environment (and to PAM), but it won't happen until 7.3 at the earliest. -d
On 19/02/16 00:27, Damien Miller wrote:> On Thu, 18 Feb 2016, Johan Str?m wrote: > >> Hi, >> >> first of: my familiarity with OpenSSH/Pam code-base is very limited.. Please >> excuse me if some of this does not make any sense or seems stupid! >> >> I'm investigating if it is possible for a PAM module to find out which public >> key was accepted (when 'AuthenticationMethods publickey,keyboard-interactive' >> is used). From my digging in the source, it seems it is currently not. >> >> Would it be possible to provide this information? Maybe using do_pam_putenv()? >> Would there be any security implications of doing this? > There is an open bug about this. I do hope to make the public keys used during > authentication available in the environment (and to PAM), but it won't happen > until 7.3 at the earliest.Ah, great! I also got an off-list message from Damien, the author of said bug: https://bugzilla.mindrot.org/show_bug.cgi?id=2408 I've added my +1 on the ticket to express my interest, hoping it attracts some interest!
Possibly Parallel Threads
- chaining AUTH methods -- adding GoogleAuthenticator 2nd Factor to pubkey auth? can't get the GA prompt :-/
- chaining AUTH methods -- adding GoogleAuthenticator 2nd Factor to pubkey auth? can't get the GA prompt :-/
- pubkey fingerprint and krb princ name in environment
- chaining AUTH methods -- adding GoogleAuthenticator 2nd Factor to pubkey auth? can't get the GA prompt :-/
- [PATCH] Set KRB5PRINCIPAL in user environment