Skip to content

AD domain join (MS-CHAPv2)

Some RADIUS clients cannot send a password in a form OkYouIn can check with a simple LDAP bind. They use MS-CHAPv2, a challenge-response method: the password never travels, only a proof computed from it. Microsoft NPS (and so RD Gateway), MikroTik RouterOS administrator logins and many VPNs are in this group.

To verify an MS-CHAPv2 proof, OkYouIn needs either the password hash or someone who has it:

Account sourceHow MS-CHAPv2 is verified
Local userWorks out of the box: OkYouIn keeps the needed hash with every local password.
Active DirectoryA password hash cannot be read from AD, so OkYouIn joins the domain with its own machine account and asks a domain controller to verify.
FreeIPAFreeIPA publishes the hash in the ipaNTHash attribute; OkYouIn reads it at sign-in — no join. See below.
OpenLDAP, Google Workspace, other LDAP, Microsoft Entra IDNot supported. Use RADIUS PAP for these users.

The MS-CHAPv2 tab appears on the configuration page of an Active Directory or FreeIPA directory under Settings ▸ Integrations ▸ LDAP.

  • The configuration’s Domain Suffix (the realm, for example corp.example.com) and Short domain name (for example CORP) are set on its Users & Groups tab. The join uses them; they are never entered twice.
  • The OkYouIn server can reach a domain controller on the ports a domain member needs — 53 (DNS, including the domain’s SRV records), 88, 135 and dynamic RPC, 389 and 445/tcp — and resolves the domain through DNS.
  • The server’s clock is within five minutes of the domain controllers.
  • NTLM is not blocked on the domain controllers (“Restrict NTLM”): MS-CHAPv2 is built on it.
  • You have an account allowed to create a computer object in the target organizational unit. Domain Admin is not required.

Accounts that require a smart card have a randomised password and can never use MS-CHAPv2. Members of Protected Users cannot either.

  1. Open the Active Directory configuration and its MS-CHAPv2 tab. The Domain membership card shows Not joined to a domain.

  2. Click Join domain.

  3. Choose the account that creates the computer object:

    • Use this configuration’s account — Active Directory lets any authenticated account create a computer object in the domain’s default container, so the configuration’s bind account usually works.
    • Or turn it off and enter a Join account (CORP\user or user@corp.example.com) and its Password — required to place the object in a specific organizational unit.

    The password is used once for the join and stored nowhere; it never appears in the audit log.

  4. Optionally set the Machine account name (the name of this server’s computer object, at most 15 characters) and the Organizational unit, written as a path from the domain root: OU=Servers,OU=OkYouIn,DC=corp,DC=example,DC=com is OkYouIn/Servers. Empty = the domain’s default container.

  5. Click Join domain and wait for Member of corp.example.com.

  6. Switch on Enable MS-CHAPv2 for this directory and Save.

  7. Click Run checks. Each line must turn green: settings complete, configuration delivered, the winbind service reporting and running, the machine account working, MS-CHAPv2 and the configuration switched on.

Only one Active Directory configuration can have MS-CHAPv2 enabled: one machine account means one joined forest. Switching MS-CHAPv2 off does not leave the domain — the trust stays alive and its machine password keeps rotating, so switching it back on is instant.

Domain membership is held per server: each node has its own machine account. In a cluster, MS-CHAPv2 for domain users works on a node that has joined the domain; join each node that should answer MS-CHAPv2, each with its own machine account name. The Domain membership card shows the state of the node you are looking at.

Leave domain ends this server’s membership and removes its machine account — with Keep the computer object in Active Directory if the account may not delete it (an object created through the machine-account quota usually cannot be deleted by its creator; delete it in AD afterwards). The credentials are used once and stored nowhere. Domain accounts can no longer use MS-CHAPv2 until the server joins again; the MS-CHAPv2 switch itself is not changed.

Domain membership saysWhat to do
The winbind service is not reportingThe directory-membership service of OkYouIn is not running. Check the server’s services (see Operations).
The last join failedThe card shows the domain controller’s error. Typical causes: wrong account or password, no right to create the object in that OU, quota reached, clock skew, DNS cannot find the domain controllers.
Domain trust is BROKENA machine account exists but the domain controller no longer accepts it (the computer object was deleted or reset in AD). Leave and join again.
Member of … but MS-CHAPv2 is enabled on the configuration ’…’Another AD configuration owns MS-CHAPv2. Switch it there, or switch it off there and on here.

A refused MS-CHAPv2 sign-in looks to the user like a wrong password; the RADIUS log has the real reason.

FreeIPA keeps an MS-CHAPv2-compatible hash of every password in the ipaNTHash attribute. OkYouIn verifies MS-CHAPv2 by reading it at sign-in, with the bind account the configuration already uses. Nothing is joined, the hash is read for each sign-in and never stored, and any number of FreeIPA directories can have MS-CHAPv2 on at once.

By default FreeIPA does not let any account read ipaNTHash — and it hides it by leaving it out rather than refusing, which looks exactly like a directory without the attribute. So:

  1. Open the FreeIPA configuration’s MS-CHAPv2 tab. It shows the Hash attribute, the account it is Read by, and the permission to apply on the FreeIPA server, already filled in with this configuration’s bind account and search base. Copy it and apply it on the FreeIPA server.

  2. Click Check the directory until it reports The directory allows ipaNTHash to be read — MS-CHAPv2 can be verified.

  3. Switch on Enable MS-CHAPv2 for this directory and Save.

A FreeIPA account disabled with ipa user-disable is refused on MS-CHAPv2 too.

Joining and leaving are governed by the Domain Membership RBAC section; the MS-CHAPv2 settings of a configuration by LDAP. The built-in operator model may only view both. See Console roles & RBAC.