Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Maintenance Menu on boot #317

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Stadicus
Copy link
Collaborator

@Stadicus Stadicus commented Dec 17, 2019

This pull request extends the initial implementation of the autorization reset and adds a "Maintenance Menu" that is displayed (without the need to log in) if an authorized maintenance token is found on the USB flashdrive.

A maintenance token can be:

  • a Shift factory token, its hash added in the initial build and removed later (either from the maintenance menu, or when user initiates the backup at the end of the Setup Wizard)
  • a user token that is written to the flashdrive as part of the Backup process

The maintenancen menu is displayed over HDMI on tty2 and allows:

  • creating and applying Bitcoin block snapshots
  • finishing the factory setup by deleting any temporary user files
  • Factory reset...
    • Authentication: user can reset the password from the BitBoxApp
    • Configuration reset: factory defaults are restored (Redis database, new SSH and SSL keys...)
    • Disk image reset: user can flash official, signed BitBoxBase image from USB flashdrive

Screenshot from 2019-12-17 15-47-42

Not yet implemented: applying the restored configuration (e.g. setting hostname, recreating config files from templates with restored Redis values) which is tracked in a separate issue.

@Stadicus Stadicus self-assigned this Dec 17, 2019
@Stadicus Stadicus force-pushed the 20191127-maintenance-menu branch 2 times, most recently from 256dbc9 to 27fcab9 Compare December 17, 2019 21:47
Stadicus added a commit to Stadicus/bitbox-base that referenced this pull request Dec 20, 2019
The introduction of the Maintenance Menu as a seucrity-senstivie
features needs proper documentation.

This commit:
* replaces the "Factory reset" section in Tinkering with the new
  "Maintenance Menu" section

Depends on:
BitBoxSwiss#317
Stadicus added a commit to Stadicus/bitbox-base that referenced this pull request Dec 20, 2019
The introduction of the Maintenance Menu as a seucrity-senstivie
features needs proper documentation.

This commit:
* replaces the "Factory reset" section in Tinkering with the new
  "Maintenance Menu" section

Depends on:
BitBoxSwiss#317
Because:
* The initial reset token system stays in place, but is extended to
  serve general maintenance purposes, including factory setup.
* The factory token is deleted manually or on first setup.

This commit:
* renames reset-token to maintenance-token
* adds a Shift factory token (clearly marked and to be deleted)
Initial implementation of a "Maintenance Menu" that is displayed
(without the need to log in) if an authorized maintenance token
is found on the USB flashdrive.

A maintenance token can be:

* a Shift factory token, its hash added in the initial build and
  removed later (either from the maintenance menu, or on initial
  setup)
* a user token that is written to the flashdrive as part of the
  Backup process

The maintenancen menu is displayed over HDMI on tty2 and allows:

* creating and applying Bitcoin block snapshots
* finishing the factory setup by deleting any temporary user files
* Factory reset...
  * Authentication: user can reset the password from the BitBoxApp
  * Configuration reset: factory defaults are restored
    (Redis database, new SSH and SSL keys...)
  * Disk image reset: user can flash official, signed BitBoxBase
    image from USB flashdrive

This commit:
* The backup to USB flashdrive also creates a maintenance token.
* adds /opt/shift/scripts/systemd-startup-maintenance.sh that
  contains the menu structure and calls bbb-cmd.sh
* extends 'bbb-cmd.sh' with
  * presync create/restore
  * reset auth/config
* during build, the packages 'console-setup' (for command 'chvt')
  and 'dialog' are no longer removed
* adds the systemd unit 'startup-maintenance.service'
* adds dialog configuration as '.dialogrc'
Because:
* If a unformatted NVMe is present, but a formatted USB drive is
  connected on first boot, e.g. for factory maintenance, the USB drive
  is added to /etc/fstab
* It is necessary to give the NVMe ssd always precedence over attached
  USB drives.

This commit:
* checks if a NVMe drive is present and, if true, no longer checks for
  any USB drives, formatted or not.
The new maintenance menu needs to be tested in real builds but should
not yet be enabled in production builds.

By adding this feature, but disabled by default, it can be go into
a more extensive security review.

This commit:
* adds the option BASE_MAINTENANCEMENU, default: 'false'
* `startup-maintenance.service` is only enabled if set to true
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant