Skip to content

Update kcpassword file to fix auto login

Adrien Kohlbecker requested to merge ak/kcpassword into master

What does this MR do?

When you enable auto-login on a macOS machine, the user password is saved at /etc/kcpassword, in a binary encoded form. This allows macOS to open the user's session.

In our release jobs, we update the user password to the production password. However, we don't regenerate the /etc/kcpassword file, which still contains the old password, and so the machine does not auto login.

The encoding is somewhat known. Here for example is an example of how to decode part of the file https://tinyapps.org/blog/201709070700_kcpassword.html. In my experience though, while decoding the password is easy, the random padding that gets appended to the end of the file is difficult to reproduce. The algorithms you currently find on the web for this are outdated. They assume a block size of 11 when experimentation shows it is instead 12. So I wasn't able to reverse engineer this encoding, and I opted to copy the content of the file as is in hexadecimal form in our CI variables. We then just have to copy it back into place.

Why was this MR needed?

Production images do not auto login.

What's the best way to test this MR?

scripts/dev-vm --base-image ork-11-12-202103181708.img new

# connect to VNC 
# VM should NOT auto login

scripts/dev-vm --base-image mr-88-11-12-202103221123.img new

# connect to VNC 
# VM should auto login!

What are the relevant issue numbers?

Edited by Adrien Kohlbecker

Merge request reports

Loading