# Active Directory setup ADconsole needs three things from your directory: a **service account** to bind with, an **encrypted channel** (LDAPS/STARTTLS), and a **login group** whose members may use the panel. What the panel can actually *change* is governed entirely by AD delegation on that service account — grant only what you need. ## 1. Service account Create a dedicated account, e.g. `svc-adconsole`: - Password never expires, **cannot** change password, not a member of any privileged group by default. - Deny interactive/RDP logon (it only needs "Access this computer from the network" to the DCs, i.e. LDAP bind). - Put its DN in `LDAP_USERNAME` and its password in `LDAP_PASSWORD`. Test the bind: ```sh php artisan tinker >>> \LdapRecord\Container::getConnection('default')->connect(); // no exception = OK ``` ## 2. Encrypted transport (LDAPS / STARTTLS) AD refuses password writes (`unicodePwd`) and other sensitive changes over an unencrypted connection, so this is mandatory for anything beyond read-only use. - **LDAPS (recommended):** ensure the DCs have a certificate with Server Authentication EKU (AD CS "Domain Controller" / "Kerberos Authentication" template auto-enrols this). Set `LDAP_SSL=true`, `LDAP_PORT=636`. - **STARTTLS:** `LDAP_TLS=true`, `LDAP_PORT=389`. - If the app host does **not** trust the issuing CA, set `LDAP_TLS_VERIFY=false` (skips chain validation — acceptable on a trusted network, not ideal). To verify instead, install the internal root CA in the app host's trust store (`/etc/ssl/certs`, `update-ca-certificates`) and set `LDAP_TLS_VERIFY=true`. Quick check from the app host: ```sh openssl s_client -connect dc01.corp.example.com:636 -showcerts ` and read `gPLink` on OUs (default for Authenticated Users). No write is ever attempted. | Example — password reset + unlock + enable/disable on one OU: ```powershell dsacls "OU=Staff,DC=corp,DC=example,DC=com" /I:S ` /G "CORP\svc-adconsole:CA;Reset Password;user" ` "CORP\svc-adconsole:WP;lockoutTime;user" ` "CORP\svc-adconsole:WP;userAccountControl;user" ` "CORP\svc-adconsole:WP;pwdLastSet;user" ``` ## 6. Verify 1. Sign in as a member of `AD_LOGIN_GROUP`. 2. Open **Users** — the list and OU tree populate. 3. Open a test account → **Reset password** → set a value → confirm on a real logon. A failure here almost always means "no encrypted channel" or "Reset Password right not delegated". 4. Repeat for the other features you delegated. See [troubleshooting.md](troubleshooting.md) for specific errors.