Skip to content

Instantly share code, notes, and snippets.

@clutch70
clutch70 / ldap-auth.py
Created October 4, 2022 22:27 — forked from rechner/ldap-auth.py
LDAP Auth script for HomeAssistant
import os
from ldap3 import Server, Connection, ALL, core
# XXX: Update these with settings apropriate to your environment:
# (I use FreeIPA and an homeassistant group assignment)
SERVER = "ipa.example.com"
USERDN = "uid={},cn=users,cn=accounts,dc=example,dc=com"
TIMEOUT = 3
BASEDN = USERDN
SCOPE = "base"