All checks were successful
Run nix flake check / flake-check (push) Successful in 2m1s
Configure uid_attr_map and gid_attr_map to use short names instead of SPN format. This fixes SSH failing with "PAM user mismatch" because getent returned "torjus@home.2rjus.net" instead of "torjus". Also add user-management documentation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
961 B
Nix
40 lines
961 B
Nix
{ lib, config, pkgs, ... }:
|
|
let
|
|
cfg = config.homelab.kanidm;
|
|
in
|
|
{
|
|
options.homelab.kanidm = {
|
|
enable = lib.mkEnableOption "Kanidm PAM/NSS client for central authentication";
|
|
|
|
server = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "https://auth.home.2rjus.net";
|
|
description = "URI of the Kanidm server";
|
|
};
|
|
|
|
allowedLoginGroups = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ "ssh-users" ];
|
|
description = "Groups allowed to log in via PAM";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.kanidm = {
|
|
package = pkgs.kanidm_1_8;
|
|
enablePam = true;
|
|
|
|
clientSettings = {
|
|
uri = cfg.server;
|
|
};
|
|
|
|
unixSettings = {
|
|
pam_allowed_login_groups = cfg.allowedLoginGroups;
|
|
# Use short names (e.g., "torjus") instead of SPN (e.g., "torjus@home.2rjus.net")
|
|
uid_attr_map = "name";
|
|
gid_attr_map = "name";
|
|
};
|
|
};
|
|
};
|
|
}
|