CubeCoders / AMP

Issue tracking and documentation for AMP
https://cubecoders.com/AMP
207 stars 38 forks source link

AMP LDAP accounts using sAMAccountName instead of distinguishedName - Authentication Fails #979

Open DollarStoreCPU opened 9 months ago

DollarStoreCPU commented 9 months ago

Bug Report

System Information

I confirm:

Symptoms

Reproduction

  1. Set up an LDAP server. I set up an Authentik LDAP outpost per Cooptonian's Youtube guide
  2. Create an LDAP user and confirm the following 3 attributes exist and contain values: I will use IcanHazCheesburgr as my example: a. sAMAccountName: IcanHazCheesburgr b. distinguishedName: cn=IcanHazCheesburgr,ou=users,dc=ldap,dc=goauthentik,dc=io c. memberOf: cn=AMP_Users,ou=groups,dc=ldap,dc=goauthentik,dc=io
  3. Configure AMP's LDAP section as follows:
################################
# Login
################################
Login.UseAuthServer=False
# Login.AuthServerURL - The URL for the ADS instance providing authentication when using UseAuthServer
Login.AuthServerURL=http://localhost:8080/
Login.MetricsServerPort=12820
Login.UseLDAPLogins=True
Login.UseLDAP3=True
Login.AllowLocalUsersWithLDAP=False
Login.LDAPAuthDomain=ldap.goauthentik.io
Login.LDAP3Host=ldap.goauthentik.io
Login.LDAP3FilterDN=OU=users,DC=ldap,DC=goauthentik,DC=io
Login.LDAP3UserDN=cn=ldapservice,ou=users,dc=ldap,dc=goauthentik,dc=io
Login.LDAPGroupPrefix=AMP_
Login.LDAPUserDomain=ldap.goauthentik.io
Login.LDAP3UsesSSL=False
Login.LDAPADPre2000=False
Login.LDAPStripDomainFromFilter=False
Login.LDAPQueryUsername=ldapservice
Login.LDAPQueryPassword=[redacted]
  1. Wireshark the traffic going out of the AMP server.
  2. Log into AMP Instance using an LDAP based account. I will use the same IcanHazCheesburgr account as previously described
  3. Observe the following steps occur: a. The ldapservice account successfully binds to the LDAP server and performs the following ldap search (&(objectClass=user)(sAMAccountName=IcanHazCheesBurgr)) b. AMP tries to bind to the LDAP server using the sAMAccountName and fails, yielding an Insufficient Access (50) error. image
DollarStoreCPU commented 9 months ago

What could help increase compatibility with multiple LDAP implementations while fixing this issue would be to add the ability to specify the user and group attributes in the config file