Definitions
Managed server
A server managed by CFEngine. Presumably one of many.
Policy server
A file-sharing service used to distribute policy from
some centralized point to a fleet of servers.
Hub
A commercial add-on to CFEngine that collects reports
from managed servers. These reports are available through
the Web UI (another commercial add-on) and give you instant
insight into the state of your infrastructure.
The policy server, the hub and the Web UI usually run on the
same server called “hub” for short.
Bootstrapping
In CFEngine, bootstrapping is the establishing of the
trust relationship between a policy server/hub and a managed server
such that:
a) the managed server can download policy updates from the policy server, and
b) the hub can poll the server for reports.
How it works
Bootstrapping is done by running cf-agent on the managed server
with the –bootstrap (-B) switch with the IP address of the policy
server as the argument:
cf-agent -B 1.2.3.4
Running cf-agent with the –bootstrap (-B) switch is saying “yes”
to the SSH-like question, “I haven’t seen the other server before,
are you sure you want to accept its key and connect?”
After exchanging keys (which are stored in /var/cfengine/ppkeys),
the managed node records the hub’s address, and the hub records
the managed node’s address so that managed node can download
policy updates from the hub and the hub can download reports from
the managed node.
Data is never pushed. It is always pulled. This is part
of CFEngine’s security model. CFEngine 3 has had zero
major security vulnerabilities (remote compromise).
The managed nodes pull policy from the policy server:
[managed node] <---policy---- [policy server]
The hub pulls reports from the managed nodes:
[hub] <---reports---- [managed node]
The CFEngine component that handles inter-node communication is
cf-serverd. That’s the part of CFEngine that listens on a TCP
socket (cfengine/5308) for incoming connections.
For bootstrapping to be possible, the managed node must be able
to connect to the hub on port 5308; and policy server be configured
to trust first-time connections from the address range containing
the managed node.
Example of a successful bootstrap:
# cf-agent -B 10.10.10.20
R: This autonomous node assumes the role of voluntary client
R: Updated local policy from policy server
R: Started the scheduler
2015-07-08T14:38:12+0000 notice: Bootstrap to '10.10.10.20' completed successfully!
#
Example of an unsuccessful bootstrap — see especially the last
line which states the bootstrap failed and we don’t have a usable
promises.cf file (the default input file for CFEngine, containing
configuration policy in the form of CFEngine promises).
# cf-agent -B 10.10.10.10
2015-07-09T02:55:45+0000 error: /default/cfe_internal_update/files/'/var/cfengine/inputs'[0]: No suitable server responded to hail
R: This autonomous node assumes the role of voluntary client
R: Failed to copy policy from policy server at 10.10.10.10:/var/cfengine/masterfiles
Please check
* cf-serverd is running on 10.10.10.10
* network connectivity to 10.10.10.10 on port 5308
* masterfiles 'body server control' - in particular allowconnects, trustkeysfrom and skipverify
* masterfiles 'bundle server' -> access: -> masterfiles -> admit/deny
It is often useful to restart cf-serverd in verbose mode (cf-serverd -v) on 10.10.10.10 to diagnose connection issues.
When updating masterfiles, wait (usually 5 minutes) for files to propagate to inputs on 10.10.10.10 before retrying.
R: Did not start the scheduler
2015-07-09T02:56:06+0000 notice: /default/cfe_internal_call_update/commands/'"/var/cfengine/bin/cf-agent" -f update.cf'[0]: Q: ".../cf-agent" -f u": 2015-07-09T02:55:45+0000 error: There is no readable input file at '/var/cfengine/inputs/update.cf'. (stat: No such file or directory)
Q: ".../cf-agent" -f u": 2015-07-09T02:55:45+0000 error: CFEngine was not able to get confirmation of promises from cf-promises, so going to failsafe
Q: ".../cf-agent" -f u": 2015-07-09T02:56:06+0000 error: /default/cfe_internal_update/files/'/var/cfengine/inputs'[0]: No suitable server responded to hail
Q: ".../cf-agent" -f u": R: Failed to copy policy from policy server at 10.10.10.10:/var/cfengine/masterfiles
Q: ".../cf-agent" -f u": Please check
Q: ".../cf-agent" -f u": * cf-serverd is running on 10.10.10.10
Q: ".../cf-agent" -f u": * network connectivity to 10.10.10.10 on port 5308
Q: ".../cf-agent" -f u": * masterfiles 'body server control' - in particular allowconnects, trustkeysfrom and skipverify
Q: ".../cf-agent" -f u": * masterfiles 'bundle server' -> access: -> masterfiles -> admit/deny
Q: ".../cf-agent" -f u": It is often useful to restart cf-serverd in verbose mode (cf-serverd -v) on 10.10.10.10 to diagnose connection issues.
Q: ".../cf-agent" -f u": When updating masterfiles, wait (usually 5 minutes) for files to propagate to inputs on 10.10.10.10 before retrying.
Q: ".../cf-agent" -f u": R: Did not start the scheduler
Q: ".../cf-agent" -f u": 2015-07-09T02:56:06+0000 notice: /default/cfe_internal_call_update/commands/'"/var/cfengine/bin/cf-agent" -f update.cf'[0]: Q: ".../cf-agent" -f u": 2015-07-09T02:56:06+0000 error: There is no readable input file at '/var/cfengine/inputs/update.cf'. (stat: No such file or directory)
Q: ".../cf-agent" -f u": Q: ".../cf-agent" -f u": 2015-07-09T02:56:06+0000 error: CFEngine was not able to get confirmation of promises from cf-promises, so going to failsafe
2015-07-09T02:56:06+0000 error: Bootstrapping failed, no input file at '/var/cfengine/inputs/promises.cf' after bootstrap
#