I need to be able to repeatably, non-randomly, uniquely identify a server host, which may be arbitrarily virtualized and over which I have no control.
- A MAC address doesn't work because in some virtualized environments, network interfaces don't have hardware addresses.
- Generating a state file and saving it to disk doesn't work because the virtual machine may be cloned, thus duplicating the file.
- The server's SSH host keys may be a candidate. They can be cloned like a state file, but in practice they generally aren't because it's such a security problem that it's a mistake not often made.
- There's also /var/lib/dbus/machine-id, but that's dependent on dbus. (Thanks Preetam).
- There's a cpuid but that's apparently deprecated. (Thanks Bruno Aguirre on Twitter).
- Hostname is worth considering. Many systems like Chef already require unique hostnames. (Thanks Alfie John)
I'd like the solution to persist a long time, and certainly across server reboots and software restarts. Ultimately, I also know that users of my software will deprecate a host and want to replace it with another, but keep continuity of the data associated with it, so there are reasons a UUID might be considered mutable over the long term, but I don't particularly want a host to start considering itself to be unknown and re-register itself for no reason.
Are there any alternative persistent, unique identifiers for a host?