fix(patches): fix kanidm patches for 25.05
All checks were successful
Check meta / check_dns (pull_request) Successful in 18s
Check meta / check_meta (pull_request) Successful in 18s
Check workflows / check_workflows (pull_request) Successful in 18s
Run pre-commit on all files / pre-commit (pull_request) Successful in 33s
Build all the nodes / netcore01 (pull_request) Successful in 50s
Build all the nodes / netcore02 (pull_request) Successful in 57s
Build all the nodes / netcore00 (pull_request) Successful in 57s
Build all the nodes / netaccess01 (pull_request) Successful in 59s
Build all the nodes / ap01 (pull_request) Successful in 1m5s
Build all the nodes / geo01 (pull_request) Successful in 1m13s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m23s
Build all the nodes / bridge01 (pull_request) Successful in 1m24s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m23s
Build all the nodes / tower01 (pull_request) Successful in 1m7s
Build all the nodes / geo02 (pull_request) Successful in 1m24s
Build all the nodes / lab-router01 (pull_request) Successful in 1m26s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m26s
Build all the nodes / iso (pull_request) Successful in 1m29s
Build all the nodes / build01 (pull_request) Successful in 1m31s
Build all the nodes / rescue01 (pull_request) Successful in 1m34s
Build all the nodes / compute01 (pull_request) Successful in 1m46s
Build the shell / build-shell (pull_request) Successful in 34s
Build all the nodes / web02 (pull_request) Successful in 54s
Build all the nodes / vault01 (pull_request) Successful in 1m4s
Build all the nodes / web03 (pull_request) Successful in 54s
Build all the nodes / web01 (pull_request) Successful in 1m5s
Build all the nodes / krz01 (pull_request) Successful in 2m8s
Build all the nodes / cof02 (pull_request) Successful in 2m22s
Build all the nodes / storage01 (pull_request) Successful in 2m15s
Build all the nodes / netaccess01 (push) Successful in 26s
Build all the nodes / netcore00 (push) Successful in 27s
Run pre-commit on all files / pre-commit (push) Successful in 33s
Build all the nodes / ap01 (push) Successful in 43s
Build all the nodes / netcore01 (push) Successful in 29s
Build all the nodes / netcore02 (push) Successful in 29s
Build the shell / build-shell (push) Successful in 30s
Build all the nodes / geo01 (push) Successful in 53s
Build all the nodes / geo02 (push) Successful in 59s
Build all the nodes / lab-router01 (push) Successful in 1m1s
Build all the nodes / bridge01 (push) Successful in 1m6s
Build all the nodes / hypervisor02 (push) Successful in 1m6s
Build all the nodes / hypervisor01 (push) Successful in 1m6s
Build all the nodes / hypervisor03 (push) Successful in 1m7s
Build all the nodes / build01 (push) Successful in 1m11s
Build all the nodes / cof02 (push) Successful in 1m12s
Build all the nodes / iso (push) Successful in 1m11s
Build all the nodes / compute01 (push) Successful in 1m39s
Build all the nodes / web02 (push) Successful in 1m24s
Build all the nodes / web03 (push) Successful in 1m30s
Build all the nodes / vault01 (push) Successful in 1m31s
Build all the nodes / tower01 (push) Successful in 1m38s
Build all the nodes / rescue01 (push) Successful in 1m40s
Build all the nodes / web01 (push) Successful in 1m39s
Build all the nodes / krz01 (push) Successful in 1m59s
Build all the nodes / storage01 (push) Successful in 2m19s
All checks were successful
Check meta / check_dns (pull_request) Successful in 18s
Check meta / check_meta (pull_request) Successful in 18s
Check workflows / check_workflows (pull_request) Successful in 18s
Run pre-commit on all files / pre-commit (pull_request) Successful in 33s
Build all the nodes / netcore01 (pull_request) Successful in 50s
Build all the nodes / netcore02 (pull_request) Successful in 57s
Build all the nodes / netcore00 (pull_request) Successful in 57s
Build all the nodes / netaccess01 (pull_request) Successful in 59s
Build all the nodes / ap01 (pull_request) Successful in 1m5s
Build all the nodes / geo01 (pull_request) Successful in 1m13s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m23s
Build all the nodes / bridge01 (pull_request) Successful in 1m24s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m23s
Build all the nodes / tower01 (pull_request) Successful in 1m7s
Build all the nodes / geo02 (pull_request) Successful in 1m24s
Build all the nodes / lab-router01 (pull_request) Successful in 1m26s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m26s
Build all the nodes / iso (pull_request) Successful in 1m29s
Build all the nodes / build01 (pull_request) Successful in 1m31s
Build all the nodes / rescue01 (pull_request) Successful in 1m34s
Build all the nodes / compute01 (pull_request) Successful in 1m46s
Build the shell / build-shell (pull_request) Successful in 34s
Build all the nodes / web02 (pull_request) Successful in 54s
Build all the nodes / vault01 (pull_request) Successful in 1m4s
Build all the nodes / web03 (pull_request) Successful in 54s
Build all the nodes / web01 (pull_request) Successful in 1m5s
Build all the nodes / krz01 (pull_request) Successful in 2m8s
Build all the nodes / cof02 (pull_request) Successful in 2m22s
Build all the nodes / storage01 (pull_request) Successful in 2m15s
Build all the nodes / netaccess01 (push) Successful in 26s
Build all the nodes / netcore00 (push) Successful in 27s
Run pre-commit on all files / pre-commit (push) Successful in 33s
Build all the nodes / ap01 (push) Successful in 43s
Build all the nodes / netcore01 (push) Successful in 29s
Build all the nodes / netcore02 (push) Successful in 29s
Build the shell / build-shell (push) Successful in 30s
Build all the nodes / geo01 (push) Successful in 53s
Build all the nodes / geo02 (push) Successful in 59s
Build all the nodes / lab-router01 (push) Successful in 1m1s
Build all the nodes / bridge01 (push) Successful in 1m6s
Build all the nodes / hypervisor02 (push) Successful in 1m6s
Build all the nodes / hypervisor01 (push) Successful in 1m6s
Build all the nodes / hypervisor03 (push) Successful in 1m7s
Build all the nodes / build01 (push) Successful in 1m11s
Build all the nodes / cof02 (push) Successful in 1m12s
Build all the nodes / iso (push) Successful in 1m11s
Build all the nodes / compute01 (push) Successful in 1m39s
Build all the nodes / web02 (push) Successful in 1m24s
Build all the nodes / web03 (push) Successful in 1m30s
Build all the nodes / vault01 (push) Successful in 1m31s
Build all the nodes / tower01 (push) Successful in 1m38s
Build all the nodes / rescue01 (push) Successful in 1m40s
Build all the nodes / web01 (push) Successful in 1m39s
Build all the nodes / krz01 (push) Successful in 1m59s
Build all the nodes / storage01 (push) Successful in 2m19s
This commit is contained in:
parent
ee4adaf937
commit
fb5a0ae7eb
5 changed files with 162 additions and 3 deletions
2
REUSE.toml
generated
2
REUSE.toml
generated
|
@ -26,7 +26,7 @@ precedence = "closest"
|
|||
[[annotations]]
|
||||
SPDX-FileCopyrightText = ["2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>", "2024 Maurice Debray <maurice.debray@dgnum.eu>"]
|
||||
SPDX-License-Identifier = "EUPL-1.2"
|
||||
path = ["patches/nixpkgs/07-kanidm-groups-module.patch", "patches/nixpkgs/08-kanidm-groups-pkgs.patch"]
|
||||
path = ["patches/nixpkgs/07-kanidm-groups-module.patch", "patches/nixpkgs/08-kanidm-groups-pkgs.patch", "patches/nixpkgs/07-25.05-kanidm-groups-module.patch", "patches/nixpkgs/08-25.05-kanidm-groups-pkgs.patch"]
|
||||
precedence = "closest"
|
||||
|
||||
[[annotations]]
|
||||
|
|
|
@ -123,6 +123,8 @@ let
|
|||
path = [
|
||||
"patches/nixpkgs/07-kanidm-groups-module.patch"
|
||||
"patches/nixpkgs/08-kanidm-groups-pkgs.patch"
|
||||
"patches/nixpkgs/07-25.05-kanidm-groups-module.patch"
|
||||
"patches/nixpkgs/08-25.05-kanidm-groups-pkgs.patch"
|
||||
];
|
||||
copyright = [
|
||||
"2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>"
|
||||
|
|
|
@ -25,8 +25,8 @@ with {
|
|||
(local ./nixpkgs/01-pretalx-environment-file.patch)
|
||||
|
||||
# Kanidm memberless groups provisionning
|
||||
# (local ./nixpkgs/07-kanidm-groups-module.patch)
|
||||
# (local ./nixpkgs/08-kanidm-groups-pkgs.patch)
|
||||
(local ./nixpkgs/07-25.05-kanidm-groups-module.patch)
|
||||
(local ./nixpkgs/08-25.05-kanidm-groups-pkgs.patch)
|
||||
];
|
||||
|
||||
"nixos-24.11" = [
|
||||
|
|
51
patches/nixpkgs/07-25.05-kanidm-groups-module.patch
Normal file
51
patches/nixpkgs/07-25.05-kanidm-groups-module.patch
Normal file
|
@ -0,0 +1,51 @@
|
|||
diff --git a/nixos/modules/services/security/kanidm.nix b/nixos/modules/services/security/kanidm.nix
|
||||
index ab85eed34eea..48722af7332a 100644
|
||||
--- a/nixos/modules/services/security/kanidm.nix
|
||||
+++ b/nixos/modules/services/security/kanidm.nix
|
||||
@@ -140,6 +140,9 @@ let
|
||||
|
||||
filterPresent = filterAttrs (_: v: v.present);
|
||||
|
||||
+ filterMemberless = filterAttrs (_: v: v.present && v.memberless);
|
||||
+ filterMemberful = filterAttrs (_: v: v.present && !v.memberless);
|
||||
+
|
||||
provisionStateJson = pkgs.writeText "provision-state.json" (
|
||||
builtins.toJSON { inherit (cfg.provision) groups persons systems; }
|
||||
);
|
||||
@@ -465,6 +468,12 @@ in
|
||||
apply = unique;
|
||||
default = [ ];
|
||||
};
|
||||
+
|
||||
+ memberless = mkOption {
|
||||
+ description = "Whether this group is considered memberless, i.e. the list of members is managed imperatively.";
|
||||
+ type = types.bool;
|
||||
+ default = false;
|
||||
+ };
|
||||
};
|
||||
config.members = concatLists (
|
||||
flip mapAttrsToList cfg.provision.persons (
|
||||
@@ -791,12 +800,22 @@ in
|
||||
person: personCfg:
|
||||
assertGroupsKnown "services.kanidm.provision.persons.${person}.groups" personCfg.groups
|
||||
))
|
||||
++ (optionals (cfg.provision.extraJsonFile == null) (
|
||||
- flip mapAttrsToList (filterPresent cfg.provision.groups) (
|
||||
+ flip mapAttrsToList (filterMemberful cfg.provision.groups) (
|
||||
group: groupCfg:
|
||||
assertEntitiesKnown "services.kanidm.provision.groups.${group}.members" groupCfg.members
|
||||
)
|
||||
))
|
||||
+ ++ (optionals (cfg.provision.extraJsonFile == null) (
|
||||
+ flip lib.mapAttrsToList (filterMemberless cfg.provision.groups) (
|
||||
+ group: groupCfg: {
|
||||
+ assertion = cfg.provision.enable -> groupCfg.members == [ ];
|
||||
+ message = ''
|
||||
+ services.kanidm.groups.${group} is declared as memberless but contains members: ${toString groupCfg.members}
|
||||
+ '';
|
||||
+ }
|
||||
+ )
|
||||
+ ))
|
||||
++ concatLists (
|
||||
flip mapAttrsToList (filterPresent cfg.provision.systems.oauth2) (
|
||||
oauth2: oauth2Cfg:
|
106
patches/nixpkgs/08-25.05-kanidm-groups-pkgs.patch
Normal file
106
patches/nixpkgs/08-25.05-kanidm-groups-pkgs.patch
Normal file
|
@ -0,0 +1,106 @@
|
|||
diff --git a/pkgs/by-name/ka/kanidm-provision/01-memberless.patch b/pkgs/by-name/ka/kanidm-provision/01-memberless.patch
|
||||
new file mode 100644
|
||||
index 000000000000..b501a3f16828
|
||||
--- /dev/null
|
||||
+++ b/pkgs/by-name/ka/kanidm-provision/01-memberless.patch
|
||||
@@ -0,0 +1,85 @@
|
||||
+From ab3fa7d59b76658ba98ccf50c2910329896dab6f Mon Sep 17 00:00:00 2001
|
||||
+From: Tom Hubrecht <tom@hubrecht.ovh>
|
||||
+Date: Tue, 4 Feb 2025 14:32:43 +0100
|
||||
+Subject: [PATCH] feat: Allow declaring memberless groups
|
||||
+
|
||||
+When a group is "memberless", then the list of members is left intact,
|
||||
+which allows managing it imperatively.
|
||||
+---
|
||||
+ src/main.rs | 2 +-
|
||||
+ src/state.rs | 2 ++
|
||||
+ tests/kanidm.nix | 18 +++++++++++++++++-
|
||||
+ 3 files changed, 20 insertions(+), 2 deletions(-)
|
||||
+
|
||||
+diff --git a/src/main.rs b/src/main.rs
|
||||
+index 206a86a..6e48f59 100644
|
||||
+--- a/src/main.rs
|
||||
++++ b/src/main.rs
|
||||
+@@ -406,7 +406,7 @@ fn main() -> Result<()> {
|
||||
+ // Sync group members
|
||||
+ log_status("Syncing group members");
|
||||
+ for (name, group) in &state.groups {
|
||||
+- if group.present {
|
||||
++ if group.present && !group.memberless {
|
||||
+ update_attrs!(kanidm_client, ENDPOINT_GROUP, &existing_groups, &name, [
|
||||
+ "member": group.members.clone(),
|
||||
+ ]);
|
||||
+diff --git a/src/state.rs b/src/state.rs
|
||||
+index 206c6f4..a8bfba2 100644
|
||||
+--- a/src/state.rs
|
||||
++++ b/src/state.rs
|
||||
+@@ -10,6 +10,8 @@ pub struct Group {
|
||||
+ #[serde(default = "default_true")]
|
||||
+ pub present: bool,
|
||||
+ pub members: Vec<String>,
|
||||
++ #[serde(default = "default_false")]
|
||||
++ pub memberless: bool,
|
||||
+ }
|
||||
+
|
||||
+ #[derive(Debug, Deserialize)]
|
||||
+diff --git a/tests/kanidm.nix b/tests/kanidm.nix
|
||||
+index a28beae..cb20257 100644
|
||||
+--- a/tests/kanidm.nix
|
||||
++++ b/tests/kanidm.nix
|
||||
+@@ -91,6 +91,8 @@ let
|
||||
+ };
|
||||
+
|
||||
+ filterPresent = lib.filterAttrs (_: v: v.present);
|
||||
++ filterMemberless = lib.filterAttrs (_: v: v.present && v.memberless);
|
||||
++ filterMemberful = lib.filterAttrs (_: v: v.present && !v.memberless);
|
||||
+
|
||||
+ provisionStateJson = pkgs.writeText "provision-state.json" (
|
||||
+ builtins.toJSON { inherit (cfg.provision) groups persons systems; }
|
||||
+@@ -391,6 +393,12 @@ in
|
||||
+ apply = lib.unique;
|
||||
+ default = [ ];
|
||||
+ };
|
||||
++
|
||||
++ memberless = lib.mkOption {
|
||||
++ description = "Whether this group is considered memberless, i.e. the list of members is managed imperatively.";
|
||||
++ type = lib.types.bool;
|
||||
++ default = false;
|
||||
++ };
|
||||
+ };
|
||||
+ config.members = lib.concatLists (
|
||||
+ lib.flip lib.mapAttrsToList cfg.provision.persons (
|
||||
+@@ -708,10 +716,18 @@ in
|
||||
+ person: personCfg:
|
||||
+ assertGroupsKnown "services.kanidm.provision.persons.${person}.groups" personCfg.groups
|
||||
+ )
|
||||
+- ++ lib.flip lib.mapAttrsToList (filterPresent cfg.provision.groups) (
|
||||
++ ++ lib.flip lib.mapAttrsToList (filterMemberful cfg.provision.groups) (
|
||||
+ group: groupCfg:
|
||||
+ assertEntitiesKnown "services.kanidm.provision.groups.${group}.members" groupCfg.members
|
||||
+ )
|
||||
++ ++ lib.flip lib.mapAttrsToList (filterMemberless cfg.provision.groups) (
|
||||
++ group: groupCfg: {
|
||||
++ assertion = cfg.provision.enable -> groupCfg.members == [ ];
|
||||
++ message = ''
|
||||
++ services.kanidm.groups.${group} is declared as memberless but contains members: ${toString groupCfg.members}
|
||||
++ '';
|
||||
++ }
|
||||
++ )
|
||||
+ ++ lib.concatLists (
|
||||
+ lib.flip lib.mapAttrsToList (filterPresent cfg.provision.systems.oauth2) (
|
||||
+ oauth2: oauth2Cfg:
|
||||
diff --git a/pkgs/by-name/ka/kanidm-provision/package.nix b/pkgs/by-name/ka/kanidm-provision/package.nix
|
||||
index 63d7e85ba8a8..5ebd69cb91ee 100644
|
||||
--- a/pkgs/by-name/ka/kanidm-provision/package.nix
|
||||
+++ b/pkgs/by-name/ka/kanidm-provision/package.nix
|
||||
@@ -14,6 +14,10 @@ rustPlatform.buildRustPackage rec {
|
||||
hash = "sha256-kwxGrLz59Zk8PSsfQzPUeA/xWQZrV1NWlS5/yuqfIyI=";
|
||||
};
|
||||
|
||||
+ patches = [
|
||||
+ ./01-memberless.patch
|
||||
+ ];
|
||||
+
|
||||
postPatch = ''
|
||||
tomlq -ti '.package.version = "${finalAttrs.version}"' Cargo.toml
|
||||
'';
|
Loading…
Add table
Add a link
Reference in a new issue