Trying to find an easy and unprivileged way to obtain fingerprints from the execution environments, I realised there was no single, easy way to obtain those fingerprints.
This software project provides the machinery to gather several kind of host fingerprints:
-
gethostid / hostid. This is the most ancient standardised method to obtain a host fingerprint, which is currently deprecated in favour of machine-id, so most of the hosts are returning
007f0100. -
machine-id. The file
/etc/machine-idcontains the value initialised by either systemd-machine-id-setup or dbus-uuidgen. There are more details available at https://wiki.debian.org/MachineId . This system is the current de-facto standard, but it is unreliable on containerised environments (like docker or singularity instances) and high availability host environments, where the hosts are cloned from a based one and the contents of the file are not re-generated. -
Location: in several scenarios executions can happen both at the host and singularity containerised environments, giving the very same values for the
machine-id, so it is worth detecting whether the execution happened within a container instance. -
Fingerprints derived from block devices and mounted filesystems: These fingerprints are both cheap and accurate, because they are based on disk ids, disk uuids and partition uuids located at
/dev/disk/. Depending on the isolation of the location, they could be unavailable.