-
Notifications
You must be signed in to change notification settings - Fork 232
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
fix: do not hard depend on sudo being installed #671
Conversation
similar to #193 the checkCommandRequirements function under checkEnv hard-depended on sudo, although doas can be picked as an $ESCALATION_TOOL.
@@ -125,11 +125,11 @@ checkDistro() { | |||
} | |||
|
|||
checkEnv() { | |||
checkCommandRequirements 'curl groups sudo' | |||
checkEscalationTool |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
checkPackageManager 'nala apt-get dnf pacman zypper' | ||
checkCurrentDirectoryWritable | ||
checkSuperUser | ||
checkDistro | ||
checkEscalationTool |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
It was not removed, just reordered.
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.
It was not removed, just reordered.
oops, was really tired when i typed that lol
@@ -125,11 +125,11 @@ checkDistro() { | |||
} | |||
|
|||
checkEnv() { | |||
checkCommandRequirements 'curl groups sudo' | |||
checkEscalationTool | |||
checkCommandRequirements "curl groups $ESCALATION_TOOL" |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
if we're starting to broach the topic of advanced privilege escalation tools, you should also look at refactoring this:
linutil/core/tabs/common-script.sh
Lines 91 to 107 in 466f875
checkSuperUser() { | |
## Check SuperUser Group | |
SUPERUSERGROUP='wheel sudo root' | |
for sug in ${SUPERUSERGROUP}; do | |
if groups | grep -q "${sug}"; then | |
SUGROUP=${sug} | |
printf "%b\n" "${CYAN}Super user group ${SUGROUP}${RC}" | |
break | |
fi | |
done | |
## Check if member of the sudo group. | |
if ! groups | grep -q "${SUGROUP}"; then | |
printf "%b\n" "${RED}You need to be a member of the sudo group to run me!${RC}" | |
exit 1 | |
fi | |
} |
doas might be configured to use wheel group over sudo group for privilege checks
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.
Both doas and sudo have commands for checking the current user's permission to run commands as root.
- sudo --validate
- doas -C /etc/doas.conf echo # requires a command and configuration file to be passed
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.
btw both of these need to be interactive so they aren't really an option.
Type of Change
Description
the checkCommandRequirements function under checkEnv function in common-script.sh hard-depended on sudo, although doas could be picked as an $ESCALATION_TOOL.
Testing
I activated acouple of the scripts from with the UI, there was no error for not having sudo on my sudo-less system anymore.
Impact
Allows doas to properly be used as an escalation tool now.
Issues / other PRs related
Additional Information
Checklist