Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pam_ussh.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,16 @@ func authenticate(w io.Writer, uid int, username, ca string, principals map[stri
continue
}

if err := c.CheckCert(username, cert); err != nil {
// If a manual set of principals is provided, don't require
// the username to be in the certificate's principals
// Principals are verified at the end of this function
testedPrincipal := username
if len(principals) > 0 && len(cert.ValidPrincipals) > 0 {
testedPrincipal = cert.ValidPrincipals[0]
}

if err := c.CheckCert(testedPrincipal, cert); err != nil {
pamLog("Error validating cert: %v\n", err)
continue
}

Expand Down