-
Notifications
You must be signed in to change notification settings - Fork 76
Active Directory #1416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Active Directory #1416
Conversation
e027101 to
07015ac
Compare
packages/python-packages/ldap-query/ldap-query/ldap_query/main.py
Outdated
Show resolved
Hide resolved
07015ac to
ca52266
Compare
ca52266 to
ca6c308
Compare
ca6c308 to
500ec44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds Active Directory (PoC) support to the Ghaf framework, introducing a new provisioning system for user enrollment and SSSD integration for AD users.
Key Changes
- New provisioning script: Introduces
ghaf-provision, a bash-based interactive tool for system setup and user enrollment, supporting both local systemd-homed users and Active Directory users - SSSD integration: Adds a comprehensive SSSD module for Active Directory authentication, including Kerberos, LDAP, and PAM integration
- User profile reorganization: Refactors user management into separate profiles (homed users vs. AD users vs. auxiliary users) with mutual exclusivity enforcement
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/pkgs-by-name/ghaf-provision/package.nix | Package definition for the new ghaf-provision script with all required dependencies |
| packages/pkgs-by-name/ghaf-provision/ghaf-provision.sh | 1875-line bash script implementing interactive provisioning with state machine, AD join, LDAP queries, and user creation |
| packages/own-pkgs-overlay.nix | Adds ghaf-provision to the package overlay |
| modules/common/users/profiles.nix | New module defining mutually exclusive user profiles (AD vs homed) |
| modules/common/users/homed.nix | New module for systemd-homed user configuration |
| modules/common/users/ad-users.nix | New module for Active Directory user configuration |
| modules/common/users/auxiliary.nix | Refactored auxiliary user accounts (appUser, proxyUser) |
| modules/common/users/admin.nix | Adds homeSize option for admin user |
| modules/common/users/managed.nix | Updates references from loginUser to homedUser |
| modules/common/services/sssd.nix | Comprehensive 640-line SSSD service module with AD, LDAP, Kerberos, and PAM configuration |
| modules/common/services/provisioning.nix | Service definition for running ghaf-provision on first boot |
| modules/common/services/default.nix | Imports new provisioning and SSSD services |
| modules/common/security/default.nix | Removes sshkeys.nix (waypipe SSH cleanup) |
| modules/reference/profiles/mvp-user-trial.nix | Configures homed-user profile |
| modules/microvm/sysvms/guivm.nix | Updates to use new user profiles, removes waypipe SSH infrastructure |
| modules/microvm/modules.nix | Passes user profile configuration to VMs |
| modules/microvm/host/*.nix | Updates references from loginUser to homedUser, improves session detection |
| modules/microvm/common/storagevm.nix | Adjusts home image sizing for both admin and homed users, makes log persistence conditional |
| modules/microvm/common/shared-directory.nix | Removes conditional bookmark setup |
| modules/microvm/appvm.nix | Removes waypipe SSH key infrastructure |
| modules/givc/appvm.nix | Updates reference from loginUser to homedUser |
| modules/desktop/graphics/login-manager.nix | Adds SSSD library path to greeter, adds group-based access control |
| else if config.ghaf.users.homedUser.enable then | ||
| config.ghaf.users.homedUser.homeSize | ||
| else | ||
| 200000; # Default to 200 GB |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete documentation string. The description ends with "Defaults to 200 GB" but doesn't specify when this default applies. Consider clarifying: "Defaults to 200 GB if neither admin nor homed user is enabled."
| 200000; # Default to 200 GB | |
| 200000; # Defaults to 200 GB if neither admin nor homed user is enabled. |
| ]; | ||
| }; | ||
|
|
||
| # Add bookmark to skel |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The condition config.ghaf.users.loginUser.enable was removed, but this file still sets up bookmarks for all users. The change at line 48 removes the conditional check, but the comment above (line 47) still refers to it. Consider updating or removing the outdated comment.
| # Add bookmark to skel | |
| # Add bookmark to skel for all users |
| @@ -0,0 +1,64 @@ | |||
| # SPDX-FileCopyrightText: 2025-2026 TII (SSRC) and the Ghaf contributors | |||
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Inconsistent copyright year format. The header uses "2025-2026" but most other files in the Ghaf project use "2022-2025" or "2022-2026". Since this is being added in 2025, consider using "2022-2025" to match the project convention.
| # SPDX-FileCopyrightText: 2025-2026 TII (SSRC) and the Ghaf contributors | |
| # SPDX-FileCopyrightText: 2022-2026 TII (SSRC) and the Ghaf contributors |
| until [ "$state" == "active" ]; do | ||
| state=$(systemctl --user is-active xdg-desktop-portal.service --machine=${toString config.ghaf.users.loginUser.uid}@.host) | ||
| while [[ "$state" != "active" ]]; do | ||
| state=$(systemctl --user is-active session.slice --machine="$USER_ID"@.host) || true |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing validation for $USER_ID before using it in systemctl command. On line 122, $USER_ID is used to query systemctl but there's no validation that it's a valid UID. If the jq extraction fails and returns non-numeric data, this could cause systemctl to fail unexpectedly.
|
converted to draft until the new AD test setup is ready |
500ec44 to
861e34e
Compare
861e34e to
f086135
Compare
Tested on Darter Pro (new images)With homed user enabled (this PR as-is)
With AD user enabledIn
Issues
|
|
Yes. I logged in the first time with an Ethernet connection. Then disconnected the Ethernet cable, rebooted and tried to login again. It did not work, I tried entering the username and password multiple times. |
Remove unused waypipe ssh setup. Signed-off-by: Manuel Bluhm <[email protected]>
Enable log storage only if logging is enabled. This prevents leaking data from previous debug sessions where logging was disabled for privacy. Signed-off-by: Manuel Bluhm <[email protected]>
ccf0280 to
fc18162
Compare
Create user profiles: - create homed and ad profiles - re-organize file structure Add ghaf-provision script for user enrollment: - preserves local homed user creation - add local user enrollment from AD - add machine AD enrollment Add AD and SSSD integration: - AD domain configuration - initial SSSD configuration Signed-off-by: Manuel Bluhm <[email protected]>
Patch for cosmic-greeter to prompt for username if empty (e.g. no user found), and only open a session if username is available. Signed-off-by: Manuel Bluhm <[email protected]>
fc18162 to
878a298
Compare
|
Changes (+rebased):
|
|
I've tested on X1 and provisioning via AD works as intended including offline login. |
|
Tested the homed user case on Lenovo-X1
I was not able to get AD server connection working. Could not test AD user enabled case properly. Noticed that when |
|
Now inside Tampere office got connection to AD server working and AD users enrolled in ad-users.enable = true; mode. Both users, johnsmith and janedoe get enrolled automatically after typing the admin credentials.
Some users related problems found:
|
|
Talked with Milla about the confusion between users. Probably for this PR it is enough that the AD user mode works only with single user because ghaf is supposed to support only single user at a time. So if I consistently use only single user (johnsmith) login and terminal username are working fine both online and offline (after first login). Removing the bug label. |
|
And in homed-user.enable = true; mode enrolling an AD user to homed still works. |
Description of Changes
Add AD enrollment for systemd-homed, and initial support for AD users managed with SSSD.
Ghaf docs come with a separate PR.
Functionality
AD configuration
The AD domains options are defined in
modules/common/users/active-directory.nix, and the test domain defined inmodules/common/users/ad-users.nix. This should move to a provisioning file when available.Aside from a shortlist of sanity checks, it configures the krb.conf (for krb tooling) and DNS for AD domains on all machines.
This should not impact any other network connectivity - in testing that worked fine. It allows configuration of machines without AD computer join and some future features, but can be removed from global config if it makes problems.
The majority of flags has been tested with single (working) domain configuration. Note that there are several important distinctions between local (sssd) and per-domain settings. Any other configuration aside from the test domain should be
evaluated (e.g. different providers and subsequent settings), as each one has their own implications.
Most notably, the limitation is the user setup script and subsequent tooling.
User provision
Ghaf now provides 3 mechanisms for user provisioning:
mutable-usersenable option inmodules/common/users/profiles.nix. This includes the "ghaf" admin user.Provisioning Script:
The user provisioning script has been updated and moved to a package to accommodate all necessary functions and get rid of long scripts in .nix files, and be available as cli command.
This script is a temporary solution - this should be properly implemented (not bash). However, this can be used until the user enrollment flow is clear, e.g. admin logging into UI in which case we can make this a proper UI application.
Notes for CI/CD testing:
The systemd service names for automated test setup have changed:
systemctl start user-provision-remove.servicesystemctl start user-provision-test.serviceAD User functionality (new)
Here a quick (possibly incomplete) list of features currently supported with "Active Directory users".
Note that there are a plethora of limitations by cosmic-greeter.
Shortlist of possible future improvements
Other changes with this patch
config.ghaf.users.profile.mutable-users.enablefor details)Type of Change
Related Issues / Tickets
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify: