-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trying a different approach to requesting for admin privs #144
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider moving this to the command wrappers that check on whether a command is privileged? If we did that, it's universally the way we trigger for the password prompt if it's going to be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, if we request priv escalation (and it is granted), then we can remove the "sudo" on each of the commands themselves, which was my longer term rationale but I didnt; want to rewrite all of rig :)
Another thing I thought of was that a command could have as part of it;s config, the fact that i needs priv escalation and we can initiate that before we do anything to ensure the work can be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving to privilege escalation on the rig process and dropping sudo from all the commands is likely a better long term approach. I agree that would require a fairly substantial adjustment of the codebase that I don't think we want/need to undertake at the moment.
Adding the flag about the need for privilege elevation would be an inherent need since the current mechanism relies on spotting sudo in the command. Do you foresee an elevation/release pattern wrapping commands which need it or are you thinking once privileges are elevated all subsequent commands just run with the elevation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't quite thought it all the way through but my initial reaction is just request escalation around every block that needs it. the first will prompt for it and then subsequents will just just validate and will pass with no prompt if it is already escalated.
This raises an interesting question thought. If we have raised privs via
sudo -v
are only commands run with asudo
prefix done at that elevated level, or are all commands? meaning for these route deletes if asudo -v
has previously succeeded will the regular route command have the privs, or will it only need those privs if it is run viasudo
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My expectation would be that subsequent commands need sudo unless we change so that we escalate privileges on the running rig process. We're not actually elevating privileges here, instead what we're really doing here is forcing a prompt for the password for sudo if we need it via a "safe" command that doesn't have ill interactions with the spinner.
Then we assume subsequent commands won't need the password prompt because they execute within a short enough time window. If someone configures sudo such that you need the password each time I expect we'd be getting prompted on every command but we'd only execute the "safe to not interfere with the spinner" version of getting prompted once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do we want to get this in as a replacement for the
cat /dev/null
and work on the rest of it as we come across it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with pushing this one on through. I don't think the things we've talked about here are critical enough to block it, especially since we don't know yet whether we'll even go any further on trying to pull sudo out of all the commands.