fix(dns): stop re-prompting for the DNS sudoers rule on macOS#1102
Merged
Conversation
The passwordless-liveness probe that decides whether the DNS sudoers drop-in is still installed lived in the platform-shared setup code and was hardcoded to resolvectl, a systemd tool that exists only on Linux. On macOS the drop-in never grants resolvectl, so sudo -n always refused with "a password is required", that refusal read as a conclusive "the grant is gone", and lerd rewrote the sudoers file, prompting for sudo, on every lerd start even when the installed rule was byte identical to the recorded hash. Make the probe command and its arguments platform specific. Linux keeps resolvectl --version. macOS probes with mkdir -p /etc/resolver, which matches a rule the drop-in already grants verbatim and is idempotent, so it succeeds silently when the grant is live and only reports the grant gone when sudo genuinely refuses. Refs #1101
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.
On macOS
lerd startprompted to reinstall the DNS sudoers rule on every run, even when the installed/etc/sudoers.d/lerdwas byte identical to the recorded hash.The cause is the passwordless-liveness probe that decides whether the drop-in is still active. It lived in the platform-shared setup code and was hardcoded to resolvectl, a systemd tool that only exists on Linux. On macOS the drop-in never grants resolvectl, so
sudo -nalways refused with "a password is required", which the probe read as a conclusive "the grant is gone", forcing a rewrite and a sudo prompt every time.This makes the probe command platform specific. Linux keeps resolvectl. macOS probes with
mkdir -p /etc/resolver, a command the drop-in already grants verbatim and which is idempotent, so it succeeds silently when the grant is live and only reports it gone when sudo genuinely refuses.Refs #1101