Helpers API PoC (NB : this is not intented to be merged)#2185
Draft
Helpers API PoC (NB : this is not intented to be merged)#2185
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The problem
Followup of a discussion / experiment these past few days : I was doing some research about packaging v3, specifically the fact that
of course there's the
before/after_<action>_as_rootbut it'll probably be cumbersome to rely on this only for recurring actions such as updating settings etc ... there's also the idea of adding temporary sudo permissions but not great from a security pov because it's hard to properly define the perimeter of what should be allowed and what shouldnt be (+ the risk that the temporary sudo isnt reverted somehow)Anyway I had this idea that the bash script could "order" some actions to the yunohost process (which does run as root). I made a POC to add the proper file descriptors for bi-directional communication between the script and the yunohost process, it seems to be working fine so i think i'll continue digging this idea
Solution
...
PR Status
...
How to test
This PR + this test snippet :
And then assuming the snippet was created as
/root/tests.sh:yield :
(not sure why we don't see the messages from the core but whatev)