-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Submission type
- Bug report
- Request for enhancement (RFE)
During recent discussions on the Fedora development mailing list, we have been discussing ways that we might generate a default hostname based off of the machine-id. Lennart suggested the following:
Please do not use MD5 anymore. And please calculate your ID as
SHA(x || k)
x refers to the machine id, "||" refers to concatenation and "k"
refers to some app-specific key (which is OK to be publically
known). It's important to concatenate the app-specific key, so that it
is not possible to map the machine IDs used by one app to the machine
IDs used by another..
It was also discussed later in the same thread that:
Which lies in the problem. If people are going to derive hashes from
it they will do so any way the want and most likely it will be leaked
out by someone doing a sum or just copying it etc. If there is
something 'unique' on a system, it will leak out eventually. All you
can do is try to design to drip out slowly or pour out all at once.
-- Stephen John Smoogen
My response here is that what we should do is have systemd provide an official API for generating unique values derived (repeatably) from the machine-id that are irreversible. By having it come from systemd, we can strongly encourage people to use this version as the safe approach and thereby discourage roll-your-own implementations or just direct use of the machine-id.
I suggest something similar to:
const char *
generate-machine-id(uint64_t app-specific-key,
char *acceptable_chars,
size_t num_characters)
(C example given, but probably we'd actually want this in D-BUS to be
language-agnostic.)