Only prepend {CRYPT} scheme if there is no scheme present
This commit is contained in:
@@ -41,7 +41,19 @@ let
|
||||
mkpasswd -s <<<"$password" > $out
|
||||
'';
|
||||
|
||||
hashPasswordWithScheme =
|
||||
password:
|
||||
pkgs.runCommand "password-${password}-hashed-with-scheme"
|
||||
{
|
||||
buildInputs = [ pkgs.dovecot ];
|
||||
inherit password;
|
||||
}
|
||||
''
|
||||
printf "$password\n$password\n" | doveadm -O pw -s SSHA256 > $out
|
||||
'';
|
||||
|
||||
hashedPasswordFile = hashPassword "my-password";
|
||||
hashedPasswordFileWithScheme = hashPasswordWithScheme "my-password";
|
||||
passwordFile = pkgs.writeText "password" "my-password";
|
||||
in
|
||||
{
|
||||
@@ -100,6 +112,9 @@ in
|
||||
"user3@example.com" = {
|
||||
passwordFile = "/run/passwords/user3";
|
||||
};
|
||||
"user4@example.com" = {
|
||||
hashedPasswordFile = hashedPasswordFileWithScheme;
|
||||
};
|
||||
"send-only@example.com" = {
|
||||
hashedPasswordFile = hashPassword "send-only";
|
||||
sendOnly = true;
|
||||
@@ -258,6 +273,25 @@ in
|
||||
)
|
||||
)
|
||||
|
||||
with subtest("user with scheme-prefixed hashedPasswordFile can send and receive"):
|
||||
machine.succeed(
|
||||
" ".join(
|
||||
[
|
||||
"mail-check send-and-read",
|
||||
"--smtp-port 587",
|
||||
"--smtp-starttls",
|
||||
"--smtp-host localhost",
|
||||
"--imap-host localhost",
|
||||
"--imap-username user4@example.com",
|
||||
"--from-addr user4@example.com",
|
||||
"--to-addr user4@example.com",
|
||||
"--src-password-file ${passwordFile}",
|
||||
"--dst-password-file ${passwordFile}",
|
||||
"--ignore-dkim-spf",
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
with subtest("imap port 143 is closed and imaps is serving SSL"):
|
||||
machine.wait_for_closed_port(143)
|
||||
machine.wait_for_open_port(993)
|
||||
|
||||
Reference in New Issue
Block a user