Hello Markus
I think the file by design contains the IP address, and not the hostname, to avoid that a failure in name resolution could affect ability of the client to connect to the server and fetch policy updates. The documentation itself indicates that the file contains the IP of the policy server, not the name. See https://docs.cfengine.com/docs/3.24/overview-directory-structure.html#policy_server-dat
Ciao,
-- bronto
I do think that using an IP address is a bit more reliable. Instead of manipulating that file you could instead re-bootstrap with a command like cf-agent –no-lock –inform –bootstrap <newip>.
I typically advise against a re-bootstrap. It's a bit heavy handed, and if it fails it can leave you in worse position.
When you --bootstrap , the content in $(sys.input_dir) is wiped and completely re-seeded. If your bootstrap fails you will not have a full policy in inputs, where as if you re-write policy_server.dat your existing policy will remain in place and the next time the agent starts it will resolve the new value for policy server.
When you --bootstrap , the content in $(sys.input_dir) is wiped and completely re-seeded. If your bootstrap fails you will not have a full policy in inputs, where as if you re-write policy_server.dat your existing policy will remain in place and the next time the agent starts it will resolve the new value for policy server.
When you –bootstrap , the content in $(sys.input_dir) is wiped and completely re-seeded. If your bootstrap fails you will not have a full policy in inputs, where as if you re-write policy_server.dat your existing policy will remain in place and the next time the agent starts it will resolve the new value for policy server.
Does this mean next time cf-agent executes or when the cf daemons (re)starts?
Yes the next time cf-agent is executed from it's perspective it will have the new policy server address.
The daemons each have their own perspective. When they re-evaluate the policy they should also re-load the policy_server.dat. The daemon might realize the need to re-evaluate it's policy on it's own, or it might not and it might need to be re-started, it depends on specifically what changed (actual policy .cf files or external data), I don't think that the daemons key need for policy re-load in relation to a policy_server.dat change.
The value derived from policy_server.dat is used in default MPF access rules so for example cf-serverd having a stale value would impact the new policy servers ability to access the host (if you have a case where the hub is collecting things from the client, e.g. enterprise or some policy to copy files from the client).