Skip to content

Commit

Permalink
only verify LDAP upndomain if set (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDaveD authored and tyrannosaurus-becks committed May 21, 2020
1 parent 17e44b9 commit 2e60c14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ func (b *backend) pathLoginUpdate(ctx context.Context, req *logical.Request, d *
b.Logger().Debug(fmt.Sprintf("identity: %+v", identity))
username = identity.UserName()

// Verify that the realm on the LDAP config is the same as the identity's
// Verify that the realm on the LDAP config (if set) is the same as the identity's
// realm. The UPNDomain denotes the realm on the LDAP config, and the identity
// domain likewise identifies the realm. This is a case sensitive check.
// This covers an edge case where, potentially, there has been drift between the LDAP
// config's realm and the Kerberos realm. In such a case, it prevents a user from
// passing Kerberos authentication, and then extracting group membership, and
// therefore policies, from a separate directory.
if identity.Domain() != ldapCfg.ConfigEntry.UPNDomain {
if ldapCfg.ConfigEntry.UPNDomain != "" && identity.Domain() != ldapCfg.ConfigEntry.UPNDomain {
w.WriteHeader(400)
_, _ = w.Write([]byte(fmt.Sprintf("identity domain of %q doesn't match LDAP upndomain of %q", identity.Domain(), ldapCfg.ConfigEntry.UPNDomain)))
return
Expand Down

0 comments on commit 2e60c14

Please sign in to comment.