-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Do not hard-fail on process owner check #177
Do not hard-fail on process owner check #177
Conversation
`ps` might be missing in $PATH, or fan2go might be running as a non-root user with write access to the subsystem. I don't think it's reasonable to crash the program for a simple uid check that might actually be wrong. This will eventually crash later when trying to modify paths as non-root anyway.
Hey, thx for opening the PR! ❤️ There are definitely scenarios in which you do not need to use root permissions for running fan2go, so I can absolutely see why we need to improve the current logic 👍
I agree, this code is a remnant from the early days and also my specific usage. However, I think we need to be a bit more specific here, since there is an additional permission related check done while evaluating the configuration file meant to protect users against malicious configuration editors. Did you consider this?
Did you validate this? Because I am not 100% sure what the current behavior would be 🤔 |
I did not, "crash" might be the wrong word here. I meant that I/O while trying to set the PWM will fail in a way or another and hopefully bubble up in the logs, so it'll be pretty obvious something's wrong.
I'm not sure what malicious editor protection you're referring to here, sorry, I only skimmed at the surface of fan2go – thanks btw, what a pleasure it was jettisoning that fancontrol garbage! I don't really mind how this check is done, I just believe depending on a subprocess invocation & a (very common but not necessarily available) Linux util is overkill for a simple user warning message. Maybe Go has a way to report its own uid, like this? Feel free to close this PR and come up with something better :) |
…allow running fan2go as non-root user
Good find! Seems like a much more reasonable approach 👍
I think we can use it for now, I will think about other special cases in a later PR. |
ui.Warning("Unable to verify process owner: %v", err) | ||
} | ||
if owner != "root" { | ||
ui.Info("fan2go is running as a non-root user '%s'. If you encounter errors, make sure to give this user the required permissions.", owner) |
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.
Nice! Making it non-fatal makes a lot of sense actually.
ps
might be missing in $PATH, or fan2go might be running as a non-root user with write access to the subsystem. I don't think it's reasonable to crash the program for a simple uid check that might actually be wrong. This will eventually crash later when trying to modify paths as non-root anyway.