Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

SEP: Constrained Backends #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

SEP: Constrained Backends #71

wants to merge 3 commits into from

Conversation

monkz
Copy link

@monkz monkz commented Jun 22, 2023

Constraining Backends to allow collaboration with unprivileged users.

@monkz monkz requested a review from a team as a code owner June 22, 2023 23:33
@monkz monkz requested review from twangboy and removed request for a team June 22, 2023 23:33
@welcome
Copy link

welcome bot commented Jun 22, 2023

Hello! Thank you for submitting a Salt Enhancement Proposal! Our process is detailed in the README.md and more about the SEP Life-cycle. An Open Core Team member will be assigned to follow up and help guide this SEP soon and you will find the this in the Community Slack channel #sep.
Please be sure to review our Code of Conduct.
You can also check out some of our community
resources:
- Community Wiki
- Salt’s Contributor Guide
- Join our Community Slack
- IRC on LiberaChat
- SaltStack YouTube channel
- SaltStackInc Twitch channel


The last part, is still unpolished:
* Render (some) state files in a sandbox.
* Rendering itself can be harmful on the salt master, as the renderer (for example: py) might get access to data / pillars that is not in scope for the targeted minion. Restricting the information that is available.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't true. State rendering happens on the minion. There's no way to access other minions' pillars.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my mixup. I corrected it.
Had originally in mind to call the minion a submaster of sorts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like Github is not updating this PR with the latest commits i've pushed to my fork's master.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a solution for githubs lack of PR updates: https://github.com/orgs/community/discussions/16351#discussioncomment-6327770 Sorry for the notification noise.

Users able to change webserver.git aren't always the same users that should be able to modify backupservers.
- Apply these states constrained to be applied as user x.
- This and more could be accomplished by forcing a render pipeline, that acts as gateway that applies or filters wrapping the renderers with another renderer, that applies/filters parts. Or simply raise an exception to stop further processing of a configuration state.
- Allow just a certain list of renderers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this help? Every renderer can run arbitrary commands as root.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A wrapper can ensure that the input (the file from the file backend) and output of a rendering pipeline fits certain criteria. First scanning for arbitrary commands/functions/... in the state file and later checking for arbitrary commands/functions in the returned output.
Limiting the list of renderers should simply allow a salt administrator to concentrate on a limited set of features that should be allowed/denied/enforced - as you said every renderer can run arbitrary commands, but those can be issued with a particular format subset that a renderer can understand. I think, the py renderer would be excluded most of the time.

But you are correct for this, encapsulating a constrained renderer in a sandbox like environment would be favorable. Hence my suggestion to allow an salt administrator to sandbox the rendering within a renderer has only access to scoped data and limited acting room to have an effect on the host/minion.

- Examples of how the feature is used:
- Target minions on backends
Users able to change webserver.git aren't always the same users that should be able to modify backupservers.
- Apply these states constrained to be applied as user x.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? Fork a minion process running as the target user to run it? Most stuff would break, such as communication with the master.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Target minions on backends" would modify (enable / disable) overlays of the fileserver on the base of targeting - which is controlled by the master. It would allow to create a "view" on a environment. This is maybe a feature on its own.

The latter "Apply these states constrained to be applied as user x" is tricky . as it would have to postprocess the output of a renderer, to ensure something like "runas" is set.
As for communication: The minion would have to act as proxy/filter for the unprivileged subprocess.

- Target minions on backends
Users able to change webserver.git aren't always the same users that should be able to modify backupservers.
- Apply these states constrained to be applied as user x.
- This and more could be accomplished by forcing a render pipeline, that acts as gateway that applies or filters wrapping the renderers with another renderer, that applies/filters parts. Or simply raise an exception to stop further processing of a configuration state.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the rendering has no effect on the running of the rendered states.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the runtime can only run what it was given, i'll try to limit the output of the runtime by limiting the input of it.

@monkz monkz changed the title SEP: Constrained Backends SEP: Constrained Backends. Jun 30, 2023
@monkz monkz changed the title SEP: Constrained Backends. SEP: Constrained Backends Jun 30, 2023
@monkz monkz changed the base branch from master to revert-24-release-priority-labels June 30, 2023 22:55
@monkz monkz changed the base branch from revert-24-release-priority-labels to master June 30, 2023 22:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants