Hi, I was wondering if building my own image would also let me skip the configuration phase of ubuntu core. This post says it should work.
When I try to SSH into the device with my image, though, I get a password prompt. Is there a way to skip the configuration phase from an image created via ubuntu-image?
Using:
model: ubuntu-core-18-pi-arm64
kernel: pi-kernel=18-pi
gadget: pi=18-pi
Slightly related question: can you also define some snap connections to be made in the image model?
With a recent version of ubuntu-image, you can use the --disable-console-conf option to turn off console-conf which then means the prompt to create a user is disabled and the device will not allow new users to be created.
Yep. A USB stick, or some other block device that shows up in /sys/block/$dev with removable set to 1.
The assetions in the auto-import.assert file need to either be signed by the same key as the model definition, or a key defined in the system-user-authority list from the model definition.
if you have a brand store you can also use an âagentâ or âconfigâ snap that uses the snapd-control interface ⊠that snap can then talk to the snapd API and create users via POST requests:
Was the ssh public key part of the assertion you loaded?
Hereâs a system-user assertion I used for something I was testing:
As it only includes a password, the created account only supports password authentication. If it also included a ssh-keys section, then it would also support ssh public key auth.
The extra assertions are fine. They shouldnât be necessary if youâre signing the system-user assertion with the same key as the model assertion, but it shouldnât hurt to include them.
If the account is correctly being created, perhaps try including a password in your assertion, and then see what gets placed in ~/.ssh/authorized_keys when you log in as the user?
I didnât need to set system-user-authority for the model in my testing when using the same authority/key for both assertions. That shouldnât be necessary.
The system-user-authority when not specified defaults to the brand-id IIUC, so it is possible that itâs not necessary here, but it seems to have made it work for @bart âŠ
If i do both, the ssh key is not even added to auto-import.assert. I guess I could have a look at .ssh/authorized by taking out the sd card (doing this on raspi) after it has made the system user with ssh key, and reading it at my laptop.
Well well well, it just worked this timeâŠ
Maybe it was my fault with the quotes around the ssh-key, and that I didnât actually put the correct version on the USB stick or so?
As described in the Ubuntu Core docs, configuring a device with system-user-authority: * means anyone with a Snap developer account can sign system-user assertions that will be accepted by the device.
In practice that means if Iâve got physical access to the device, Iâll be able to add a system user to the system by plugging in a USB thumb drive or similar. This might be desirable if the device owner is the only one with physical access and is different from whoever signed the model definition. If thatâs not the case, you probably want to limit who can create users.
I will be adding system users through snapd rest api. Where I just provide the email address. So If i add my id under system-user-authority, only my email id will be able to create a system user right?