Running on Foreman 3.3/Katello 4.5.
Have started to run some tests on a hardened AlmaLinux 9 and for some reason I get this error from a remote execution run:
1: sh: line 1: /opt/fmrex/foreman-ssh-cmd-e77aa532-a5d4-4b18-9004-a97f540427f2/script-wrapper: Operation not permitted
2: Exit status: 126
The command sent was just “date” so I expected no problems.
If I log in manually from the proxy, I can log in with ssh using the ~foreman-proxy/.ssh/id_rsa_foreman_proxy key, use sudo to elevate myself to root and issue the command without problems so I am a little confused what is not allowed.
I fetched the script-wrapper file and it contains:
Not totally sure what these commands are supposed to do but as root I have no problems executing them.
Logging however show the pid file was never created during remote execution so this command is my suspect. Anyone knows the details on how this is working. Was left with this evidence:
Just a hint, that the exit code 126 indicates that the file it is trying to execute is missing the executable flag - it’s also visible in the file listing you pasted.
Hi.
I believe it is uploading the files with permissions 555 here:
Anyway, maybe the hardening mounts the destination with noexec flag?
If that is true, you might need to reconfigure REX to use different working path, just like described here:
The partition has not the noexec flag (first thing I checked ).
Anyway, was digging around in the “OpenSCAP Evaluation Report” and came across an activation of fapolicyd “(File Access Policy Daemon) implements application whitelisting to decide file access rights”. Seen it was enabled. Stopped it and ran “fapolicyd --debug-deny”, ran the rex command again and got: