Skip to content

Commit

Permalink
nuageinit: Accept plain text passwords
Browse files Browse the repository at this point in the history
Per pw(8), when -H is set, the password should be supplied already
encrypted in a form suitable for writing directly to the password
database (passwd in cloud-init tems); -h provides a special interface by
which interactive scripts can set an account password using pw(8) in
plain text (plain_text_passwd in cloud-init terms).

The default user (freebsd) is defined with a plain_text_passwd
(freebsd), not with an encrypted one.
  • Loading branch information
jlduran committed Jul 23, 2024
1 parent baee801 commit ebcbebf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libexec/nuageinit/nuage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ local function adduser(pwd)
postcmd = " -H 0 "
elseif pwd.plain_text_passwd then
precmd = "echo "..pwd.plain_text_passwd .. "| "
postcmd = " -H 0 "
postcmd = " -h 0 "
end
cmd = precmd .. "pw "
if root then
Expand Down
1 change: 1 addition & 0 deletions libexec/nuageinit/tests/nuageinit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ sys:*:1:0::0:0:Sys:/home/sys:/bin/csh
freebsd:freebsd:1001:1003::0:0:FreeBSD User:/home/freebsd:/bin/sh
foobar:H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/:1002:1004::0:0:Foo B. Bar:/home/foobar:/bin/sh
EOF
sed -i "" "s/freebsd:.*:1001/freebsd:freebsd:1001/" ${here}/etc/master.passwd
atf_check -o file:expectedpasswd cat ${here}/etc/master.passwd
atf_check -o file:expectedgroup cat ${here}/etc/group
}

Check warning on line 110 in libexec/nuageinit/tests/nuageinit.sh

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
Expand Down

0 comments on commit ebcbebf

Please sign in to comment.