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.
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.
Two things:
I'd prefer if we were explicit in the perms, from your bug report that would mean
execute
andopen
.From the report this is calling
/usr/share/gems/gems/foreman_remote_execution-12.0.7/extra/cockpit/foreman-cockpit-session
which seems odd that we call an executable at that path rather than putting it somewhere more standard. @ekohl do you think we should move this file instead?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.
We actually do ship it in
/usr/sbin
:https://github.com/theforeman/foreman-packaging/blob/708efe199b7e34a5cfe988c979196ad650fc8728/packages/plugins/rubygem-foreman_remote_execution/rubygem-foreman_remote_execution.spec#L84
theforeman/foreman-packaging@f4ac262 changed it around, but the Redmine issue mentioned Satellite 6.15 which is Foreman 3.9. That commit only made it into 3.10 so I think this is fixed upstream, but needs a cherry pick.
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.
Excellent, then I believe that is the correct fix and an additional rule should not be needed.
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.
IIRC, the default rules only allow shell script execution in /usr/sbin so extra rules might still be needed regardless. Need to test to confirm
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.
I did a quick test by manually remove the symlink and move the foreman-cockpit-session to /usr/sbin and then run:
fapolicyd debug log:
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.
This is not necessarily a fair test because there are rules about trusting files from RPMs that this is likely to fall under. I think this test needs to be performed on the latest Foreman or the next Satellite release.
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.
So I need to add this rules to make it works.
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.
You are right. no rules needed then. It appears to work in Satellite 6.16
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.
As in, you were able to test this? Should I close this?
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.
Yup. I think we can close this. Thanks.