Skip to content

Instantly share code, notes, and snippets.

@yumenohikari
yumenohikari / README.md
Last active June 11, 2024 07:31
Active Directory LDAP auth for Home Assistant

Active Directory LDAP auth for Home Assistant

This script allows users to log in to Home Assistant using their sAMAccountName or userPrincipalName identifiers without any special requirements for the ldapsearch or curl utilities. Instead, it requires the ldap3 Python module, but there are ways to install that locally so it can even be used in supervised / Home Assistant OS installs.

Editing for use in your installation

Obviously most of the configuration values in the script need to be edited to work in your environment.

  • SERVER - the DNS name of your AD domain, or the name or IP of a specific domain controller.
  • HELPERDN - the DN (distinguishedName attribute) of the service account you're using to search LDAP for the desired user.
  • HELPERPASS - the password for that service account.