wrong number of arguments for ldap
Closed this issue · 7 comments
I am attempting LDAP configuration.
My config looks similar to this one.
reauth {
path /
ldap {"host":"ldap.jumpcloud.com","port":636,"ldaps":true,"tls":false,"timeout":"5s","bindUsername":"xxx","bindPassword":"xxx","base":"ou=Users,o=xxx,dc=jumpcloud,dc=com","filter":"(&(objectClass=inetOrgPerson)(uid=%s))"}
}
When validating the config, I get:
# caddy -validate -conf /etc/caddy/Caddyfile
2019/11/11 09:47:56 wrong number of arguments for ldap: [{"host":"ldap.jumpcloud.com" ...
Hi
Configuration doesn't support json, sorry.
Try
reauth {
path /
ldap url=ldaps:///ldap.jumpcloud.com:636,timeout=5s,username =xxx,password=xxx,base="ou=Users,o=xxx,dc=jumpcloud,dc=com",filter="(&(objectClass=inetOrgPerson)(uid=%s))"
}
@freman , is the ///
intentional or it is //
? Any other way representing the config? it is a very long line :-)
@freman , I have the following filter. The wrong number of arguments
errors stems from that:
filter="(&(CN=My Web Managers,OU=Groups,DC=CONTOSO,DC=COM)(objectClass=user)(|(sAMAccountName=%s)(mail=%s)))"
Nope, that extra slash was a side effect of phone editing.
Try using %[1]s instead of %s in both locations
Try using %[1]s instead of %s in both locations
I did that.
This filter passed:
filter="(&(objectClass=user)(|(sAMAccountName=%[1]s)(mail=%[1]s)))"
This one too (3 conditions):
filter="(&(objectClass=person)(objectClass=user)(|(sAMAccountName=%[1]s)(mail=%[1]s)))"
However, this one did not:
filter="(&(CN=My Admins,OU=Groups,DC=CONTOSO,DC=COM)(objectClass=user)(|(sAMAccountName=%[1]s)(mail=%[1]s)))"
Then, I removed whitespaces from CN. It worked:
filter="(&(CN=MyAdmins,OU=Groups,DC=CONTOSO,DC=COM)(objectClass=user)(|(sAMAccountName=%[1]s)(mail=%[1]s)))"
It looks like there is an issue when passing CN
and the CN
has whitespaces.
No need for PR. I guess I should try escaping \u0020
.