clan-cli: Fix user-password without user-prompt. Remove newlines from user-password and root-password. Improve test_generate_secret

This commit is contained in:
Qubasa
2024-06-24 20:08:02 +02:00
parent ff1863f37e
commit 38c0233496
4 changed files with 26 additions and 8 deletions

View File

@@ -37,12 +37,12 @@
mkpasswd
];
generator.script = ''
if [[ -n $prompt_value ]]; then
echo $prompt_value | tr -d '\n' > $secrets/user-password
if [[ -n ''${prompt_value-} ]]; then
echo $prompt_value | tr -d "\n" > $secrets/user-password
else
xkcdpass --numwords 3 --delimiter - --count 1 | tr -d '\n' > $secrets/user-password
xkcdpass --numwords 3 --delimiter - --count 1 | tr -d "\n" > $secrets/user-password
fi
cat $secrets/user-password | mkpasswd -s -m sha-512 > $secrets/user-password-hash
cat $secrets/user-password | mkpasswd -s -m sha-512 | tr -d "\n" > $secrets/user-password-hash
'';
};
};