Active Directory on Linux
Join a RHEL 9 or Ubuntu 24.04 host to Active Directory with SSSD and InfoPipe, sign in with Kerberos and assign a guardrail profile to an AD group.
This guide joins a Linux host to Active Directory, shows what DefenseClaw records for an AD user, and assigns a guardrail profile to an AD group. DefenseClaw needs nothing from AD beyond a normal domain join. What it reads, and how far each fact can be trusted, is in How DefenseClaw knows who a user is.
Before you start
| You need | Example in this guide |
|---|---|
| RHEL 9 or Ubuntu 24.04 with root access | host.corp.example.com |
| An AD domain and an account that may join computers | CORP.EXAMPLE.COM, administrator |
| An AD user and group | alice, contractors@corp.example.com |
| DefenseClaw: a per-user install or the standalone enterprise package | Quickstart, Install on Linux |
Join the host and check it
Join the host with SSSD
Install the packages:
sudo dnf install realmd sssd sssd-tools sssd-dbus sssd-kcm adcli samba-common-tools krb5-workstation oddjob oddjob-mkhomedirsudo apt-get install realmd sssd-ad sssd-tools sssd-dbus sssd-kcm libnss-sss libpam-sss adcli krb5-user
sudo pam-auth-update --enable mkhomedir
sudo hostnamectl set-hostname host.corp.example.com
sudo grep -qxF 'includedir /etc/krb5.conf.d/' /etc/krb5.conf || sudo sed -i '1i includedir /etc/krb5.conf.d/' /etc/krb5.confkrb5-userasks for the default Kerberos realm; enterCORP.EXAMPLE.COM.- Set the FQDN before
realm join, so the keytab containshost/host.corp.example.com. mkhomedircreates an AD user's home at first sign-in.- The
includedirline loads SSSD'slocalauthplugin. Without it a GSSAPI sign-in maps the ticket toaliceinstead ofalice@corp.example.com, and SSH denies the login.
Join the domain and allow the user:
sudo realm discover corp.example.com
sudo realm join --membership-software=adcli --client-software=sssd -U administrator corp.example.com
sudo realm permit alice@corp.example.comOn Ubuntu, also turn on GSSAPI in OpenSSH:
printf 'GSSAPIAuthentication yes\n' | sudo tee /etc/ssh/sshd_config.d/50-gssapi.conf
sudo sshd -t
sudo systemctl reload sshTurn on InfoPipe
The standalone enterprise guardian reads the UPN through SSSD's InfoPipe D-Bus service, as root. Add it to /etc/sssd/sssd.conf:
[sssd]
services = ifp
[ifp]
user_attributes = +userPrincipalName| OS | services line |
|---|---|
| RHEL 9 | services = nss, pam, ifp |
| Ubuntu 24.04 | services = ifp only. The NSS and PAM responders are socket activated; listing them makes their sockets fail |
If InfoPipe returns no userPrincipalName, also add ldap_user_extra_attrs = userPrincipalName to the [domain/...] section. realm join sets use_fully_qualified_names = True, which these docs assume.
Restart SSSD and check it answers
sudo sss_cache -E
sudo systemctl restart sssd
systemctl is-system-running
getent passwd alice@corp.example.com
id alice@corp.example.com
realm list
sudo dbus-send --system --print-reply --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe org.freedesktop.sssd.infopipe.GetUserAttr string:alice@corp.example.com array:string:userPrincipalName| Command | Expected |
|---|---|
systemctl is-system-running | running. If degraded, read systemctl --failed first |
getent, id | The user and the groups |
realm list | The domain with server-software: active-directory. The directory type comes from it, on per-user installs too |
dbus-send | The UPN. Run it as root: InfoPipe answers root only, and a standard user gets AuthFailed: Permission denied. Do not loosen InfoPipe's permissions |
Note the group spelling id -Gn prints, such as ml-team@corp.example.com. A groups assignment uses that name.
Sign in with a Kerberos ticket and run an agent
From a client with a ticket, sign in with GSSAPI. ssh -K delegates the ticket, which needs a forwardable one:
kinit -f alice@CORP.EXAMPLE.COM
ssh -K alice@corp.example.com@host.corp.example.comOn the host, run an agent such as Claude Code or Codex for one prompt, then read what DefenseClaw recorded. On a per-user install:
defenseclaw audit export --since 10m \
| jq -c 'select(.action=="hook_decision") | .structured
| {user: ."defenseclaw.user.name", domain: ."defenseclaw.user.domain",
directory: ."defenseclaw.user.directory", source: ."defenseclaw.user.identity.source",
principal: ."defenseclaw.user.principal",
kerberos_principal: ."defenseclaw.session.kerberos_principal",
assurance: ."defenseclaw.user.principal.assurance", session: ."defenseclaw.session.kind",
agent: ."defenseclaw.agent.identity.id"}' | sort -uOn a managed host, export through the installed gateway as root:
sudo /opt/defenseclaw/bin/defenseclaw-gateway audit export --since 10m \
| jq -c 'select(.action=="hook_decision") | .structured'| Field | Per-user | Standalone enterprise |
|---|---|---|
domain | corp.example.com | corp.example.com |
directory | active_directory | active_directory |
source | sssd | sssd_infopipe |
assurance | verified | verified |
session | ssh | ssh |
principal, kerberos_principal | null until you turn on ai_discovery.include_user_principal | The same |
See Turn off the principal or the IDE inventory for that setting.
Assign a guardrail profile to an AD group
Define a profile, assign it to the group, then ask the gateway who gets it.
guardrail:
mode: observe
profiles:
contractors:
mode: action
block_at: MEDIUM
profile_assignments:
- profile: contractors
match: {groups: ["contractors@corp.example.com"]}
default_profile: "" # "" keeps the global guardrail.* behaviourdefenseclaw config validate
defenseclaw guardrail profile list
defenseclaw guardrail profile explain --user bob@corp.example.com --connector codex # as bob user: bob@CORP.EXAMPLE.COM (2 group(s))
profile: contractors
match: group (contractors@corp.example.com)
digest: sha256:4f460f32fe21aa052aa524027ba08c9f89fe695cbe39cea2fb0252e5e0a738bd
applies (codex): mode=action block_at=MEDIUM alert_at=pack hilt=off rule_pack=...How to spell the group:
name@domainandDOMAIN\nameare one group when the user's verified facts nameCORPandcorp.example.comas their own domain.- One AD group is one selector on every OS.
contractors@corp.example.com,CORP\contractorsandcorp.example.com\contractorsselect the same group on Linux (SSSD), macOS and Windows, case-insensitively. - On Linux, use the name
id -Gnprints, or itsDOMAIN\nameform. On Windows, also the bare name or the SID. - Only the user's own domain pairs its NetBIOS and DNS names. A group of another domain never matches, and a group of a trusted domain matches only the spelling the host lists.
- Users of a child domain match
usersassignments only when you list their domain inai_discovery.trusted_ad_child_domains(Child domains of the joined realm).
To write the macOS and Windows spelling in YAML, use single quotes:
match: {groups: ['CORP\contractors']}On a managed host, deliver the profiles in the machine config and check them with enterprise <os> profile-explain. Precedence, worked scenarios, the audit record and delivery to managed hosts are in User- and group-based policies.
Check it worked
profile explainshowsmatch: groupwith your group name.defaultmeans no assignment matched.- Check any user, on any install, with the commands in Check what DefenseClaw knows about a user.
- A group change takes SSSD's cache time plus up to 15 minutes in the gateway. Refresh every account now applies it at once on a managed host.
If something does not answer as expected, see Troubleshooting: Identity.
Next steps
User- and group-based policies
Profile keys, precedence, the audit record and delivery to managed hosts.
How DefenseClaw knows who a user is
What Linux tells DefenseClaw about an SSSD account, and the limits.
Identity and authentication
Supported identity types, agent identity, checks and troubleshooting.
How DefenseClaw knows who a user is
See how DefenseClaw learns who ran an agent from the operating system alone on Linux, Windows and macOS, what is verified or claimed, and the limits.
Okta on Linux
Read Okta users and groups on Linux through the Okta LDAP Interface and SSSD, choose guardrail profiles by Okta group and troubleshoot the setup.