A reliable unique ID on a snapd based system

I have multiple projects that need the underlying system to identify itself to a server. Currently I don’t want to add any kind of authentication complexity, so I think a “unique ID” is what is needed here.

dbus has a machine ID (/etc/machine-id) which is unique for an install but I am not sure if Ubuntu Core (i.e. non-desktop) have dbus.

Can we have some kind of reliable system ID that only gets generated on first boot (or equivalent) and is reliable ?

EDIT
I just verified on an UbuntuCore system and it does have dbus. So I think a simple fix would be to have read access to /var/lib/dbus/machine-id and this should work on all systems.

EDIT 2
Sorry, I just found out that /etc/machine-id is readable in a confined snap as well.

More on IDs here: http://0pointer.de/blog/projects/ids.html

1 Like