CFEngine directory structure
The CFEngine application is fully contained within the /var/cfengine directory tree. Here is a quick breakdown of the directory structure and some of the files and functions associated with each subdirectory.
/var/cfengine/bin
Agents
cf-agent: Executes the promises.cf file; ensures that all promises are being keptcf-keycf-promises: Verifies CFEngine's configuration syntaxcf-runagent: Contacts a remote system to run cf-agent
Daemons
cf-execd: Starts the cf-agent process at a specified time interval.cf-monitord: Collects system statisticscf-serverd: Provides network services; used to distribute policy and data filesrunalerts.sh: Updates Mission Portal status and activates alert actions (Enterprise only)cf-hub: Responsible for collecting reports from remote agents. (CFEngine Enterprise only)
See also:CFEngine component applications and daemons
Directories for policy files
/var/cfengine/modules
Location of scripts used incommands promises.
/var/cfengine/inputs
Cached policy repository on each CFEngine client. Whencf-agent isinvoked bycf-execd, it reads only from this directory.
/var/cfengine/masterfiles
Policy repository which grants access to local or bootstrapped CFEngineclients when they need to update their policies. Policies obtained from/var/cfengine/masterfiles are then cached in/var/cfengine/inputs forlocal policy execution. Thecf-agent executable does not execute policiesdirectly from this repository.
Output directories
/var/cfengine/outputs
Directory wherecf-agent creates its output files. The outputs directory isa record of spooled run-reports. These are often mailed to the administratorbycf-execd, or can be copied to another central location and viewed in analternative browser. However, not all hosts have an email capability or areonline, so the reports are kept here.
/var/cfengine/reports
Directory used to store reports. Reports are not tidied automatically, so youshould delete these files after a time to avoid a build up.
/var/cfengine/state
State data such as current process identifiers of running processes,persistent classes and other cached data.
/var/cfengine/state/promise_execution.log: In CFEngine Enterprisecf-agentwrites promise execution results to this temporary file during execution. Whencf-agentexits this data is stored for use by the reporting subsystem and the file is purged./var/cfengine/state/variable.cache.tmp: In CFEngine Enterprise ascf-agentexecutes information about variables are stored in this file. Whencf-agentexits this data is stored for use by the reporting subsystem and the file is purged./var/cfengine/state/context.cache.tmp: In CFEngine Enterprise ascf-agentexecutes, information about classes that are defined are stored in this file. Whencf-agentexits this data is stored for use by the reporting subsystem and the file is purged.
/var/cfengine/lastseen
Log data for incoming and outgoing connections.
/var/cfengine/cfapache
/var/cfengine/config
/var/cfengine/httpd
/var/cfengine/lib
Directory to store shared objects and dependencies that are in the bundled packages.
/var/cfengine/master_software_updates
/var/cfengine/plugins
/var/cfengine/ppkeys
Directory used to store encrypted public/private keys for CFEngineclient/server network communications.
/var/cfengine/share
/var/cfengine/software_updates
/var/cfengine/ssl
Log Files in /var/cfengine
On hosts, CFEngine writes numerous logs and records to its private workspace.
CFEngine Enterprise provides solutionsfor centralization and network-wide reporting at an arbitrary scale.
cf3.[hostname].runlog
A time-stamped log of when each lock was released. This shows the lasttime each individual promise was verified.
cfagent.[hostname].log
Although ambiguously named (for historical reasons) this log containsthe current list of setuid/setgid programs observed on the system.CFEngine warns about new additions to this list. This log has beendeprecated.
cf_notkept.log
In CFEngine Enterprise, a list of promises, with handles and comments, thatwere not kept.
cf_repair.log
In CFEngine Enterprise, a list of promises, with handles and comments, that were repaired.
promise_summary.log
A time-stamped log of the percentage fraction of promises kept aftereach run.
Database files in /var/cfengine
state/cf_classes.lmdb
A database of classes that have been defined on the current host, includingtheir relative frequencies, scaled like a probability.
state/cf_lastseen.lmdb
A database of hosts that last contacted this host, or were contacted by thishost, and includes the times at which they were last observed.
state/cf_lock.lmdb
A database of active and inactive promise locks and their expiry times. Deletingthis database will reset all lock protections in CFEngine.
Note: Locks are purged in order to maintain the integrity and health of theunderlying lock database. When the lock database utilization grows to 25%locks 4 weeks or older are purged. At 50% locks 2 weeks or older are purgedand at 75% locks older than 1 week are purged.
state/cf_changes.lmdb
The database of hash values used in CFEngine's change managementfunctions.
state/nova_agent_execution.lmdb
state/nova_track.lmdb
state/performance.lmdb
A database of last, average and deviation times of jobs recorded bycf-agent. Most promises take an immeasurably short time to check, butlonger tasks such as command execution and file copying are measured bydefault. Other checks can be instrumented by setting ameasurement_class in theaction body of a promise.
Process (AKA PID) files in /var/cfengine
The CFEngine components keep their current process identifier number inpid files in the work directory.
cf-execd.pidcf-hub.pidcf-monitord.pidcf-serverd.pid
Sockets in /var/cfengine
cf-hub-local
Datafiles in /var/cfengine
policy_server.dat
Specifies the host's primary policy server in the format(<IP>|<Hostname>)[:<Port>]. This file's contents are used to define thedefault:sys.policy_hub anddefault:sys.policy_hub_port variables.
See also:default:sys.policy_hub,default:sys.policy_hub_port
History:
- Added in CFEngine 3.2.0
- Support hostname and port added in CFEngine 3.10.0
ignore_interfaces.rx
CFEngine will ignore interfaces for interfaces that match one of the regular expressions listed in this file (one regular expression per line).
If an interface matches a regular expression in the file then various classes and variables will not be populated with related information. For example, but not limited to:
Classes:
ipv4_prefixed classesmac_prefixed classes
Variables:
sys.ipv4_N[iface]sys.ip2ifacesys.ipaddressessys.interface_flagssys.inetsys.inet6sys.hardware_mac[iface]sys.hardware_addresses
History:
- Introduced in CFEngine 3.10.0
- Preferred location moved from
$(sys.inputdir)to$(sys.workdir)in CFEngine 3.23.0
Binary files in /var/cfengine
randseed
git in /var/cfengine/bin
bin/gitbin/git-cvsserverbin/gitkbin/git-receive-packbin/git-shellbin/git-upload-archivebin/git-upload-pack
Misc. in /var/cfengine/bin
bin/curlbin/lmdumpbin/opensslbin/rpmvercmpbin/rsyncbin/runalerts.sh
Postgres in /var/cfengine/bin
bin/clusterdbbin/createdbbin/createlangbin/createuserbin/dropdbbin/droplangbin/dropuserbin/initdbbin/pg_basebackupbin/pg_configbin/pg_controldatabin/pg_ctlbin/pg_dumpbin/pg_dumpallbin/pg_isreadybin/pg_receivexlogbin/pg_resetxlogbin/pg_restorebin/postgresbin/postmasterbin/psqlbin/reindexdbbin/vacuumdb
Not verified
state/history.lmdb
CFEngine Enterprise maintains this long-term trend database.
state/cf_observations.lmdb
This database contains the current state of the observational history ofthe host as recorded bycf-monitord.
state/cf_state.lmdb
A database of persistent classes active on this current host.
state/nova_measures.lmdb
CFEngine Enterprise database of custom measurements.
state/nova_static.lmdb
CFEngine Enterprise database of static system discovery data.
state/cf_procsA cache of the process table. This is useful formeasurementpromises about processes.state/cf_rootprocsA cache of the process table of processes owned by the root user. This is useful formeasurementpromises about processes.state/cf_otherprocsA cache of the process table for processes not owned by the root user. This is useful formeasurementpromises about processes.state/file_changes.log
A time-stamped log of which files have experienced content changes sincethe last observation, as determined by the hashing algorithms inCFEngine.
state/*_measure.log
CFEngine Enterprise maintains user-defined logs based on specificallypromised observations of the system.
state/env_data
This file contains a list of currently discovered classes and variablevalues that characterize the anomaly alert environment. They are alteredby the monitor daemon.
/var/logs/CFEngine-Install.log
This file contains logs related to the CFEngine package installation.
- 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