resolve question marks in /etc/hostname to characters hashed from machine ID#36647
Merged
yuwata merged 4 commits intosystemd:mainfrom Mar 11, 2025
Merged
resolve question marks in /etc/hostname to characters hashed from machine ID#36647yuwata merged 4 commits intosystemd:mainfrom
yuwata merged 4 commits intosystemd:mainfrom
Conversation
Member
Author
|
i guess we could increase the entropy a bit by not using a 16 character alphabet, but a 32 character alphabet for the characters we insert, i.e. |
d333d91 to
c774bf6
Compare
poettering
added a commit
to poettering/particleos
that referenced
this pull request
Mar 7, 2025
This depends on systemd/systemd#36647 This gives every instance of ParticleOS a slightly different hostname (well, within the bounds of 2^32), which is quite useful when operating with a number of them.
poettering
added a commit
to poettering/particleos
that referenced
this pull request
Mar 7, 2025
This depends on systemd/systemd#36647 This gives every instance of ParticleOS a slightly different hostname (well, within the bounds of 2^32), which is quite useful when operating with a number of them.
qhill
reviewed
Mar 7, 2025
9ae0560 to
1f325c5
Compare
yuwata
requested changes
Mar 9, 2025
Member
yuwata
left a comment
There was a problem hiding this comment.
LGTM. But several minor requests.
1f325c5 to
099e317
Compare
…stname-setup.c In one of the next commits we'd like to introduce a concept of optionally hashing the hostname from the machine ID. For that we we need to optionally back gethostname_full() by code involving sd-id128, hence let's move it from src/basic/ to src/shared/, since only there we are allowed to use our public APIs.
…replaced by hash value from /etc/machine-id
099e317 to
06967d4
Compare
Member
|
All mkosi failures are unrelated, and hopefully half of them will be fixed by #36691. |
YHNdnzj
reviewed
Mar 11, 2025
| * public information to be broadcast on the network, while the hostname certainly is. */ | ||
|
|
||
| for (char *n = name; *n; n++) { | ||
| if (*n != '?') |
yuwata
added a commit
to yuwata/systemd
that referenced
this pull request
Mar 11, 2025
daandemeyer
pushed a commit
to systemd/particleos
that referenced
this pull request
Mar 12, 2025
This depends on systemd/systemd#36647 This gives every instance of ParticleOS a slightly different hostname (well, within the bounds of 2^32), which is quite useful when operating with a number of them.
ddstreet
pushed a commit
to ddstreet/particleos
that referenced
this pull request
Mar 14, 2025
This depends on systemd/systemd#36647 This gives every instance of ParticleOS a slightly different hostname (well, within the bounds of 2^32), which is quite useful when operating with a number of them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
so i have a bunch of particle os instances around, that i frequently factory reset. and it's confusing, since they all have the same name. Let's do something about this, and extend the hostname setup logic a bit to deal better with "cattle" rather than "pet" deployments. Specifically: if a hostname in /etc/hostname contains a bunch of question marks we'll replace it with hex chars hashed from the machine id.
This allows us to do something like this:
and we'll end up with a hostname like
funky-baf4-b653-e230