aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/by-name/st/stalwart-mail/module.nix27
-rw-r--r--tests/by-name/em/email-dns/test.nix4
-rw-r--r--tests/by-name/em/email-ip/test.nix4
3 files changed, 30 insertions, 5 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).
diff --git a/tests/by-name/em/email-dns/test.nix b/tests/by-name/em/email-dns/test.nix
index 32447ae..c56eb0b 100644
--- a/tests/by-name/em/email-dns/test.nix
+++ b/tests/by-name/em/email-dns/test.nix
@@ -44,7 +44,7 @@ in
{
class = "individual";
name = "bob";
- secret = "bob-password";
+ secret = "{PLAIN}bob-password";
email = ["bob@bob.com"];
};
@@ -53,7 +53,7 @@ in
{
class = "individual";
name = "alice";
- secret = "alice-password";
+ secret = "{PLAIN}alice-password";
email = ["alice@alice.com"];
};
diff --git a/tests/by-name/em/email-ip/test.nix b/tests/by-name/em/email-ip/test.nix
index 688cd8f..dabc404 100644
--- a/tests/by-name/em/email-ip/test.nix
+++ b/tests/by-name/em/email-ip/test.nix
@@ -113,13 +113,13 @@ in
{
class = "individual";
name = "alice";
- secret = "alice-password";
+ secret = "{PLAIN}alice-password";
email = ["alice@${domain}"];
}
{
class = "individual";
name = "bob";
- secret = "bob-password";
+ secret = "{PLAIN}bob-password";
email = ["bob@${domain}"];
}
];