cf-serverd
cf-serverd is a socket listening daemon providing two services: it acts as afile server for remote file copying and it allows an authorizedcf-runagent to start acf-agent run.cf-agenttypically connects to acf-serverd instance to request updated policy code,but may also request additional files for download.cf-serverd employsrole based access control (defined in policy code) to authorizerequests.
cf-serverd keeps the promises made incommon andserver bundles, and isaffected bycommon andserver control bodies.
Notes:
- This daemon reloads it's config when the SIGHUP signal is received.
- If
enable_report_dumpsexists inWORKDIR(/var/cfengine/enable_report_dumps)cf-serverdwill log reports provided tocf-hubtoWORKDIR/diagnostics/report_dump(/var/cfengine/diagnostics/report_dumps). This data is useful when troubleshooting reporting issues with CFEngine Enterprise. cf-serverdalways considers the classserverto be defined.SIGUSR1sets the log level to debug.SIGUSR2sets the log level to notice.
History:
- SIGHUP behavior added in 3.7.0
enable_report_dumpsadded in 3.16.0
Command reference
--help , -h - Print the help message --log-level , -g value - Specify how detailed logs should be. Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug' --debug , -d - Enable debugging output --verbose , -v - Output verbose information about the behaviour of the agent --version , -V - Output the version of the software --file , -f value - Specify an alternative input file than the default. This option is overridden by FILE if supplied as argument. --define , -D value - Define a list of comma separated classes to be defined at the start of execution --negate , -N value - Define a list of comma separated classes to be undefined at the start of execution --no-lock , -K - Ignore locking constraints during execution (ifelapsed/expireafter) if "too soon" to run --inform , -I - Print basic information about changes made to the system, i.e. promises repaired --diagnostic , -x - Activate internal diagnostics (developers only) --no-fork , -F - Run as a foreground processes (do not fork) --ld-library-path, -L value - Set the internal value of LD_LIBRARY_PATH for child processes --generate-avahi-conf, -A - Generates avahi configuration file to enable policy server to be discovered in the network --color , -C value - Enable colorized output. Possible values: 'always', 'auto', 'never'. If option is used, the default value is 'auto' --timestamp , -l - Log timestamps on each line of log output --graceful-detach, -t value - Terminate gracefully on SIGHUP by detaching from systemd and waiting n seconds before terminating --ignore-preferred-augments - Ignore def_preferred.json file in favor of def.jsonControl promises
Settings describing the details of the fixed behavioral promises made bycf-serverd. Server controls are mainly about determining access policy forthe connection protocol: i.e. access to the server itself. Access to specificfiles must be granted in addition.
bodyservercontrol{allowconnects=>{"127.0.0.1","::1"};allowallconnects=>{"127.0.0.1","::1"};# Uncomment me under controlled circumstances#trustkeysfrom => { "127.0.0.1" , "::1" };}allowconnects
Description: List of IP addresses that may connect to theserver port. They are denoted in either IP or subnet form. Forcompatibility reasons, regular expressions are also accepted.
This is the first line of defence; clients who are notin this list may not connect or send any data to the server.
See also the warning about regular expressions inallowallconnects.
Type:slist
Allowed input range: (arbitrary string)
Examples:
allowconnects=>{"127.0.0.1","::1","200.1.10.0/24","200\.1\.10\..*",};allowallconnects
Description: List of IP addresses that may have more than oneconnection to the server port. They are denoted in either IP or subnetform. For compatibility reasons, regular expressions are also accepted.
The clients that are not listed here may have only one open connectionat the time with the server.
Note that127.0.0.1 is a regular expression (i.e., "127 anycharacter 0 any character 0 any character 1"), but this will onlymatch the IP address127.0.0.1. Take care with IP addresses anddomain names, as the hostname regular expressionwww.domain.comwill potentially match more than one hostname (e.g.,wwwxdomain.com, in addition to the desired hostnamewww.domain.com).
Type:slist
Allowed input range: (arbitrary string)
Examples:
allowallconnects=>{"127.0.0.1","::1","200.1.10.0/24","200\.1\.10\..*",};allowlegacyconnects
Description: List of hosts from which the server accepts connectionsthat are not using the latest protocol.
To define subnets or address ranges, use CIDR notation:
allowlegacyconnects=>{"192.168.1.0/24","192.168.2.123"}In CFEngine <= 3.8, absence of this attribute means that connections from all hosts are accepted,for compatibility with pre-3.6 CFEngine versions.
Set this attribute to an empty list to not allow any incoming connectionsusing legacy protocol versions:
allowlegacyconnects=>{}In CFEngine >= 3.9, legacy protocol is disallowed by default, and you have tospecify a list of hosts allowed to use the legacy protocol.
Type:slist
Allowed input range: (arbitrary string)
See also:protocol_version
allowciphers
Description: List of TLS ciphers the server accepts bothincoming andoutgoing (in the case of client initiated reporting with CFEngine Enterprise) connections usingcf-serverd.For a list of possible ciphers, see man page for "openssl ciphers".
Type:string
Allowed input range: (arbitrary string)
Default value: AES256-GCM-SHA384:AES256-SHA
Example:
bodyservercontrol{# Only this non-default cipher is to be acceptedallowciphers=>"RC4-MD5";}Note: When used withprotocol_version 1 (classic protocol),this does not do anything as the classic protocol does not support TLS ciphers.
See also:protocol_version,tls_ciphers,tls_min_version,allowtlsversion,encrypt,logencryptedtransfers,ifencrypted
History: Introduced in CFEngine 3.6.0
allowtlsversion
Description: Minimum TLS version allowed for bothincoming andoutgoing (in the case of client initiated reporting with CFEngine Enterprise) connections usingcf-serverd.
Type:string
Allowed input range: (arbitrary string)
Default value: 1.0
Example:
bodyservercontrol{# Allow only TLSv1.1 or higherallowtlsversion=>"1.1";}Note: When used withprotocol_version 1 (classic protocol),this attribute does not do anything.
See also:protocol_version,tls_ciphers,tls_min_version,allowciphers,encrypt,logencryptedtransfers,ifencrypted
History: Introduced in CFEngine 3.7.0
allowusers
Description: List of usernames who may execute requests from thisserver
The usernames listed in this list are those asserted as public keyidentities during client-server connections. These may or may notcorrespond to system identities on the server-side system.
Type:slist
Allowed input range: (arbitrary string)
Example:
allowusers=>{"cfengine","root"};bindtointerface
Description: IP of the interface to which the server should bindon multi-homed hosts
On multi-homed hosts, the server and client can bind to a specificinterface for server traffic. The IP address of the interface mustbe given as the argument, not the device name.
Type:string
Allowed input range: (arbitrary string)
bindtointerface=>"192.168.1.1";To bind to all interfaces, including IPV6:
bindtointerface=>"::";Note that a bug in netstat will not correctly report that cf-serverd islistening on both IPV4 and IPV6 interfaces. A test with netcat (nc) willconfirm.
# nc -v -4 172.16.100.1 5308Connectionto172.16.100.15308port[tcp/cfengine]succeeded!^C# nc -v -6 fe80:470:1d:a2f::2 5308Connectiontofe80:470:1d:a2f::25308port[tcp/cfengine]succeeded!^Ccfruncommand
Description: Path to the cf-agent command or cf-execd wrapper forremote execution
It is normal for this to point to the location ofcf-agent but itcould also point to thecf-execd, or even another program orshell command at your own risk.
Type:string
Allowed input range:.+
bodyservercontrol{cfruncommand=>"/var/cfengine/bin/cf-agent";}See also:cf-runagent,bundle resource_type in server access promises
call_collect_interval
CFEngine Enterprise only.
Description: The interval in minutes in between collect calls tothe CFEngine Server offering a tunnel for report collection.
If option time is set, it causes the server daemon to peer with apolicy hub by attempting a connection at regular intervals of thevalue of the parameter in minutes.
This feature is designed to allow Enterprise report collection fromhosts that are not directly addressable from a hub data-aggregationprocess. For example, if some of the clients of a policy hub arebehind NAT or firewall then the hub possibly is not able toopen a connection to port 5308 of the client. The solution is toenablecall_collect_interval on the client's cf-serverd.Note: also remember to admit the client's IP on the hub'scollect_calls ACL (seeresource_type inbundle serveraccess_rules).
If this option is set, the client'scf-serverd will "peer" withthe server daemon on a policy hub. This means that,cf-serverd onan unreachable (e.g. NATed) host will attempt to report in to thecf-serverd on its assigned policy hub and offer it a short timewindow in which to download reports over the establishedconnection. The effect is to establish a temporary secure tunnelbetween hosts, initiated from the satellite host end. Theconnection is made in such a way that host autonomy is notcompromised. Either hub may refuse or decline to play their role atany time, in the usual way (avoiding DOS attacks). Normal accesscontrols must be set for communication in both directions.
Collect calling cannot be as efficient as data collection by thecf-hub, as the hub is not able to load balance. Hosts that use thisapproach should exclude themselves from the cf-hub datacollection.
The sequence of events is this:
- The host's
cf-serverdconnects to its registered CFEngine Server - The host identifies itself to authentication and accesscontrol and sends a collect-call pull-request to the server
- The server might honor this, if the access control grants access.
- If access is granted, the server has
collect_windowseconds toinitiate a query to the host for its reports. - The server identifies itself to authentication and accesscontrol and sends a query request to the host to collect thereports.
- When finished, the host closes the tunnel.
Type:int
Allowed input range:0,99999999999
Example:
call_collect_interval => "5";The full configuration to enable client initiated reporting would look something like this:
########################################################## Server config#########################################################bodyservercontrol{allowconnects=>{"10.10.10.0/24","::1"};allowallconnects=>{"10.10.10.0/24","::1"};trustkeysfrom=>{"10.10.10.0/24","::1"};call_collect_interval=>"5";}#########################################################bundleservermy_access_rules(){access:policy_server::"collect_calls"resource_type=>"query",admit=>{"10.10.10.10"},comment=>"The policy server must admit queries for collect_calls (client initated reporting).";satellite_hosts::"delta"comment=>"Grant access to cfengine hub to collect report deltas",resource_type=>"query",admit=>{"policy_hub"};"full"comment=>"Grant access to cfengine hub to collect full report dump",resource_type=>"query",admit=>{"policy_hub"};}Note: In theMasterfiles Policy Framework,body server control and default access rules are found incontrols/cf_serverd.cf.
History: Was introduced in Enterprise 3.0.0 (2012)
collect_window
CFEngine Enterprise only.
Description: A time in seconds that a collect-call tunnel remainsopen to a hub to attempt a report transfer before it is closed
Type:int
Allowed input range:0,99999999999
collect_window => "15";Default value: 30.
History: Was introduced in Enterprise 3.0.0 (2012)
denybadclocks
Description: true/false accept connections from hosts with clocksthat are out of sync
A possible form of attack on the fileserver is to request filesbased on time by setting the clocks incorrectly. This optionprevents connections from clients whose clocks are drifting too farfrom the server clock (where "too far" is currently defined as"more than an hour off"). This serves as a warning about clockasynchronization and also a protection against Denial of Serviceattempts based on clock corruption.
Type:boolean
Default value: true
Example:
bodyservercontrol{denybadclocks=>"true";}denyconnects
Description: List of IPs that may NOT connect to theserver port
Hosts or IP addresses that are explicitly denied access. Thisshould only be used in special circumstances. One should nevergrant generic access to everything and then deny special cases.Since the default server behavior is to grant no access toanything, this list is unnecessary unless you have already grantedaccess to some set of hosts using a generic pattern, to which youintend to make an exception.
See also the warning about regular expressions inallowallconnects.
Type:slist
Allowed input range: (arbitrary string)
Example:
bodyservercontrol{denyconnects=>{"badhost\.domain\.evil","host3\.domain\.com"};}logallconnections
Deprecated: This attribute was deprecated in 3.7.0.
logencryptedtransfers
Description: true/false log all successful transfers required tobe encrypted. Only applies to classic protocol connections(because the new protocol uses TLS which enforces encryption for everything).
If true the server will log all transfers of files which the serverrequires to encrypted in order to grant access (seeifencrypted)to syslog. These files are deemed to be particularly sensitive.
Type:boolean
Default value: false
Example:
bodyservercontrol{logencryptedtransfers=>"true";}See also:ifencrypted,encrypt,tls_ciphers,tls_min_version,allowciphers,allowtlsversion,protocol_version
maxconnections
Description: Maximum number of concurrent connections the server will accept. Recommended value for a hub istwo times the total number of hosts bootstrapped to this hub.
Type:int
Allowed input range:0,99999999999
Default value: 30
Example:
# client sidebodyagentcontrol{maxconnections=>"1000";}# server sidebodyservercontrol{maxconnections=>"1000";}port
Description: Default port for the CFEngine server
Type:int
Allowed input range:1,65535
Default value: 5308
Example:
bodyhubcontrol{port=>"5308";}bodyservercontrol{specialhost::port=>"5308";!specialhost::port=>"5308";}Notes:
The standard or registered port number is tcp/5308. CFEngine doesnot presently use its registered udp port with the same number, butthis could change in the future.
Changing the standard port number is not recommended practice. Youshould not do it without a good reason.
serverfacility
Description: Menu option for syslog facility level
Type: (menu option)
Allowed input range:
LOG_USERLOG_DAEMONLOG_LOCAL0LOG_LOCAL1LOG_LOCAL2LOG_LOCAL3LOG_LOCAL4LOG_LOCAL5LOG_LOCAL6LOG_LOCAL7See syslog notes.
Default value:LOG_USER
Example:
bodyservercontrol{serverfacility=>"LOG_USER";}skipverify
Description: This option is obsolete, does nothing and is retainedfor backward compatibility.
Type:slist
Allowed input range: (arbitrary string)
Example:
bodyservercontrol{skipverify=>{"special_host.*","192.168\..*"};}trustkeysfrom
Description: List of IPs from whom the server will accept and trustnew (untrusted) public keys. They are denoted in either IP or subnetform. For compatibility reasons, regular expressions are alsoaccepted.
The new accepted public keys are written to theppkeysdirectory, and a message is logged:
192.168.122.254> Trusting new key: MD5=0d5603d68dd62d35bab2150e35d055aeNOTE:trustkeysfrom should normally be an empty list except incontrolled circumstances, for example when the network is being set upand keys are to be exchanged for the first time.
See also the warning about regular expressions inallowallconnects.
Type:slist
Allowed input range: (arbitrary string)
Example:
bodyservercontrol{trustkeysfrom=>{"10.0.1.1","192.168.0.0/16"};}listen
Description: true/false enable server daemon to listen on definedport
This attribute allows to disablecf-serverd from listening on anyport. Should be used in conjunction withcall_collect_interval.
This setting only applies to CFEngine clients, the policy hub willnot be affected. Changing this setting requires a restart ofcf-serverd for the change to take effect.
Type:boolean
Default value: true
Example:
bodyservercontrol{listening_host_context::listen=>"true";!listening_host_context::listen=>"false";}History: Was introduced in 3.4.0, Enterprise 3.0 (2012)
Deprecated attributes in body server 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.
auditingdynamicaddresseshostnamekeyskeycacheTTL
- 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