Skip to content

Carve out sudo commands for sudoers NOPASSWD - #532

Closed
k0kubun wants to merge 1 commit into
ruby:mainfrom
k0kubun:enable-sudoers
Closed

Carve out sudo commands for sudoers NOPASSWD#532
k0kubun wants to merge 1 commit into
ruby:mainfrom
k0kubun:enable-sudoers

Conversation

@k0kubun

@k0kubun k0kubun commented Sep 1, 2026

Copy link
Copy Markdown
Member

This PR carves out the commands to modify CPU frequency and turbo boost as separate scripts so that we could let /etc/sudoers allow password-less sudo on them. It removes the need of password input without --no-sudo.

@k0kubun
k0kubun marked this pull request as ready for review September 1, 2026 23:01
@k0kubun
k0kubun requested a review from a team September 1, 2026 23:01

@XrXr XrXr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm iffy on the security implications of this:

When one chooses to not add the commands to the sudoer file, we no long show the leaf commands that the script runs. You'd need to inspect the script file, which can change with a git pull.

If the commands in the sudoer file points to the script in the git repo, you have the same issue with the scripts updating with git pull. I think generally sudoer points to read-only binaries.

For allowing to run password-less, it looks like sudoer allows filtering by commandline arguments. Isn't it already possible to add each command ruby-bench runs to sudoer without changing ruby-bench?

@k0kubun

k0kubun commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

When one chooses to not add the commands to the sudoer file, we no long show the leaf commands that the script runs. You'd need to inspect the script file, which can change with a git pull.

I'm fine with adding set -x to those scripts if that's what you want. You can also choose not to add anything to your sudoers.

I think generally sudoer points to read-only binaries.

I wonder what you would for these scripts. Would you specify all specific commands used in shell scripts?

Isn't it already possible to add each command ruby-bench runs to sudoer without changing ruby-bench?

Sure, I can live with that. I didn't think of describing the content of shell scripts in sudoers, which might not necessarily be stable and could accidentally break because of that, but with the expectation that we don't modify those scripts in the first place, it should work.

@k0kubun k0kubun closed this Sep 2, 2026
@k0kubun
k0kubun deleted the enable-sudoers branch September 2, 2026 18:18
k0kubun added a commit to k0kubun/dotfiles that referenced this pull request Sep 2, 2026
ruby/ruby-bench#532 was not accepted, so instead of pointing sudoers
at scripts in the ruby-bench checkout, list the exact commands that
lib/cpu_config.rb runs with sudo, relying on sudoers argument matching.
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.

2 participants