Skip to content

Conversation

@micahl
Copy link
Contributor

@micahl micahl commented Sep 12, 2022

This change is to unblock potential development of a snap package for IoT Edge. A pre-requisite is to detect when running in snap confinement (e.g. looking at env vars injected by snapd) and then expect the OS userid's to be prefixed with snap_

Tested by installing a build of IoT Edge, creating the snap_* users, reassigning ownership of the various files/directories to the snap_ users, copying over the built 'iotedge' binary with this change, and using it to perform actions such as:

  • sudo SNAP=1 ./iotedge config mp -c ...
  • sudo SNAP=1 ./iotedge config apply

And then I manually inspected the generated config files and the user ID's registered. For example, here's the output from one:

micahl@fooD:~$ sudo cat /etc/aziot/identityd/config.d/00-super.toml
# This file is auto-generated by `iotedge config apply`
# Do not edit it manually; any edits will be lost when the command is run again.

hostname = "fooD"
homedir = "/var/lib/aziot/identityd"

[provisioning]
source = "manual"
iothub_hostname = "micahl-test-hub.azure-devices.net"
device_id = "doctest"

[provisioning.authentication]
method = "sas"
device_id_pk = "device-id"

[[principal]]
uid = 988
name = "aziot-edge"

micahl@fooD:~$ id 988
uid=988(snap_iotedge) gid=994(snap_iotedge) groups=994(snap_iotedge),101(systemd-journal),121(docker),998(snap_aziotks),996(snap_aziotcs),995(snap_aziotid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant