raspberrypi / rpi-sb-provisioner

A minimal-input automatic secure boot provisioning system for Raspberry Pi devices.
Apache License 2.0
14 stars 6 forks source link

config.sh unable to save config #40

Open Siecje opened 2 weeks ago

Siecje commented 2 weeks ago

I'm not using the pi user. My user is in the rpi-sb-provisioner group.

When I run config.sh and enter values and try to save I get a PermissionError.

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /usr/share/rpi-sb-provisioner/config/config.py:119 in on_button_pressed                                                                                                                                                                                                      │
│                                                                                                                                                                                                                                                                              │
│   116 │   │   if "close_help_screen" in event.button.id:                                       ╭─────────────────────────────────── locals ────────────────────────────────────╮                                                                                             │
│   117 │   │   │   self.pop_screen()                                                            │ event = Pressed()                                                             │                                                                                             │
│   118 │   │   if "write_button" in event.button.id:                                            │  self = App(title='rpi-sb-provisioner config editor', classes={'-dark-mode'}) │                                                                                             │
│ ❱ 119 │   │   │   f = open("/etc/rpi-sb-provisioner/config", "w+")                             ╰───────────────────────────────────────────────────────────────────────────────╯                                                                                             │
│   120 │   │   │   for param in params_to_save:                                                                                                                                                                                                                               │
│   121 │   │   │   │   if param != "":                                                                                                                                                                                                                                        │
│   122 │   │   │   │   │   f.write(param + "=" + params_to_save[param] + "\n")                                                                                                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
PermissionError: [Errno 13] Permission denied: '/etc/rpi-sb-provisioner/config'

/etc/rpi-sb-provsioner/ has permissions drwxr-xr-x 2 root root 4096 Sep 13 08:58 .

If the command should be sudo config.sh the README should be updated.

If I use sudo config.sh and fill out all of the fields. /etc/rpi-sb-provisioner/config is created with

CUSTOMER_KEY_FILE_PEM=
CUSTOMER_KEY_PKCS11_NAME=
GOLD_MASTER_OS_FILE=
RPI_DEVICE_STORAGE_TYPE=
RPI_DEVICE_FAMILY=
RPI_DEVICE_BOOTLOADER_CONFIG_FILE=/var/lib/rpi-sb-provisioner/bootloader.config
RPI_DEVICE_LOCK_JTAG=
RPI_DEVICE_EEPROM_WP_SET=
RPI_DEVICE_SERIAL_STORE=/usr/local/etc/rpi-sb-provisioner/seen
DEMO_MODE_ONLY=
RPI_SB_WORKDIR=

If the file already exists sudo config.sh will not modify it.

tdewey-rpi commented 1 week ago

Agreed, the most sensible path forward for the configuration script is to make it a sudo tool.