use portunus from nixos-unstable
This commit is contained in:
parent
8e8cc54f75
commit
2d7ed61384
7 changed files with 107 additions and 64 deletions
|
@ -1,25 +1,35 @@
|
|||
From f5c68898be345fb0dca5ab7b596b9cbe674f5dfb Mon Sep 17 00:00:00 2001
|
||||
From: Rouven Seifert <rouven@rfive.de>
|
||||
Date: Tue, 4 Jul 2023 15:14:00 +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 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
|
||||
-const posixAccountNamePattern = `[a-z_][a-z0-9_-]*\$?`
|
||||
+const posixAccountNamePattern = `[a-z_][a-z0-9._-]*\$?`
|
||||
diff --git a/cmd/portunus-orchestrator/config.go b/cmd/portunus-orchestrator/config.go
|
||||
index 4db19f2..290128a 100644
|
||||
--- a/cmd/portunus-orchestrator/config.go
|
||||
+++ b/cmd/portunus-orchestrator/config.go
|
||||
@@ -23,7 +23,7 @@ type valueCheck struct {
|
||||
}
|
||||
|
||||
var (
|
||||
errIsMissing = errors.New("is missing")
|
||||
--
|
||||
2.41.0
|
||||
|
||||
- userOrGroupPattern = `^[a-z_][a-z0-9_-]*\$?$`
|
||||
+ userOrGroupPattern = `^[a-z_][a-z0-9._-]*\$?$`
|
||||
envDefaults = map[string]string{
|
||||
//empty value = not optional
|
||||
"PORTUNUS_DEBUG": "false",
|
||||
diff --git a/internal/grammars/grammars.go b/internal/grammars/grammars.go
|
||||
index 1253c05..e458fd0 100644
|
||||
--- a/internal/grammars/grammars.go
|
||||
+++ b/internal/grammars/grammars.go
|
||||
@@ -39,7 +39,7 @@ const (
|
||||
// This regex is based on the respective format description in the useradd(8) manpage.
|
||||
//
|
||||
// This is only shown for documentation purposes here; use func IsPOSIXAccountName instead.
|
||||
- POSIXAccountNameRegex = `^[a-z_][a-z0-9_-]*\$?$`
|
||||
+ POSIXAccountNameRegex = `^[a-z_][a-z0-9._-]*\$?$`
|
||||
)
|
||||
|
||||
//TODO There is also some `import "regexp"` in cmd/orchestrator/ldap.go to render
|
||||
@@ -159,7 +159,7 @@ func checkByteInPOSIXAccountName(idx, length int, b byte) bool {
|
||||
switch {
|
||||
case (b >= 'a' && b <= 'z') || b == '_':
|
||||
return true
|
||||
- case (b >= '0' && b <= '9') || b == '-':
|
||||
+ case (b >= '0' && b <= '9') || b == '-' || b == '.':
|
||||
return idx != 0 // not allowed at start
|
||||
default:
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue