- 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>
This is recommended by PEP-0597: https://peps.python.org/pep-0597/
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.
- ugettext is already a simple alias of gettext. So, no regressions are
expected.
Tests:
- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.
- Using Django 3.2 there are no warnings related to removal of ugettext
functions.
- Ran regular unit tests.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Explain how to read the firstboot-wizard-secret file using shell
commands. Remove output of the cat command.
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- A freshly installed FreedomBox can be hijacked by a third party and an admin
account can be created which can be used to inject malware or simply take over
the instance. Password protecting the firstboot step is a good way to avoid
this. A secret will be displayed to the user as soon as the Plinth package
is installed, which they have to enter during firstboot welcome step. Also,
writing this to a file in plinth's home in case the user loses it.
- This protection is not applicable for images built by freedom-maker and for
Amazon Machine Images.
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Do stricter matches when editing configuration file. Earlier
mechanism would match comments etc.
- Move action methods to module core from views.
- During first boot, notify users that console login is restricted and
that they can changed that from security settings.
- Recommend enabling conosle login restrictions. Add message about why
console restrictions are important.
- Show title in security module.
- Setting a new hostname is not one of the most buring issues to be take
care of during the setup process.
- Also, most likely the user will access the FreedomBox machine using
mDNS hostname such as freedombox.local. Changing the hostname mid
setup might have consequences that need to thought about properly.
- Create groups on first boot a bit more safely
- Use get_or_create instead of get() and create()
- Fix issue with not showing a full list of groups in user modify page
when there is are no users for that group.
- If during an action, user does not exist ignore.
- If during an action, return a non-zero exist status.
- Catch an errors during actions as exceptions.
- Display a message that corresponding POSIX operation failed.
The package license (AGPL3+) implicitly indicates the license of each
file. However, it is desirable to have license headers in each file.
This is the case for many prominent projects like GNU project, Mozilla
etc.