diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-11 11:57:54 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-12 14:39:08 +0200 |
commit | 8c57406bfb8e75bb1574a303941560cea207506e (patch) | |
tree | 51d9b63b78ef0764513ae5986240442f72c93f1a /modules/by-name | |
parent | modules/stalwart-mail: Make `cfg.principals` nullable (diff) | |
download | nixos-server-8c57406bfb8e75bb1574a303941560cea207506e.zip |
modules/stalwart-mail: Explicitly list out valid password hashes
If a password hash does not match stalwart's know ones, it will just treat it as plaintext. This is obviously very bad, and should be avoided.
Diffstat (limited to 'modules/by-name')
-rw-r--r-- | modules/by-name/st/stalwart-mail/module.nix | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix index 1e39e81..ec10188 100644 --- a/modules/by-name/st/stalwart-mail/module.nix +++ b/modules/by-name/st/stalwart-mail/module.nix @@ -61,7 +61,32 @@ in { }; secret = lib.mkOption { - type = lib.types.str; + type = let + prefix = pre: lib.types.strMatching "^${lib.strings.escapeRegex pre}.*"; + in + lib.types.oneOf [ + (prefix "$argon2") + (prefix "$pbkdf2") + (prefix "$scrypt") + (prefix "$2") # bcrypt + (prefix "$6$") # sha-512 + (prefix "$5$") # sha-256 + (prefix "$sha1") + (prefix "$1") # md5 + (prefix "_") # BSDi crypt + (prefix "{SHA}") # base64 sha + (prefix "{SSHA}") # base64 salted sha + + # unix crypt + (prefix "{CRYPT}") + (prefix "{crypt}") + + # Plain text + (prefix "{PLAIN}") + (prefix "{plain}") + (prefix "{CLEAR}") + (prefix "{clear}") + ]; description = '' Sets the password for the user account. Passwords can be stored hashed or in plain text (not recommended). |