Skip to content

fix(dns): stop re-prompting for the DNS sudoers rule on macOS#1102

Merged
geodro merged 1 commit into
mainfrom
fix/macos-dns-sudoers-reprompt
Jul 23, 2026
Merged

fix(dns): stop re-prompting for the DNS sudoers rule on macOS#1102
geodro merged 1 commit into
mainfrom
fix/macos-dns-sudoers-reprompt

Conversation

@geodro

@geodro geodro commented Jul 23, 2026

Copy link
Copy Markdown
Member

On macOS lerd start prompted to reinstall the DNS sudoers rule on every run, even when the installed /etc/sudoers.d/lerd was 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 -n always 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

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
@geodro
geodro requested a review from a team as a code owner July 23, 2026 06:29
@geodro
geodro merged commit 6d6a3e7 into main Jul 23, 2026
3 checks passed
@geodro
geodro deleted the fix/macos-dns-sudoers-reprompt branch July 23, 2026 07:10
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.

[macOS] Lerd prompts for sudo access to install DNS sudoers rule every time lerd start is run.

1 participant