/etc/machine-id is identical between Linodes
We are in the process of rolling out a security software (Cylance) that is using the string in /etc/machine-id to identify the VMs connecting to its management point. I've ran a test spinning up two Linodes of the same image in different data centers, and discovered the string was the same for both.
$ cat /etc/machine-id
da388a7e3b43469bbd1106e655f4fe20
I was wondering if there is any way to deploy a fresh Linode with a unique machine-id?
1 Reply
That machine-id is from the initial image we supply for that distribution, which is why it’s the same regardless of where it’s deployed. To give an image its own unique machine-id (without manually changing it) you would need to deploy from a custom StackScript that includes commands to delete and regenerate the string.
# if both /var/lib/dbus/machine-id and /etc/machine-id exist
# their strings should match
#
# otherwise just regenerate /etc/machine-id
FILE=/var/lib/dbus/machine-id
if [ -f "$FILE" ]; then
rm -f /etc/machine-id
rm -f /var/lib/dbus/machine-id
dbus-uuidgen --ensure
systemd-machine-id-setup
else
rm -f /etc/machine-id
systemd-machine-id-setup
fi
At the moment, there isn't another way of doing this via the Linode Manager, but it may be something in the future.