Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fabrics: Use /etc/machine-id as a fallback source for system UUID #956

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tbzatek
Copy link
Contributor

@tbzatek tbzatek commented Feb 11, 2025

In case when system DMI data are unavailable or bogus, fall back to reading /etc/machine-id before resorting to generating a random UUID.

The machine-id file typically contains persistent and unique machine UUID stable for the OS instance.

See https://www.freedesktop.org/software/systemd/man/latest/machine-id.html

Note: while this appears to be part of systemd, the file is present on my OpenRC system, likely created by elogind.

TODO:

  • The specs say the value is confidential and is supposed to be hashed before used publicly. The suggested sd_id128_get_machine_app_specific(3) function just performs SHA256 hash with an arbitrary application ID value, however given that openssl use is optional and this should work in a minimal environment, we could perhaps xor the value with some const. Not sure how useful would that be though.

In case when system DMI data are unavailable or bogus, fall back to
reading /etc/machine-id before resorting to generating a random UUID.

The machine-id file typically contains persistent and unique machine
UUID stable for the OS instance.

See
https://www.freedesktop.org/software/systemd/man/latest/machine-id.html

Signed-off-by: Tomas Bzatek <[email protected]>
@igaw
Copy link
Collaborator

igaw commented Feb 11, 2025

libnvme already has a dependency to openssl, so it would be possible to use the sha algo from there, see the _tls_key functions. It wouldn't be too hard to get this working if openssl is present.

And when the library is not available just don't support /etc/machine-id? If someone is actually using the library on a small machine, it would be surprised if nvmeof is a topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants