1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-14 19:02:45 +03:00

Add passwd_hash

Without password hash '$user:*' to `chpasswd -e` will result to
inability for user to login, or change password. So I've add parameter
passwd_hash for the user. Password hash could be generated via command
`openssl passwd -5 your_password`.
This commit is contained in:
Aleksandr Berkuta 2025-05-19 17:43:19 +03:00 committed by Jake Buchholz Göktürk
parent 3e886c87fb
commit 5aece92a41

View File

@ -286,12 +286,16 @@ init__userdata_users() {
$MOCK adduser -D ${gecos:+-g "$gecos"} ${homedir:+-h "$homedir"} ${shell:+-s "$shell"} ${primary_group:+-G "$primary_group"} ${system:+-S} ${no_create_home:+-H} "$name"
fi
if in_list hashed_passwd $keys; then
hashed_passwd="$(get_userdata users/$i/hashed_passwd)"
fi
if in_list lock_passwd $keys; then
lock_passwd="$(get_userdata users/$i/lock_passwd)"
fi
if [ "$lock_passwd" != "false" ]; then
echo "$name:*" | $MOCK chpasswd -e
echo "${name}:${hashed_passwd}" | $MOCK chpasswd -e
fi
if in_list ssh_authorized_keys $keys; then
@ -314,7 +318,7 @@ init__userdata_users() {
for j in $(get_userdata users/$i/doas); do
local line="$(get_userdata users/$i/doas/$j)"
if [ -d "$ETC/doas.d" ]; then
echo "$line" >> "$ETC/doas.d/$name.conf"
echo "$line" >>"$ETC/doas.d/$name.conf"
elif [ -f "$ETC/doas.conf" ]; then
add_once "$ETC/doas.conf" "$line"
fi