Skip to content

Fall back to polkit when the DNS sudoers grant is missing - #7492

Merged
dhh merged 1 commit into
quattrofrom
dns-grant-fallback
Aug 19, 2026
Merged

dhh merged 1 commit into
quattrofrom
dns-grant-fallback

Conversation

@dhh

@dhh dhh commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #7472. Switching DNS providers from the network panel still does nothing on any machine that has not yet picked up the omarchy-settings build carrying etc/sudoers.d/omarchy-dns — no password prompt, no DNS change.

grant_covers re-implemented the sudoers rule in bash: one of the three stock providers, and %wheel. Both halves can hold on a machine where the rule is not installed at all. The file ships in the etc/ tree that omarchy-settings copies, so it arrives on a package upgrade rather than with bin/, and until then every wheel user answers yes to a grant they do not have. require_root then execs into sudo with nothing to fall back to:

sudo: a terminal is required to read the password

The panel runs bash -c omarchy-dns Cloudflare with no tty, so that is where it ends.

Ask sudo instead of predicting it. sudo -l on its own reports whether a command is permitted, which the blanket %wheel rule answers yes to for every argument — that objection from #7472 stands. But the long listing prints the matched entry's tags, and !authenticate is the grant and nothing else:

$ sudo -n -l -l /usr/bin/omarchy-dns Cloudflare
Sudoers entry: /etc/sudoers.d/03_dhh
    RunAsUsers: ALL
    Commands:
	ALL
    Matched: /usr/bin/omarchy-dns Cloudflare

$ sudo -n -l -l /usr/bin/timedatectl set-timezone Europe/Oslo
Sudoers entry: /etc/sudoers.d/omarchy-tzupdate
    RunAsUsers: root
    Options: !authenticate
    ...

Listing runs nothing, and under -n it prompts for nothing, so a machine without the rule falls through to polkit and gets a prompt on screen instead of dying silently. Both strings come from sudo's own listing formatter in sudoers.so, not from a locale-dependent message.

The provider list and the wheel check go away with it. Sudo owns that policy now, so the script stays correct if the rule is ever edited, removed, or scoped differently — the class of drift that caused this.

The test's stubbed id and group logic go too, replaced by a case that pins the regression: grant absent, provider granted, no terminal → polkit rather than a dead sudo.

Note for anyone hitting this today: no migration is needed or wanted. Writing the file from one would leave it unowned, and pacman would then refuse the eventual omarchy-settings upgrade with "exists in filesystem" — the trap that forced the --overwrite list in omarchy-upgrade-to-quattro. It lands on its own with the next settings build.

🤖 Generated with Claude Code

grant_covers re-implemented etc/sudoers.d/omarchy-dns in bash -- one of
the three providers, and %wheel -- but never asked whether the rule was
installed. It ships in the etc/ tree that omarchy-settings copies, so
every machine still on an older settings package answers yes to a grant
it does not have. require_root then execs into sudo with no way back,
and the panel's one-click toggle dies on a password prompt it has no
terminal to show.

Ask sudo instead. `sudo -l` alone reports whether a command is
permitted, which the blanket %wheel rule answers yes to for everything,
but the long listing prints the matched entry's tags -- !authenticate is
the grant and nothing else. It runs nothing, and under -n it prompts for
nothing, so a machine without the rule falls through to polkit and gets
a prompt on screen.

The provider list and the wheel check go away with it; sudo owns that
policy now, and it stays right if the rule is ever edited or removed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 19, 2026 12:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@dhh
dhh merged commit 1e70cca into quattro Aug 19, 2026
3 of 4 checks passed
@dhh
dhh deleted the dns-grant-fallback branch August 19, 2026 12:59
sgruendel pushed a commit to sgruendel/omarchy that referenced this pull request Aug 22, 2026
grant_covers re-implemented etc/sudoers.d/omarchy-dns in bash -- one of
the three providers, and %wheel -- but never asked whether the rule was
installed. It ships in the etc/ tree that omarchy-settings copies, so
every machine still on an older settings package answers yes to a grant
it does not have. require_root then execs into sudo with no way back,
and the panel's one-click toggle dies on a password prompt it has no
terminal to show.

Ask sudo instead. `sudo -l` alone reports whether a command is
permitted, which the blanket %wheel rule answers yes to for everything,
but the long listing prints the matched entry's tags -- !authenticate is
the grant and nothing else. It runs nothing, and under -n it prompts for
nothing, so a machine without the rule falls through to polkit and gets
a prompt on screen.

The provider list and the wheel check go away with it; sudo owns that
policy now, and it stays right if the rule is ever edited or removed.

Co-authored-by: Claude Opus 5 <[email protected]>
dhh added a commit that referenced this pull request Aug 23, 2026
grant_covers re-implemented etc/sudoers.d/omarchy-dns in bash -- one of
the three providers, and %wheel -- but never asked whether the rule was
installed. It ships in the etc/ tree that omarchy-settings copies, so
every machine still on an older settings package answers yes to a grant
it does not have. require_root then execs into sudo with no way back,
and the panel's one-click toggle dies on a password prompt it has no
terminal to show.

Ask sudo instead. `sudo -l` alone reports whether a command is
permitted, which the blanket %wheel rule answers yes to for everything,
but the long listing prints the matched entry's tags -- !authenticate is
the grant and nothing else. It runs nothing, and under -n it prompts for
nothing, so a machine without the rule falls through to polkit and gets
a prompt on screen.

The provider list and the wheel check go away with it; sudo owns that
policy now, and it stays right if the rule is ever edited or removed.

Co-authored-by: Claude Opus 5 <[email protected]>
(cherry picked from commit 1e70cca)
@dhh dhh mentioned this pull request Aug 23, 2026
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
grant_covers re-implemented etc/sudoers.d/omarchy-dns in bash -- one of
the three providers, and %wheel -- but never asked whether the rule was
installed. It ships in the etc/ tree that omarchy-settings copies, so
every machine still on an older settings package answers yes to a grant
it does not have. require_root then execs into sudo with no way back,
and the panel's one-click toggle dies on a password prompt it has no
terminal to show.

Ask sudo instead. `sudo -l` alone reports whether a command is
permitted, which the blanket %wheel rule answers yes to for everything,
but the long listing prints the matched entry's tags -- !authenticate is
the grant and nothing else. It runs nothing, and under -n it prompts for
nothing, so a machine without the rule falls through to polkit and gets
a prompt on screen.

The provider list and the wheel check go away with it; sudo owns that
policy now, and it stays right if the rule is ever edited or removed.

Co-authored-by: Claude Opus 5 <[email protected]>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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.

3 participants