CFEngine 3 is a popular open source configuration management system. Its primary function is to provide automated configuration and maintenance of large-scale computer systems.
This repository is intended to provide a stable base policy for installations and upgrades, and is used by CFEngine 3.6 and newer.
The contents of this repository are intended to live in /var/cfengine/masterfiles
or wherever $(sys.masterdir)
points.
Use the convenience install target:
make install
to install only what's needed (without tests
, only policies). By
default it installs in /var/cfengine/masterfiles
but you can
override that easily:
make install DESTDIR=/my/other/install/directory
First, review update.cf
and def.cf
. Most settings you need to change will live here.
Synchronizing clients with the policy server happens here, in
update.cf
. Its main job is to copy all the files on the policy
server (usually the hub) under $(sys.masterdir)
(usually
/var/cfengine/masterfiles
) to the local host into $(sys.inputdir)
(usually /var/cfengine/inputs
).
This is a standalone policy file. You can actually run it with
cf-agent -KI -f ./update.cf
but if you don't understand what that
command does, please hold off until you've gone through the CFEngine
documentation. The contents of update.cf
duplicate other things
under lib
sometimes, in order to be completely standalone.
When update.cf
is broken, things go bonkers. CFEngine will try to
run a backup failsafe.cf
you can find at
https://github.com/cfengine/core/blob/master/libpromises/failsafe.cf
(that .cf
file is written into the C code and can't be modified). If
things get to that point, you probably have to look at why corrupted
policies made it into production.
As is typical for CFEngine, the policy and the configuration are
mixed. In update.cf
you'll find some very useful settings. Keep
referring to
https://github.com/cfengine/masterfiles/blob/master/update.cf as you
read this. We are skipping the nonessential ones.
There are 4 stages in update.cf
. See the bundlesequence
: after
loading the configuration from update_def
, we take these steps in
order.
This step implements the auto-deployment of policies. See
https://docs.cfengine.com/docs/master/guide-enterprise-cfengine-guide-version-control-policy.html
and cfengine_internal_masterfiles_update
below for details.
This step updates the policy files themselves. See
https://github.com/cfengine/masterfiles/blob/master/update/update_policy.cf
for the implementation details. Basically it's a check step that looks
at $(sys.inputdir)/cf_promises_validated
and compares it with the
policy server's $(sys.masterdir)/cf_promises_validated
. Then there's
the actual copy, which happens only if the cf_promises_validated
file was updated in the check step.
This step manages the running processes, ensuring cf-execd
and
cf-serverd
and cf-monitord
are running and doing some other tasks.
This step does a self-update of CFEngine. See the Enterprise documentation for details; this functionality is unsupported in CFEngine Community.
Change this variable to add more file extensions to the list copied from the policy server. By default this is a pretty sparse list.
Usually you want to leave this at 0600
meaning the inputs will be
readable only by their owner.
Off by default.
Turn this on (set to any
) to auto-deploy policies on the policy
server, it has no effect on clients. See
https://docs.cfengine.com/docs/master/guide-enterprise-cfengine-guide-version-control-policy.html
for details on how to use it.
This may result in DATA LOSS.
Off by default.
Turn this on (set to any
) to encrypt your policy transfers.
Note it has a duplicate in def.cf
, see below. If they are not
synchronized, you will get unexpected behavior.
Off by default.
Turn this on (set to any
) to delete any files in your
$(sys.inputdir)
that are not in the policy server's masterfiles.
This may result in DATA LOSS.
Note it has a duplicate in def.cf
, see below. If they are not
synchronized, you will get unexpected behavior.
After update.cf
is configured, you can configure the main def.cf
policy.
This file is included by the main promises.cf
and you can run that
with cf-agent -KI -f ./promises.cf
but as before, make sure you
understand what this command does before using it.
Keep referring to https://github.com/cfengine/masterfiles/blob/master/def.cf as you read this.
def.cf
has some crucial settings used by the rest of CFEngine. It's
expected that users will edit it but won't normally change the rest of
the masterfiles except in services
or if they know it's necessary.
This is a simple CFEngine policy, so read on for configuring it.
Set your domain
to the right value. By default it's used for mail
and to deduce your file access ACLs.
The acl
is crucial. This is used by every host, not just the
policy server. Make sure you only allow hosts you want to allow.
trustkeysfrom
tells the policy server what hosts to trust for
bootstrapping. As the comments say, empty it after your hosts have
been bootstrapped to avoid unpleasant surprises.
Off by default.
Turn this on (set to any
) to auto-load files in services/autorun
and run bundles found that are tagged autorun
. See
https://github.com/cfengine/masterfiles/blob/master/services/autorun/hello.cf
for a simple example of such a bundle.
On by default. Rotates CFEngine's own logs. For the details, see the
cfe_internal_log_rotation
bundle in
https://github.com/cfengine/masterfiles/blob/master/cfe_internal/CFE_cfengine.cf
Duplicate of the one in update.cf
. They should be set in unison or
you will get unexpected behavior.
Duplicate of the one in update.cf
. They should be set in unison or
you will get unexpected behavior.
Off by default. Only used on the CFEngine Enterprise hub.
Turn this on (set to any
) to allow the hub to edit sudoers in order
for the Apache user to run passwordless sudo cf-runagent (part of
Mission Portal troubleshooting).
The inventory is a cool new feature in 3.6.0. You can disable pieces of it (inventory modules) or the whole thing if you wish.
This class is off by default (meaning the inventory is on by default). Here's the master switch to disable all inventory modules.
LSB is the Linux Standard Base, see https://wiki.linuxfoundation.org/en/LSB
By default, this class is turned off (and the module is on) if the LSB
executable /usr/bin/lsb_release
can be found. This inventory module
will populate inventory reports and variables for you with LSB
details. For details, see
https://github.com/cfengine/masterfiles/blob/master/inventory/lsb.cf
By default, this class is turned off (and the module is on) if the
executable /usr/sbin/dmidecode
can be found. This inventory module
will populate inventory reports and variables for you. For details,
see
https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
LLDP is a protocol for Link Layer Discovery. See http://en.wikipedia.org/wiki/Link_Layer_Discovery_Protocol
By default, this class is turned off (and the module is on) if the
executable /usr/bin/lldpctl
can be found. This inventory module will
populate variables for you. For details, see
https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
By default, this class is turned off (and the module is on). This inventory module will populate the installed packages for you. On CFEngine Enterprise, the available packages will also be populated. For details, see https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
By default, this class is turned off (and the module is on) if
/etc/mtab
exists. This inventory module will populate variables for
you based on the mounted filesystems. For details, see
https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
By default, this class is turned off (and the module is on) if
$(sys.fstab)
(usually /etc/fstab
or /etc/vfstab
) exists. This
inventory module will populate variables for you based on the defined
filesystems. For details, see
https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
By default, this class is turned off (and the module is on) if /proc
is a directory. This inventory module will populate variables for you
from some of the contents of /proc
. For details, see
https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
By default, this class is turned on (and the module is off).
Turn this on (set to any
) to allow each client to load a me.json
file from the server and load its contents. For details, see
https://github.com/cfengine/masterfiles/blob/master/inventory/any.cf
promises.cf
is your main run file. Keep referring to
https://github.com/cfengine/masterfiles/blob/master/promises.cf as you
read this.
Edit the bundlesequence
to add any bundles you with. Consider using
the services_autorun
facility so you don't have to edit this at all.
BEWARE THAT ONLY VALID (KNOWN) BUNDLES CAN BE ADDED.
By default, the inventory modules, then internal hub modules, then
Design Center sketches, then the autorun services, and finally
internal management bundles are in the bundlesequence
.
In order to find bundles, CFEngine needs to know where to look. This
list defines what files are needed. Note there are several dynamic
entries here, coming from other bundles. CFEngine will keep evaluating
the inputs
and bundlesequence
until all the bundles are found and
resolved.
Make sure to add any of your own services
files here if you don't
use the services_autorun
facility, to ensure the bundles in them are
found.
Note that in this document, the term "unexpected behavior" has been used, so a definition would help.
Last year, a CFEngine user got hit by a flying frisbee while walking backwards through a revolving door. This year, he won 4 track events in the winter Olympics. That's unexpected behavior.
cfe_internal
: internal CFEngine policies you shouldn't modify or you will get unexpected behaviorcontrols
: configuration of components, e.g. thecf-agent
orcf-serverd
, beyond whatdef.cf
can offerdef.cf
: defaults you can and should configure, see aboveinventory
: inventory modules (loaded before anything else to discover facts about the system) live here; see abovelib
: main library directory. You'll see3.5
and3.6
and3.7
under it. These are the supported versions for masterfiles backwards compatibility.promises.cf
: main policy, you will need to configure this, see aboveservices
: your site's policies go hereservices_autorun
: see abovesketches
: Design Center installations use this; do not touch or you will get unexpected behaviorupdate
andupdate.cf
: functionality for updating inputs and CFEngine itself, see above. You shouldn't modify files underupdate
or you will get unexpected behavior.
Please see the CONTRIBUTING.md file.
The CFEngine masterfiles are under the MIT license, see https://github.com/cfengine/masterfiles/blob/master/LICENSE