Skip to content

Let users choose passwordless sudo duration - #14435

Merged
dhh merged 8 commits into
quattrofrom
passwordless-sudo-duration
Oct 7, 2026
Merged

dhh merged 8 commits into
quattrofrom
passwordless-sudo-duration

Conversation

@dhh

@dhh dhh commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Ask how long passwordless sudo should remain enabled with a Gum picker offering 15 minutes, 1 Hour, 1 Day, or Permanently. Running the command again disables active access, and explicit minute arguments remain supported alongside permanent. Permanent access always requires confirmation. Enabling access prompts for the sudo password only once.

Show the passwordless sudo icon in red in the menu bar while access is active, using the same hover and layout behavior as the other indicators. Place it before Dictation in the default indicator order. Clicking the active icon disables access in the background without opening a terminal. The indicator normally reads sudo policy and falls back to a noninteractive status check when listings require authentication. Neither path prompts or refreshes cached credentials, and the indicator updates as access expires.

Permanent grants survive reboots and temporary-grant cleanup until explicitly disabled. Timed grants retain their native sudoers deadlines and expiry timers, with uninterrupted renewal. Interrupted duration switches remain inspectable and revocable, and password-required sudo listings do not block grant changes. Update the manual and reference documentation to cover both durations and the indicator.

Reviewed by Claude Opus 5.5

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical risk] Adds permanent passwordless sudo and changes sudo policy enforcement.

The PR appears safe to merge, with both earlier findings addressed and no new issues found.

What we checked:

  • Interrupted switches stay revocable: read_grant accepts matching generated rules left by an interrupted switch. cleanup_uid_locked removes both forms, and expiry leaves permanent access intact.
  • Listings no longer block changes: A failed listing falls back to a noninteractive __status call. Active access can be disabled directly; unavailable authentication leads to the confirmed enable flow.

Summary

Adds timed and permanent passwordless sudo choices, plus a red menu bar indicator that can disable access.

  • Permanent grants survive reboots and temporary cleanup.
  • Interrupted duration switches remain inspectable and revocable.
  • Password-required sudo listings no longer block grant changes.
  • The latest change only removes the introductory message. Both earlier findings are addressed.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Run command] --> B{Access active?}
  B -->|Yes, no duration supplied| C[Disable access]
  B -->|No| D[Choose duration and confirm]
  D --> E{Permanent?}
  E -->|Yes| F[Publish permanent rule]
  E -->|No| G[Publish timed rule and arm expiry]
  H[Menu bar checks access] --> I[Show red icon while active]
  I -->|Click| C
Loading

Reviews (5) · Last reviewed commit: "Start passwordless sudo setup with the d..." · Reviewed by Greptile

Comment thread bin/omarchy-sudo-passwordless Resolved
Comment thread bin/omarchy-sudo-passwordless Resolved
@dhh
dhh merged commit d9b970d into quattro Oct 7, 2026
1 check passed
@dhh
dhh deleted the passwordless-sudo-duration branch October 7, 2026 12:42
@jandrusk

jandrusk commented Oct 7, 2026

Copy link
Copy Markdown

Nice to have the picker and the red indicator. A few things I noticed reading the diff:

  1. Probe noise. The indicator runs sudo -n -N -l -l every 5 s. As far as I know, sudoers logs each list request as a COMMAND=list entry, so that would add roughly 17k sudo journal lines a day and bury real sudo activity. Worth checking with journalctl -t sudo -f while the bar is up. A longer interval, or polling only while a grant is known to be active and refreshing on indicatorHost.refresh() otherwise, would cut that down a lot.

  2. A failed probe hides the grant. granted = exitCode === 0, so if sudo -l fails for any reason the icon shows inactive. The docs say a UI "must not turn an inspection failure into a claim that no grant exists". Something like this would let the indicator show an unknown state:

if [[ ${1:-} == "--active" ]]; then
  (($# == 1)) || usage
  policy=$(/usr/bin/sudo -n -N -l -l -- "$INSTALLED_SELF" __status "$(/usr/bin/id -u)" 2>/dev/null) || exit 2
  /usr/bin/grep -q '!authenticate' <<<"$policy" && exit 0
  exit 1
fi

…and in QML, granted: exitCode === 0 plus unknown: exitCode === 2, with unknown drawn as active (that's what #14413 does).

  1. Permanent grants and package removal. The docs say it, but pacman -R omarchy-settings leaves a NOPASSWD: ALL rule behind with no Omarchy tool left to remove it. Since the revoke hook already fires on both Upgrade and Remove, a separate Operation = Remove hook (or an operation check) that also clears 99-omarchy-permanent-nopasswd-* would keep upgrades intact and still make uninstall clean.

Heads-up: #14413 overlaps this (same PasswordlessSudo.qml indicator, from #14411).

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