Skip to content

Fail closed when passwordless sudo expiry cannot arm - #9387

Open
ErikMelton wants to merge 1 commit into
quattrofrom
security/nopasswd-expiry-fail-closed
Open

Fail closed when passwordless sudo expiry cannot arm#9387
ErikMelton wants to merge 1 commit into
quattrofrom
security/nopasswd-expiry-fail-closed

Conversation

@ErikMelton

@ErikMelton ErikMelton commented Aug 31, 2026

Copy link
Copy Markdown
Member

Supersedes #7990 and closes #8218.

This keeps the boot cleanup proposed by @Adolanium in #7990, while closing the fail-open path where the unrestricted sudoers grant was already live before systemd-run had successfully armed its expiry. The commit credits @Adolanium as co-author. The original reboot-persistence report came from @lbonvarl in #8218.

Changes

  • remove stale Omarchy passwordless-sudo grants during early boot with a boot-only tmpfiles rule
  • revoke the grant and return failure if initial timer creation fails
  • revoke an existing grant if replacement timer creation fails while extending the window
  • use rm -f in the transient service so successful expiry units do not remain failed
  • document restart cleanup without claiming that already-started privileged processes are revoked
  • exercise initial and replacement timer failures through the real command
  • execute the shipped tmpfiles rule against a disposable alternate root, both with and without --boot

Testing

  • bash test/shell.d/nopasswd-sudo-expiry-test.sh
  • ./test/cli
  • ./test/shell — the new test passes; the aggregate retains five unrelated environment failures in config-test.sh, launch-about-test.sh, network-qr-test.sh, snapper-test.sh, and unowned-system-paths-test.sh

Reported-by: @Adolanium , _SiCk // afflicted.sh

Remove stale passwordless sudo grants during boot and revoke a live grant immediately if its transient expiry timer cannot be created. Exercise both failure paths and the shipped tmpfiles rule against a disposable root.

Co-authored-by: Adolanium <94890352+Adolanium@users.noreply.github.com>

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.

Pull request overview

Adds fail-closed expiry handling and boot cleanup for temporary passwordless sudo grants.

Changes:

  • Revokes grants when timer creation fails.
  • Removes stale grants during boot.
  • Adds documentation and shell tests for expiry behavior.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
bin/omarchy-sudo-passwordless Adds timer failure cleanup.
etc/tmpfiles.d/omarchy-nopasswd-sudo.conf Removes stale grants at boot.
manual/48-security.md Documents restart cleanup.
test/shell.d/nopasswd-sudo-expiry-test.sh Tests timer failures and boot cleanup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Passwordless sudo expiry is lost on reboot, leaving NOPASSWD active

2 participants