Sunil Mohan Adapa 1e2fb8171f
first_boot: Move first wizard secret generation to this app
- Generating files in postinst script makes working with image-based systems
harder as postinst scripts are not run when booting from a pristine image. So,
move this to first_boot app's setup() method.

- This means that first wizard secret is no longer displayed during package
installation. This is a loss in usability, but might be acceptable:

  - We want to reduce the number of dialog box messages shown to the user during
  the installation of FreedomBox as a blend in Debian installer. Along with this
  change, if we migrate away from LDAP, then no messages will be shown anymore.

  - When users are installing using Debian installer, they don't have access to
  console to note down the secret. They can only note down on a physical medium.
  This is not the best way. Most of the time when I installed on machines, I
  just looked at the secret file later.

  - It is not expected that user will loose root access to the machine on which
  they installed 'freedombox' package (manually or through Debian installer)
  before they can type in the secret into the first wizard. Earlier, we had
  restrictions on the type of users who can login to the console and this could
  have happened.

  - We can eliminate a lintian warning that we are showing messages in a dialog
  in the postinst script instead of configure script.

Tests:

- Unit tests work.

- Building Debian package with changes works.

- Lintian warning about debconf has been eliminated.

- On a fresh Debian Trixie machine, installing the newly built Debian package
succeeds. It does not show first wizard secret related message. When web
interface is accessed, secret is asked. Skipping the secret is not possible.
Even before the creation of the secret file.

- Providing incorrect secret leads to error message. Secret file can be read by
root. The file is owned by plinth:plinth. The file has 0400 permissions.

- The secret file contains a newline at the file but entering the secret without
the newline character works.

- The secret contains uppercase and lowercase ASCII characters and digits. The
secret is 16 chars in length.

- Incrementing the version number of first_boot app does not lead to change in
the secret file contents.

- The message in the first wizard secret form is as expected.

- Building a disk image with newly built Debian package works. When the image is
booted, it does not ask for first wizard secret.

- When an existing machine is upgraded, if it is a disk image, first wizard
secret file is not created and first wizard is not shown to the user.

- When an existing machine is upgraded, if it is not a disk image, first wizard
secret file is not changed and first wizard is not shown to the user.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
[jvalleroy: Correct comment]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2026-07-28 22:23:11 -04:00
..
2026-05-10 18:32:35 +05:30