From 0d7a9738b0942d6216ba1c11485909b89d186afd Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Tue, 4 Jul 2023 15:10:00 +0200 Subject: [PATCH 1/3] manually patch the portunus regex --- flake.nix | 4 +-- .../0001-update-user-validation-regex.patch | 25 +++++++++++++++++++ modules/{ldap.nix => ldap/default.nix} | 23 +++++++---------- 3 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 modules/ldap/0001-update-user-validation-regex.patch rename modules/{ldap.nix => ldap/default.nix} (86%) diff --git a/flake.nix b/flake.nix index 04919d3..86b419c 100755 --- a/flake.nix +++ b/flake.nix @@ -40,7 +40,7 @@ ./modules/options.nix ./modules/base.nix ./modules/sops.nix - ./modules/ldap.nix + ./modules/ldap # ./modules/keycloak.nix replaced by portunus ./modules/mail.nix ./modules/mailman.nix @@ -67,7 +67,7 @@ ./hosts/quitte/configuration.nix ./modules/options.nix ./modules/base.nix - ./modules/ldap.nix + ./modules/ldap # ./modules/keycloak.nix replaced by portunus ./modules/nginx.nix ./modules/mail.nix diff --git a/modules/ldap/0001-update-user-validation-regex.patch b/modules/ldap/0001-update-user-validation-regex.patch new file mode 100644 index 0000000..7911cdf --- /dev/null +++ b/modules/ldap/0001-update-user-validation-regex.patch @@ -0,0 +1,25 @@ +From a3fb0c82f09db0b5655c949d5e4dbea55279ff10 Mon Sep 17 00:00:00 2001 +From: Rouven Seifert +Date: Tue, 4 Jul 2023 15:02:02 +0200 +Subject: [PATCH] update user validation regex + +--- + internal/core/validation.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/internal/core/validation.go b/internal/core/validation.go +index 3be9dfa..b1368a7 100644 +--- a/internal/core/validation.go ++++ b/internal/core/validation.go +@@ -30,7 +30,7 @@ import ( + ) + + // this regexp copied from useradd(8) manpage +-const posixAccountNamePattern = `[a-z_][a-z0-9_-]*\$?` ++const posixAccountNamePattern = `[a-z_][a-z0-9._-]*\$?` + + var ( + errIsMissing = errors.New("is missing") +-- +2.41.0 + diff --git a/modules/ldap.nix b/modules/ldap/default.nix similarity index 86% rename from modules/ldap.nix rename to modules/ldap/default.nix index 66bf2e9..6d19618 100644 --- a/modules/ldap.nix +++ b/modules/ldap/default.nix @@ -65,7 +65,7 @@ in #tls = true; }; - seedPath = ../config/portunus_seeds.json; + seedPath = ../../config/portunus_seeds.json; }; #users.ldap = { @@ -124,17 +124,12 @@ in }; }; - # nixpkgs.overlays = [ - # (self: super: - # { - # portunus = super.portunus.overrideAttrs (old: { - # src = super.fetchFromGitHub { - # owner = "revol-xut"; - # repo = "portunus"; - # rev = "4dc29febacb11c613785bc95352fa00e0ca9b14a"; - # sha256 = "sha256-6O2392aHXhgvgZf6ftDY5Bh6hG3OzzCnlriig/Vkkz8="; - # }; - # }); - # }) - # ]; + nixpkgs.overlays = [ + (self: super: + { + portunus = super.portunus.overrideAttrs (old: { + patches = [ ./0001-update-user-validation-regex.patch ]; + }); + }) + ]; } From 5136effd168fe1acf0daee243254b233256d1b73 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Tue, 4 Jul 2023 15:15:58 +0200 Subject: [PATCH 2/3] fix the portunus pach --- modules/ldap/0001-update-user-validation-regex.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ldap/0001-update-user-validation-regex.patch b/modules/ldap/0001-update-user-validation-regex.patch index 7911cdf..6ae40f9 100644 --- a/modules/ldap/0001-update-user-validation-regex.patch +++ b/modules/ldap/0001-update-user-validation-regex.patch @@ -1,6 +1,6 @@ -From a3fb0c82f09db0b5655c949d5e4dbea55279ff10 Mon Sep 17 00:00:00 2001 +From f5c68898be345fb0dca5ab7b596b9cbe674f5dfb Mon Sep 17 00:00:00 2001 From: Rouven Seifert -Date: Tue, 4 Jul 2023 15:02:02 +0200 +Date: Tue, 4 Jul 2023 15:14:00 +0200 Subject: [PATCH] update user validation regex --- @@ -8,13 +8,13 @@ Subject: [PATCH] update user validation regex 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/core/validation.go b/internal/core/validation.go -index 3be9dfa..b1368a7 100644 +index 3e168b5..10dfc0a 100644 --- a/internal/core/validation.go +++ b/internal/core/validation.go @@ -30,7 +30,7 @@ import ( ) - // this regexp copied from useradd(8) manpage + //this regexp copied from useradd(8) manpage -const posixAccountNamePattern = `[a-z_][a-z0-9_-]*\$?` +const posixAccountNamePattern = `[a-z_][a-z0-9._-]*\$?` From d5e881c63905c1253401efb0c651351166380d6b Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Tue, 4 Jul 2023 17:06:18 +0200 Subject: [PATCH 3/3] use portunus.package to override --- modules/ldap/default.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/ldap/default.nix b/modules/ldap/default.nix index 6d19618..d62c963 100644 --- a/modules/ldap/default.nix +++ b/modules/ldap/default.nix @@ -48,6 +48,9 @@ in services.portunus = { enable = true; + package = pkgs.portunus.overrideAttrs (old: { + patches = [ ./0001-update-user-validation-regex.patch ]; + }); user = "${portunusUser}"; group = "${portunusGroup}"; domain = "${domain}"; @@ -123,13 +126,4 @@ in }; }; }; - - nixpkgs.overlays = [ - (self: super: - { - portunus = super.portunus.overrideAttrs (old: { - patches = [ ./0001-update-user-validation-regex.patch ]; - }); - }) - ]; }