|
| 1 | +AD LDAP auth |
| 2 | +=== |
| 3 | + |
| 4 | + |
| 5 | +To setup your CodiMD instance with Active Directory you need the following configs: |
| 6 | + |
| 7 | +``` |
| 8 | +CMD_LDAP_URL=ldap://internal.example.com |
| 9 | +CMD_LDAP_BINDDN=cn=binduser,cn=Users,dc=internal,dc=example,dc=com |
| 10 | +CMD_LDAP_BINDCREDENTIALS=<super secret password> |
| 11 | +CMD_LDAP_SEARCHBASE=dc=internal,dc=example,dc=com |
| 12 | +CMD_LDAP_SEARCHFILTER=(&(objectcategory=person)(objectclass=user)(|(sAMAccountName={{username}})(mail={{username}}))) |
| 13 | +CMD_LDAP_USERIDFIELD=sAMAccountName |
| 14 | +CMD_LDAP_PROVIDERNAME=Example Inc AD |
| 15 | +``` |
| 16 | + |
| 17 | + |
| 18 | +`CMD_LDAP_BINDDN` is either the `distinguishedName` or the `userPrincipalName`. *This can cause "username/password is invalid" when either this value or the password from `CMD_LDAP_BINDCREDENTIALS` are incorrect.* |
| 19 | + |
| 20 | +`CMD_LDAP_SEARCHFILTER` matches on all users and uses either the email address or the `sAMAccountName` (usually the login name you also use to login to Windows). |
| 21 | + |
| 22 | +*Only using `sAMAccountName` looks like this:* `(&(objectcategory=person)(objectclass=user)(sAMAccountName={{username}}))` |
| 23 | + |
| 24 | +`CMD_LDAP_USERIDFIELD` says we want to use `sAMAccountName` as unique identifier for the account itself. |
| 25 | + |
| 26 | +`CMD_LDAP_PROVIDERNAME` just the name written above the username and password field on the login page. |
| 27 | + |
| 28 | + |
| 29 | +Same in json: |
| 30 | + |
| 31 | +```json |
| 32 | +"ldap": { |
| 33 | + "url": "ldap://internal.example.com", |
| 34 | + "bindDn": "cn=binduser,cn=Users,dc=internal,dc=example,dc=com", |
| 35 | + "bindCredentials": "<super secret password>", |
| 36 | + "searchBase": "dc=internal,dc=example,dc=com", |
| 37 | + "searchFilter": "(&(objectcategory=person)(objectclass=user)(|(sAMAccountName={{username}})(mail={{username}})))", |
| 38 | + "useridField": "sAMAccountName", |
| 39 | +}, |
| 40 | +``` |
| 41 | + |
| 42 | +More details and example: https://www.npmjs.com/package/passport-ldapauth |
0 commit comments