Components
While promises to configure your system are entirely user-defined, thedetails of the operational behavior of the CFEngine software is ofcourse hard-coded. You can still configure the details of thisbehavior using thecontrol promise bodies. Control behavior isdefined in bodies because the actual promises are fixed and you onlychange their details within sensible limits.
See theintroductionfor a high-level overview of theCFEngine components, and each component's reference documentation for thedetails about the specific control bodies.
Common control
Thecommon control body refers to those promises that arehard-coded into all the components of CFEngine, and thereforeaffect the behavior of all the components.
bodycommoncontrol{inputs=>{"update.cf","library.cf"};bundlesequence=>{update("policy_host.domain.tld"),"main","cfengine2"};goal_categories=>{"goals","targets","milestones"};goal_patterns=>{"goal_.*","target.*"};output_prefix=>"cfengine>";version=>"1.2.3";}bundlesequence
Description: Thebundlesequence contains promise bundlesto verify, in a specific order.
Thebundlesequence determines which of the compiled bundles will be executedbycf-agent and in what order they will be executed. The list refers to thenames of bundles (which might be parameterized, function-like objects).
The default value forbundlesequence is{ "main" }.
Abundlesequence may also be specified using the-b or--bundlesequence command line option.
Type:slist
Allowed input range:.*
Example:
bodycommoncontrol{bundlesequence=>{update("policy_host.domain.tld"),"main","cfengine2"};}Note: Onlycommon andagent bundles are allowed to be listed in thebundlesequence.
The order in which you execute bundles can affect the outcome ofyour promises. In general you should always define variables beforeyou use them.
Thebundlesequence is like a genetic makeup of a machine. Thebundles act like characteristics of the systems. If you wantdifferent systems to have differentbundlesequences, distinguishthem with classes
webservers::bundlesequence=>{"main","web"};others::bundlesequence=>{"main","otherstuff"};If you want to add a basic common sequence to all sequences, thenuse global variable lists to do this:
bodycommoncontrol{webservers::bundlesequence=>{@(g.bs),"web"};others::bundlesequence=>{@(g.bs),"otherstuff"};}bundlecommong{vars:"bs"slist=>{"main","basic_stuff"};}History: The default to{ "main" } was introduced in version 3.7.0, so ifyou expect your policies to be run by older version, you'll need an explicitbundlesequence.
bwlimit
Description: Coarse control of bandwidth any cf-serverd or cf-agent processwill sendout. In Bytes/sec.
Bandwidth limit is meant to set an upper bound of traffic coming out of CFEngineagents or servers, as a countermeasure against network abuse from them. The limitis applied to all interfaces (in total), a single process at a time. It canprevent network being flooded by CFEngine traffic when large files or many agentshit a single cf-serverd.
For more fine-grained control, please use operating system (eg. iptables)facilities.
Note: Bandwidth limiting is currently not supported on Windows.
Type:float
Default value: none (no limit)
Example:
bodycommoncontrol{bwlimit=>"10M";}In this example, bwlimit is set to 10MBytes/sec = 80Mbit/s meaning thatCFEngine would only consume up to ~80% of any 100Mbit ethernet interface.
cache_system_functions
Description: Controls the caching of the results of systemfunctions, e.g.execresult() andreturnszero() for shell execution andldapvalue() and friends for LDAP queries. Without this setting,CFEngine's evaluation model will evaluate functions multiple times,which is a performance concern. SeeFunctions.
Although you can override this tofalse, in practice you shouldalmost never need to do so. The effect of having ittrue (thedefault) is that the expensive functions will be run just once andthen their result will be cached.
Note that caching is per-process so results will not be cached betweenruns of e.g.cf-agent andcf-promises.
Type:boolean
Default value: true
Example:
cache_system_functions=>"true";See also:ifelapsed in action bodies
History:- Introduced in version 3.6.0.
domain
Description: Thedomain string specifies the domain name for this host.
There is no standard, universal or reliable way of determining theDNS domain name of a host, so it can be set explicitly to simplifydiscovery and name-lookup.
Type:string
Allowed input range:.*
Example:
bodycommoncontrol{domain=>"example.org";}goal_patterns
Description: Contains regular expressions that match promisees/topicsconsidered to be organizational goals
It is used as identifier to mark business and organizational goals inCFEngine Enterprise. CFEngine uses this to match promisees that representbusiness goals in promises.
Type:slist
Allowed input range: (arbitrary string)
Example:
bodycommoncontrol{goal_patterns=>{"goal_.*","target.*"};}History: Was introduced in version 3.1.5, Nova 2.1.0 (2011)
ignore_missing_bundles
Description: Determines whether to ignore missing bundles.
Ifignore_missing_bundles is set to true, if any bundles in the bundlesequence do not exist, ignore and continue.
Type:boolean
Default value: false
Example:
ignore_missing_bundles=>"true";Notes:
This authorizes the bundlesequence to contain possibly"nonexistent" pluggable modules. It defaults to false, whereuponundefined bundles cause a fatal error in parsing, and a transitionto failsafe mode.
ignore_missing_inputs
Description: If any input files do not exist, ignore and continue
The inputs lists determines which files are parsed by CFEngine.Normally stringent security checks are made on input files toprevent abuse of the system by unauthorized users.
Sometimes however, it is appropriate to consider the automatic plug-in ofmodules that might or might not exist. This option permits CFEngineto list possible files that might not exist and continue 'besteffort' with those that do exist. The default of all Booleans isfalse, so the normal behavior is to signal an error if an input isnot found.
Type:boolean
Default value: false
Example:
ignore_missing_inputs=>"true";inputs
Description: Theinputs slist contains additional filenames to parse for promises.
The filenames specified are all assumed to be in the same directoryas the file which references them (this is usually$(sys.workdir)/inputs, but may be overridden by the-f or--file command line option.
Type:slist
Allowed input range:.*
Example:
bodycommoncontrol{inputs=>{"update.cf","library.cf"};}See also:inputs inbody file control
Notes:
If no filenames are specified, no other filenames will be included in thecompilation process.
Library contents are checked for duplication by path and by hash. Forexample, if you putlibrary.cf twice in yourinputs, the duplicatelibrary.cf is noticed because the same path is included twice. Averbose-level message is emitted but otherwise there is no error.
In addition, if you include a file once with path/x/y/z.cf andagain with path/x/./y/z.cf, the duplicate file will be rejectedregardless of any path tricks or symbolic links. The contents arehashed, so the same file can't be included twice.
lastseenexpireafter
Description: The value oflastseenexpireafter is the number of minutesafter which last-seen entries are purged. It is anenterprise-only feature.
Type:int
Allowed input range:0,99999999999
Default value: One week
Note: This value affects thehostsseen() function and license counting bycf-hub in the Enterprise edition.
Example:
bodycommoncontrol{lastseenexpireafter=>"72";}See also:hostsseen(),cf-hub
output_prefix
Description: The string prefix for standard output
Type:string
Allowed input range: (arbitrary string)
Example:
bodycommoncontrol{output_prefix=>"my_cf3";}Notes:
On native Windows versions of CFEngine (Enterprise), thisstring is also prefixed messages in the event log.
package_inventory
Description: List of package module bodies to query for package lists.
Defines the list ofpackage module bodies which will be queries forpackage lists, for use inpackagematching(),packageupdatesmatching() and inEnterprise inventory reporting.
Type:slist
Allowed input range: (body names)
Example:
bodycommoncontrol{package_inventory=>{"apt_get"};}package_module
Description: The default package module body to use.
Defines the default package module body to use forpackage promises,if none is specified in the promise.
Type:string
Allowed input range: (body name)
Example:
bodycommoncontrol{package_module=>"apt_get";}protocol_version
Description: Defines the protocol to use for all outgoing connections.
Type: (menu option)
Allowed input range:
1classic2tls3cookielatest
Default value: undefined
Note:protocol_version can be specified at the individual promise levelusing thebody copy_from protocol_versionattribute. When undefined (the default) peers automatically negotiate the latest protocol version.
See also:body copy_from protocol_version,allowlegacyconnects,allowtlsversion,allowciphers,tls_min_version,tls_ciphers,encrypt,logencryptedtransfers,ifencrypted
History:
- Introduced in CFEngine 3.6.0 with
protocol_version1(classic) andprotocol_version2(tls) - Added
protocol_version3(cookie) in CFEngine 3.15.0
require_comments
Description: Therequire_comments menu option policy warns aboutpromises that do not have comment documentation.
When true,cf-promises will report loudly on promises that do not havecomments. Variables promises are exempted from this rule, sincethey may be considered self-documenting. This may be used as a policy QualityAssurance measure, to remind policy makers to properly document theirpromises.
Type:boolean
Default value: false
Example:
bodycommoncontrol{common::require_comments=>"true";}site_classes
Description: Asite_classes contains classes that will representgeographical site locations for hosts. These should be defined elsewhere inthe configuration in a classes promise.
This list is used to match against topics when connectinginferences about host locations in the knowledge map. Normally anyCFEngine classes promise whose name is defined as a thing or topicunder classlocations:: will be assumed to be a location definingclassifier. This list will add alternative class contexts forinterpreting location.
Type:slist
Allowed input range:[a-zA-Z0-9_!&@@$|.()\[\]{}:]+
Each string is expected to be a class.
Example:
bodycommoncontrol{site_classes=>{"datacenters","datacentres"};# locations is by default}History: Was introduced in version 3.2.0, Nova 2.1.0 (2011)
syslog_host
Description: Thesyslog_host contains the name or address of ahost to which syslog messages should be sent directly by UDP.
This is the hostname or IP address of a local syslog service to which allCFEngine's components may promise to send data.
Type:string
Allowed input range:[a-zA-Z0-9_$(){}.:-]+
Default value:localhost
Example:
bodycommoncontrol{syslog_host=>"syslog.example.org";syslog_port=>"514";}syslog_port
Description: The value ofsyslog_port represents the port numberof a UDP syslog service.
It is the UDP port of a local syslog service to which all CFEngine'scomponents may promise to send data.
Type:int
Allowed input range:0,99999999999
Default value:514
Example:
bodycommoncontrol{syslog_host=>"syslog.example.org";syslog_port=>"514";}system_log_level
Description: The minimum log level required for log messages to go to the system log (e.g. syslog, Windows Event Log).
Type:string
Allowed Input range:(critical|error|warning|notice|info)
Default value: (unspecified)
Example:
Prevent messages lower thancritical on Windows.
bodycommoncontrol{@ifminimum_version(3.18.1)windows::system_log_level=>"critical";cfengine::@endif}History:
- Introduced in 3.19.0, 3.18.1
tls_ciphers
Description: List of ciphers allowed when makingoutgoing connections from components other thancf-serverd.
For a list of possible ciphers, see man page for "openssl ciphers".
Type:string
Allowed input range: (arbitrary string)
Default value: undefined
Example:
bodycommoncontrol{# Use one of these ciphers when making outbound connectionstls_ciphers=>"AES128-SHA";}See also:protocol_version,allowciphers,tls_min_version,allowtlsversion,encrypt,logencryptedtransfers,ifencrypted
History: Introduced in CFEngine 3.7.0
tls_min_version
Description: Minimum tls version to allow foroutgoing connections from components other thancf-serverd.
Type:string
Allowed input range: (arbitrary string)
Default value: 1.0
bodycommoncontrol{# Allow only TLSv1.1 or higher for outgoing connectionstls_min_version=>"1.1";}See also:protocol_version,allowciphers,tls_ciphers,allowtlsversion,encrypt,ifencrypted,logencryptedtransfers
History: Introduced in CFEngine 3.7.0
version
Description: Theversion string contains the scalar version of theconfiguration.
It is is used in error messages and reports.
Type:string
Allowed input range: (arbitrary string)
This string should not contain the colon ':' character, as this hasa special meaning in the context of knowledge management. Thisrestriction might be lifted later.
Example:
bodycommoncontrol{version=>"1.2.3";}Deprecated attributes in body common control
The following attributes were functional in previous versionsof CFEngine, but today they are deprecated, either becausetheir functionality is being handled trasparently or becauseit doesn't apply to current CFEngine version.
- fips_mode
- host_licenses_paid
- Overview
- Getting started
- Reference
- Components
- Functions
- accessedbefore
- accumulated
- ago
- and
- basename
- bundlesmatching
- bundlestate
- callstack_callers
- callstack_promisers
- canonify
- canonifyuniquely
- cf_version_after
- cf_version_at
- cf_version_before
- cf_version_between
- cf_version_maximum
- cf_version_minimum
- changedbefore
- classesmatching
- classfiltercsv
- classify
- classmatch
- concat
- countclassesmatching
- countlinesmatching
- data_expand
- data_readstringarray
- data_readstringarrayidx
- data_regextract
- data_sysctlvalues
- datastate
- difference
- dirname
- diskfree
- escape
- eval
- every
- execresult
- execresult_as_data
- expandrange
- file_hash
- fileexists
- filesexist
- filesize
- filestat
- filter
- findfiles
- findfiles_up
- findprocesses
- format
- getclassmetatags
- getenv
- getfields
- getgid
- getindices
- getuid
- getuserinfo
- getusers
- getvalues
- getvariablemetatags
- grep
- groupexists
- hash
- hash_to_int
- hashmatch
- host2ip
- hostinnetgroup
- hostrange
- hostsseen
- hostswithclass
- hubknowledge
- ifelse
- int
- intersection
- ip2host
- iprange
- irange
- isdir
- isexecutable
- isgreaterthan
- isipinsubnet
- islessthan
- islink
- isnewerthan
- isplain
- isreadable
- isvariable
- join
- lastnode
- laterthan
- ldaparray
- ldaplist
- ldapvalue
- length
- lsdir
- makerule
- maparray
- mapdata
- maplist
- max
- mean
- mergedata
- min
- network_connections
- none
- not
- now
- nth
- on
- or
- packagesmatching
- packageupdatesmatching
- parseintarray
- parsejson
- parserealarray
- parsestringarray
- parsestringarrayidx
- parseyaml
- peerleader
- peerleaders
- peers
- processexists
- product
- randomint
- read_module_protocol
- readcsv
- readdata
- readenvfile
- readfile
- readintarray
- readintlist
- readjson
- readrealarray
- readreallist
- readstringarray
- readstringarrayidx
- readstringlist
- readtcp
- readyaml
- regarray
- regcmp
- regex_replace
- regextract
- registryvalue
- regldap
- regline
- reglist
- remoteclassesmatching
- remotescalar
- returnszero
- reverse
- rrange
- selectservers
- shuffle
- some
- sort
- splayclass
- splitstring
- storejson
- strcmp
- strftime
- string
- string_downcase
- string_head
- string_length
- string_mustache
- string_replace
- string_reverse
- string_split
- string_tail
- string_trim
- string_upcase
- sublist
- sum
- sysctlvalue
- translatepath
- type
- unique
- url_get
- usemodule
- userexists
- validdata
- validjson
- variablesmatching
- variablesmatching_as_data
- variance
- version_compare
- Language concepts
- Masterfiles Policy Framework
- promises.cf
- .no-distrib/
- update.cf
- standalone_self_upgrade.cf
- cfe_internal/
- cfe_internal/CFE_cfengine.cf
- cfe_internal/core/
- cfe_internal/core/watchdog
- cfe_internal/core/watchdog/watchdog.cf
- cfe_internal/enterprise/
- cfe_internal/enterprise/federation/
- cfe_internal/enterprise/federation/federation.cf
- cfe_internal/recommendations.cf
- cfe_internal/update/
- cfe_internal/update/cfe_internal_dc_workflow.cf
- cfe_internal/update/cfe_internal_update_from_repository.cf
- cfe_internal/update/lib.cf
- cfe_internal/update/systemd_units.cf
- cfe_internal/update/update_bins.cf
- cfe_internal/update/update_policy.cf
- cfe_internal/update/update_processes.cf
- controls/
- controls/cf_agent.cf
- controls/cf_execd.cf
- controls/cf_hub.cf
- controls/cf_monitord.cf
- controls/cf_runagent.cf
- controls/cf_serverd.cf
- controls/def.cf
- controls/def_inputs.cf
- controls/reports.cf
- controls/update_def.cf
- controls/update_def_inputs.cf
- inventory/
- inventory/any.cf
- inventory/debian.cf
- inventory/freebsd.cf
- inventory/generic.cf
- inventory/linux.cf
- inventory/lsb.cf
- inventory/macos.cf
- inventory/os.cf
- inventory/redhat.cf
- inventory/suse.cf
- inventory/windows.cf
- lib/
- lib/autorun.cf
- lib/bundles.cf
- lib/cfe_internal.cf
- lib/cfe_internal_hub.cf
- lib/cfengine_enterprise_hub_ha.cf
- lib/commands.cf
- lib/common.cf
- lib/databases.cf
- lib/edit_xml.cf
- lib/event.cf
- lib/examples.cf
- lib/feature.cf
- lib/files.cf
- lib/guest_environments.cf
- lib/monitor.cf
- lib/packages.cf
- lib/paths.cf
- lib/processes.cf
- lib/reports.cf
- lib/services.cf
- lib/stdlib.cf
- lib/storage.cf
- lib/testing.cf
- lib/users.cf
- lib/vcs.cf
- modules/
- modules/mustache/
- modules/packages/
- modules/packages/vendored/
- modules/promises/
- modules/promises/cfengine.py
- modules/promises/cfengine.sh
- services/
- services/autorun/
- services/main.cf
- Macros
- Promise types
- Special variables
- All promise and body types
- Release notes
- Web UI
- Settings
- Health
- Hosts
- Alerts and notifications
- Custom actions for alerts
- Enterprise reporting
- Federated reporting
- Measurements app
- Hub administration
- Decommissioning hosts
- Extending Mission Portal
- Extending query builder in Mission Portal
- Adjusting schedules
- Backup and restore
- Configure a custom LDAP port
- Custom LDAPs certificate
- Custom SSL certificate
- Enable plain http
- Lookup license info
- Policy deployment
- Public key distribution
- Re-installing Enterprise hub
- Regenerate self signed SSL certificate
- Reset administrative credentials
- Debugging Mission Portal
- License
- Examples and tutorials
- Example snippets
- General examples
- Administration examples
- Measuring examples
- Software administration examples
- Commands, scripts, and execution examples
- File and directory examples
- File template examples
- Interacting with directory services
- Database examples
- Network examples
- System security examples
- System information examples
- System administration examples
- System file examples
- Windows registry examples
- File permissions
- User management examples
- Common promise patterns
- Aborting execution
- Change detection
- Check filesystem space
- Copy single files
- Create files and directories
- Customize message of the day
- Distribute ssh keys
- Ensure a process is not running
- Ensure a service is enabled and running
- Find the MAC address
- Install packages
- Mount NFS filesystem
- Restart a process
- Set up name resolution with DNS
- Set up sudo
- Set up time management through NTP
- Updating from a central policy server
- Tutorials
- JSON and YAML support in CFEngine
- Installing CFEngine Enterprise agent
- Managing local users
- Managing network time protocol
- Managing processes and services
- Package management
- Writing CFEngine policy
- Distributing files from a central location
- File editing
- Reporting and remediation of security vulnerabilities
- Masterfiles Policy Framework upgrade
- Tags for variables, classes, and bundles
- Custom inventory
- Dashboard alerts
- Integrating alerts with PagerDuty
- Integrating alerts with ticketing systems
- Integrating with Sumo Logic
- Rendering files with Mustache templates
- Reporting
- File comparison
- High availability
- Writing and serving policy
- Example snippets
- Resources
- FAQ
- Why knowledge management?
- Requesting a CFEngine Enterprise License
- Uninstalling / reinstalling
- Agent output email
- Debugging slow queries
- Enterprise Report Filtering
- Enterprise report collection
- Enterprise reporting database
- How can I tell what classes and variables are defined?
- How do I find the public key for a given host
- How do I fix trust after an IP change?
- How do I fix undefined body errors?
- How do I integrate custom policy?
- How do I pass a data type variable?
- Manual execution
- Mustache templating
- Unable to log into Mission Portal
- Users
- What is promise locking?
- Why are remote agents not updating?
- Why are some files inside masterfiles not being updated/distributed?
- Why does CFEngine install into /var/cfengine instead of following the FHS?
- Bootstrapping
- Tuning PostgreSQL
- What did CFEngine do?
- External resources
- Additional topics
- Best practices
- FAQ
- API
- Enterprise API examples
- Enterprise API reference
- Actions API
- Build API
- CMDB API
- Changes REST API
- Federated reporting configuration API
- File changes API
- Health diagnostic API
- Host REST API
- Import & export API
- Import & export compliance report API
- Inventory API
- LDAP authentication API
- Personal groups API
- Query REST API
- SQL schema
- SSH keys API
- Shared groups API
- Status and settings REST API
- Two-factor authentication API
- Users and access-control REST API
- VCS settings API
- Web RBAC API