-
Notifications
You must be signed in to change notification settings - Fork 35
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
RFC: support doas (and maybe su) #273
base: master
Are you sure you want to change the base?
Conversation
Hey :) Thanks a lot for your merge request! Cool to see, that there are people (besides me) who still use aurman. I will definitely come back to this MR and give feedback and I don't see a reason why But currently I'm a bit busy, so it may take a few days (weeks?). |
That's great to hear, no need to hurry (even a low number of months is okay for me). I figured out we could also implement this using configuration options instead (like in makepkg) to support any authentication method:
This would have the disadvantage of requiring users to configure it. |
Hey :) I did not forget about this... :D Are you still interested in this Pull request? |
Hi, yes I am, I also did not forget ;) |
So, first things first: Supporting I like the idea of supporting any authentication method, but I don't know enough about that, in order to be really sure, that what we are doing is sensible. So let's stick to Important is one thing: Whatever we do now, the default, if the user changes nothing, has to remain at I guess we only have to support Regarding testing all of this: I'm currently working on a new project, which is private on GitHub for now (but will be publicly available in a few days I guess), and that new project has a nice CI and is actually using Since it's your idea to implement |
What exactly do you mean by "about that", are you concerned about the security implications of users plugging in some random privilege escalation method? I think the user should know what they do if they adjust this.
what if the system does not have sudo installed? (thats what I have) would you be okay detecting this?
Works for me.
Sure, if you don't want to take over. The current implementation works for me already as written before. I'll get around to implement the configuration option after clarifying if we shouldn't just automatically detect doas. By the way I think sudo should be preferred if both are installed, a configuration option works for me as well, no strong feelings here (but I think its more slick if it just works in both cases without configuration. Giving the users the option to plug in arbitrary stuff would also future proof aurman, no need to change aurman to implement escalation methods then). |
E. g. I don't know why a string and two arrays are needed in the aurman config.
Why would we want to detect that? Don't you simply get an error message telling you that sudo isn't installed, if you try to execute aurman and sudo isn't installed?
In theory I'd like to take over, but I don't have the time for it, and since I use sudo, aurman already gives me everything I need. For me there is no need to support anything else.
If sudo and doas are installed, and the user wants to use doas, we still need the config, don't we? |
One more thing: https://wiki.archlinux.org/title/Arch_User_Repository#Getting_started So I'd argue: Detecting whether I'm so hesitant because Overall I'm a huge fan of abstract solutions, covering all possible cases. |
I just remembered that there are quite a lot of people, who know a lot more about the AUR, It's been a few years, but maybe one of them is interested in this discussion and willing to help? :) Let me summarize:
It boils down to: I don't know anything about the whole "authentication topic", that's why I'm hesitant to decide anything. |
I believe it will cover everything. And agree that you should not merge something you do not understand.
Yeah thats kinda what happens without my patch. But its annoying to reconfigure all tools to use another method. I do agree its non standard and that it is a setup not supported by archlinux (base-devel being required and all, I also removed some other packages I deemed not required like
Not going on is for me okay as well, as long as upstream development stays slow its not a hassle to update the changes without merging. Your decision.
Yeah, I wanted to say (like above) that having automatic fallback might be nice (it is for me).
Works for me, a config flag suffices for me too.
Not trying to break it. And I'm willing to help you out especially when it affects something I touched. But of course I can not provide a SLA.
And I like designing solutions that get not too ugly and cover all cases required :)
We need 2 due to:
Search for pacman_auth in man makepkg.conf. As far as I understand (did not read the source code for this) its a single string prefixed to commands (or interpolated, when using
Well makepkg should not be run as root. but it still needs root privileges to install and remove packages (freshly built or when installing dependencies). You are supposed to have it only escalate privileges when doing that and not expose all of the code to root user privileges. As far as I know
All in all we need some way to escalate privileges to install packages or do other actions only root should be able to. |
Hope this clears most of your questions and is not a too long read |
I didn't check the entire discussion, but I'd just do like
For Things get more complicated when you want to keep the "sudo loop" support ( An alternative solution - which also doesn't leave all commands in a PKGBUILD with free root access, due to sudo/doas persistence - is to run |
Don't worry about that, I like to read and I like to write, there is no such thing as "too long to read" ;D Now that I've read everything and thought about it, I have no problem supporting "any authentication method". How about the following: Unless I missed something, that should be all we need. Or do you still see the need to detect if sudo is installed? |
Hey :) Just wanted to ask, how it's going. If you want to finish the PR, and simply didn't find the time until now - everything's fine
but I guess since I also wrote
one could think, that I changed my mind ;D In a few weeks I'll come back to
I should have the time to implement the PR by myself, then. And if you have any more ideas regarding "all of this", now is the time for it ;D |
Hi @polygamma, I'm just busy and did not come around to it yet, did not forget ;) Feel free to ask me questions and I could also try to review your changes. |
Just a small update...
The project is public now: https://github.com/polygamma/auv |
Hi @polygamma, thanks for informing me, looks interesting (but due to me no longer using XOrg its not for me right now). Here's some more good news. I finally found some time and am implementing it right now. :)
Here's how option one could look like: [privilege_escalation]
# sudo
escalation_command=['sudo']
noninterative_params=['--non-interactive']
test_params=['-v']
# doas
escalation_command=['doas']
noninterative_params=['-n']
test_params=['/bin/test']
# su
escalation_command=['su']
# noninterative_params and test_params are not supported therefore sudo_loop is not Option 2 [privilege_escalation]
# sudo
interactive=['sudo']
noninterative=['sudo', '--non-interactive']
test_interative=['sudo', '-v']
test_noninterative=['sudo', '-v', '--non-interactive']
# doas
interactive=['doas']
noninterative=['doas', '-n']
test_interative=['doas', '/bin/test']
test_noninterative=['doas', '-n', '/bin/test']
# su
interactive=['su']
# noninterative, test_interative and test_noninterative are not supported by su therefore sudo_loop is not Design decisions:
|
Fantastic :) |
Yes I do. it has the slight downside of not being as flexible. But I do not know if you would ever need that. The implementation for option 1 will mix the arrays together to generate the 4 arrays internally (I think that's reasonable) Quickly copypasted example of that SudoLoop.interactive_command = AurmanConfig.aurman_config['privilege_escalation']['escalation_command']
noninterative_params = AurmanConfig.aurman_config['privilege_escalation']['noninterative_params']
test_params = AurmanConfig.aurman_config['privilege_escalation']['test_params']
SudoLoop.noninteractive_command = [*SudoLoop.interactive_command, *noninterative_params]
SudoLoop.test_interative = [*SudoLoop.interactive_command, *test_params]
SudoLoop.test_noninterative = [*SudoLoop.interactive_command, *noninterative_params, *test_params] |
So do I :) |
So I got a basic implementation down and working for me:
|
* doas looping only works when persist is set in doas.conf * configuration via config file only for now
… a dependency loop
Very nice :) I will do the following: Over the next couple of days, when I have the time, I'll create a new branch in the new project of mine. |
The most recent push just removed a PKGBUILD change that was for local testing, sorry. Todo:
|
Also: no rush. Thanks for the patience and again for aurman :) |
Everything seems good. |
Hello polygamma,
I'm still using aurman and am very grateful for you to continue signing your commits (and releases)!
aurman is still the best AUR helper to me, thanks a ton for continuing!
Now to the actual changes:
aurman is one of the few programs without support for doas on my systems.
This is a quick shot at getting supporting doas in aurman, I can clean up if there's interest.
Notes
sudo_method
was put into theSudoLoop
class in utilities.py to store the chosen method to get root.This might be a bit ugly to you, if not there were would you like it?
utilities.py
'sacquire_sudo
, this can be merged, but might be less readable.search_and_print
fromutilities.py
toaur_utilities.py
to prevent a dependencyloop(loop was: aur_utilities => wrappers => utilities => aur_utilities)
This was put into a separate commit to make it more easy to read.
When I was fixing the other imports I also removed some unused ones.
su
is implemented, but completely untested!I could throw that out, guess there probably is not a lot of interest.