Lucas Manuel Rodriguez
Lucas Manuel Rodriguez
There are three components in fleetd connecting to the Fleet server using TLS: orbit
, Fleet Desktop
and osqueryd
.
This article aims to describe how TLS CA root certificates are configured in fleetd to connect to a Fleet server securely.
The default behavior is using the fleetctl package
command without the --fleet-certificate
flag.
orbit
and Fleet Desktop
will use the system's CA root store to connect to Fleet.osqueryd
doesn't support using the system's CA root store, it requires passing in a certificate file with the root CA store (via the --tls_server_certs
flag). The fleetctl
executable contains an embedded certs.pem
file generated from https://curl.se/docs/caextract.html [0]. When generating a fleetd package with fleetctl package
such embedded certs.pem
file is added to the package [1]. Fleetd configures osqueryd
to use the certs.pem
file as CA root store by setting the --tls_server_certs
argument to such path.--fleet-certificate
in fleetctl package
When using --fleet-certificate
in fleetctl package
, such certificate file is used as a CA root store by orbit
, Fleet Desktop
and osqueryd
(the system's CA store is not used when generating the fleetd package this way).
TLS clients require the CA root and all intermediate certificates that signed the leaf server certificate to be verified. This means that if the bundled certificate in fleetd [1] doesn't have intermediate certificates that signed the leaf certificate, then the Fleet server will have to be configured to serve the "fullchain". Here's a list of some scenarios assuming your Fleet server certificate has an intermediate signing certificate:
We've seen TLS certificate issues in the following configurations: (for more information see https://github.com/fleetdm/fleet/issues/6085):
When there are certificate issues you will see the following kind of errors in server logs:
2024/07/05 15:03:52 http: TLS handshake error from <remote_ip>:<remote_port>: remote error: tls: bad certificate
2024/07/05 15:03:53 http: TLS handshake error from <remote_ip>:<remote_port>: local error: tls: bad record MAC
and the following kind of errors on the client side (fleetd):
2024-07-05T15:04:52-03:00 DBG get config error="POST /api/fleet/orbit/config: Post \"https://fleet.example.com/api/fleet/orbit/config\": tls: failed to verify certificate: x509: certificate signed by unknown authority"
W0705 15:16:44.739495 1251102656 init.cpp:760] Error reading config: Request error: certificate verify failed
To troubleshoot issues with certificates you can use fleetctl debug connection
command, e.g.:
fleetctl debug connection \
--fleet-certificate ./your-ca-root.pem \
https://fleet.example.com
[0]: We have a Github CI action that runs daily that updates the certs.pem on the repository whenever there's a new version of cacert.pem
in https://curl.se/docs/caextract.html. Such file is embedded into the fleetctl
executable and used when generating fleetd packages.
[1]: The bundled certificate in fleetd is installed in /opt/orbit
in macOS/Linux and C:\Program Files\Orbit
on Windows. By default its name is certs.pem
, but it will have a different name if the --fleet-certificate
flag was used when generating the package (fleetctl package
).