cf-runagent fails with "EXEC denied due to ACL for file: /usr/bin/dash" #4450
-
I want my git server to have a post-receive hook on my masterfiles repo which causes the policy to be updated and run on my policy server. I thought I could do this with cf-runagent something like this:
I have an ACL in def.json which seems like it should allow connections between agents and the policy server.
I try cf-runagent like this from the git server (192.168.1.174) to the policy server (192.168.1.197):
On the git server I get an error:
and on the policy server I stopped cf-serverd with systemctl
and then ran it to see the details:
And the error seems strangely to do with ACL on
Why is it dealing with Am I running |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Let's have a closer look here (disclaimer: I'm not very familiar with masterfiles). The command that runs when triggered by cf-runagent is (in controls/cf-serverd.cf)
so We also see that the command handles both policy update and agent execution, so no need for two cf-runagent commands. Furthermore, the Let's find the source of our permission problem. In order to be allowed to run the (still in controls/cf-serverd.cf)
We see that the property controlling who is able to trigger a run is So the |
Beta Was this translation helpful? Give feedback.
-
Adding the ip address didn't seem to help. I did notice that the message mentions the user
so I added
as a var in in --verbose log of cf-serverd though I see /usr/bin/dash should admit the proper ip and EXEC should allow the proper user.
as well as the same entry for classic protocol
It seems that the function access_CheckResource() is returning false even though the I looked at the C code a bit to understand better what these messages mean versus what the logs seem to say. Then ran with
So it would seem that the ip should be admitted. Not sure why just it isn't just yet but will look at this more another time. |
Beta Was this translation helpful? Give feedback.
-
@craigcomstock Although it might not answer your question directly, this blog post has some details about how cf-runagent and cf-serverd works: https://cfengine.com/company/blog-detail/unpriviledged_cf-runagent/ |
Beta Was this translation helpful? Give feedback.
-
@craigcomstock I think this is the problem. The normal setup would be to run cf-runagent on the policy server, to a remote CFEngine client. This works by default, if you enable it. (As pointed out by @nickanderson) To enable the opposite, you will have to make some additional changes, most notably to
Additionally, note that MPF has different variables for what users to admit depending on whether it's a policy server or not:
This is explained in my blog post linked above, under "Allow the user to make EXEC requests": https://cfengine.com/company/blog-detail/unpriviledged_cf-runagent/ |
Beta Was this translation helpful? Give feedback.
Let's have a closer look here (disclaimer: I'm not very familiar with masterfiles). The command that runs when triggered by cf-runagent is
cfruncommand
defined inbody server control
:(in controls/cf-serverd.cf)
so
def.cf_runagent_shell
is where/usr/bin/dash
comes from.We also see that the command handles both policy update and agent execution, so no need for two cf-runagent commands. Furthermore, the
-f
flag incf-runagent
does not select a remote file but …