Content host enabled with fapolicyd rules is preventing the Remote Execution from Red Hat Satellite.
Environment
- Red Hat Satellite 6
- client has fapolicyd enabled
Issue
-
Unable to perform Remote Execution on the content host enabled with
fapolicydrules. -
Content host enabled with
fapolicydrules is preventing the Remote Execution from Red Hat Satellite. -
How to configure
fapolicydrules to allow Remote Execution withfapolicyenabled host. -
Remote Execution using non-root user on custom working directory fails with the following Error:
1: sh: line 1: /var/rexuser/foreman-ssh-cmd-b8616bdc-51da-4b28-bfdd-c8c1e1c06c27/script-wrapper: Operation not permitted 2: Exit status: 126 3: StandardError: Job execution failed -
It can also give error like :
1: sh: line 1: /var/tmp/foreman-ssh-cmd-b8616bdc-51da-4b28-bfdd-c8c1e1c06c27/script-wrapper: Operation not permitted 2: Exit status: 126 3: StandardError: Job execution failed
Resolution
-
Ensure the
fapolicydis configured on the content host has the following rule added:-
Create the
25-custom.rulesfile under /etc/fapolicyd/rules.d/ using your preferred text editor. -
Add following rule in the newly created
/etc/fapolicyd/rules.d/25-custom.rulesrule to add the directory where it is failing (You can find the directory location in the failed task output):
-
If it fails with /var/rexuser/*, then add :
```
allow perm=any all : ftype=text/plain dir=/var/rexuser/
```
If it fails with /var/tmp/* then add :
```
allow perm=any all : ftype=text/plain dir=/var/tmp/
```
-
Once added, notify
fapolicydof the policy update and restart the service by running the following commands:# chown root:fapolicyd /etc/fapolicyd/rules.d/25-custom.rules # fapolicyd-cli --update # systemctl restart fapolicyd # restorecon -RFv /etc/fapolicyd/rules.d/
Root Cause
- The Remote Execution from Satellite works when the
fapolicydis disabled on the content host. - The
fapolicydrules on the content host were preventing the Remote Execution from Red Hat Satellite.
Diagnostic Steps
-
Run debug with
fapolicydon affected host and review the debug logs. Troubleshooting problems related to fapolicyd. -
Debug will display what specific rule blocks the exact command that is being executed and is generally sufficient to create a rule to allow the blocked activity.
-
Below error observed in the fapolicy debug logs:
**rule=XX dec=deny_audit perm=execute auid=43674 pid=864299 exe=/usr/bin/bash : path=/var/rexuser/foreman-ssh-cmd-b8616bdc-51da-4b28-bfdd-c8c1e1c06c27/script-wrapper ftype=text/plain trust=0**
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.