xymon-tls - Sending Xymon messages over TLS
Xymon messages travel in plaintext on port 1984. xymond can also
take them over TLS, on a port of its own (1985 by default), and the xymon
client sends there when a recipient is written "xymons://". This
page is how to set that up and roll it out. Each setting it names is
specified in the page given with it.
TLS adds, in this order:
- encryption
- Nobody on the network can read the messages.
- the server's identity
- A client sends only to a server whose certificate it trusts and that names
the host or address it connects to.
- each client's
identity
- A client presents a certificate naming its host, and may then report for
that host from any address, without being listed in
--status-senders.
The plaintext port keeps working beside the TLS port, so clients
move over one at a time.
xymond takes TLS on the addresses given with --tls-listen
in the xymond command of tasks.cfg(5), written as for --listen (see
xymond(8)):
- --listen=0.0.0.0:1984 --tls-listen=0.0.0.0:1985
Its certificate and key are $XYMONHOME/etc/tls/xymond.pem and
$XYMONHOME/etc/tls/xymond.key, unless XYMOND_TLS_CERT and XYMOND_TLS_KEY in
xymonserver.cfg(5) say otherwise. The key must not be readable by others
than its owner and its group.
The certificate must name, in its subjectAltName, what the clients
connect to: the host name in their XYMSRV, or the IP address if that is what
XYMSRV holds. A certificate from a public or company CA that the clients'
systems already trust needs nothing more on the clients.
The file must hold the whole chain: the server certificate and the
intermediate CA certificates above it. From an ACME client that is
fullchain.pem, not cert.pem — --check-tls passes a bare
certificate, but a client verifying through a public trust store then fails
with "unable to get local issuer certificate".
Before restarting xymond, and after each renewal, check the files
as the user xymond runs as:
- xymond --check-tls --env=$XYMONHOME/etc/xymonserver.cfg
xymond does not start when the files do not load. SIGHUP loads the
certificate and key files again, so a renewed certificate is served from the
next connection on without a restart; if the new one does not load, xymond
logs why and keeps the one it had. A changed setting — XYMOND_TLS_CA,
XYMOND_TLS_REQUIRE_CERT, or the certificate and key paths themselves
— needs a restart: SIGHUP re-reads the files at the paths given at
startup, not the settings.
An expired certificate is still served, with a warning in xymond's
log, and every client that verifies it refuses it. Running
--check-tls daily, from cron or a task in tasks.cfg(5), shows the
days left before that happens.
A client sends over TLS when its recipient is written
"xymons://":
- XYMSRV="xymons://xymon.example.com"
in xymonclient.cfg(5), or xymonserver.cfg(5) for the tools on the
server. The port is XYMONDTLSPORT, 1985 by default, unless the recipient
gives one. Recipients in XYMSERVERS are taken one by one, so a client can
send to a server over TLS and to another in plaintext.
A recipient "xymons://" either gets TLS or gets nothing:
when the handshake fails, the message is not sent, and xymon(1) says why.
There is no retry in plaintext.
The client is built with TLS when OpenSSL is found at build time;
a client built without it refuses a "xymons://" recipient.
Choose by what must be protected; each level adds to the one
before.
- 1. Encryption only
- XYMON_TLS_VERIFY=none on the clients. The messages are encrypted, but a
client sends to whoever answers on the server's address. Useful only while
the server's certificate is not yet trusted by the clients.
- 2. The server verified
- The default. Clients trust the server's CA and check that the certificate
names the server. The CA is the default trust store of the OpenSSL the
client is built with — on some systems not the operating system's,
so set XYMON_TLS_CA or SSL_CERT_FILE to name it — or the file
XYMON_TLS_CA names. XYMON_TLS_SNI gives the name to check when XYMSRV
holds an address and the certificate names the host.
- 3. Each client verified
- On the server, XYMOND_TLS_CA names the CA that issues the clients'
certificates. Each client sets XYMON_TLS_CERT and XYMON_TLS_KEY to a
certificate whose subjectAltName is its host's name exactly as hosts.cfg
has it. That host may then report for itself from any address; the
certificate allows nothing for any other host. With
XYMOND_TLS_REQUIRE_CERT=TRUE, a TLS client without a certificate is
refused.
The client settings are in xymonserver.cfg(5); the server settings
are there too and in xymond(8).
- 1.
- Give xymond a certificate and a --tls-listen address. Check with
--check-tls, then restart xymond. Nothing changes for the
clients.
- 2.
- Move clients to "xymons://", a few at a time. A client that
cannot reach the TLS port reports nothing, and its columns go purple: that
is how a missed one shows.
- 3.
- For level 3, set XYMOND_TLS_CA, restart xymond, and give each client its
certificate. Clients without one are still served and checked by address
until XYMOND_TLS_REQUIRE_CERT is set.
- 4.
- To stop plaintext from the network, let the plaintext port answer only
locally, --listen=127.0.0.1:1984, and set
XYMSRV="127.0.0.1" in the server's xymonserver.cfg(5) so the
server's own tools still reach it; or close port 1984 to the networks that
must use TLS in the firewall.
Senders that report for other hosts — the network tests of
xymonnet(1) on another server, a collector — are allowed by address
in --status-senders, as before. With XYMOND_TLS_REQUIRE_CERT they
also need a certificate to connect over TLS.
Xymon distributes no certificates: it reads the files it is
given.
- The CA certificate
- is public. Copy it to every host that needs it with whatever manages the
hosts' configuration.
- A self-signed server
certificate
- is its own CA. Copy the certificate, never its key, to the clients and
name that file in XYMON_TLS_CA.
- A private key
- is made on the host that uses it and never leaves it. The host makes a
request, the CA signs it, and only the certificate travels back.
- Renewal
- On a client, replace the files: the xymon program reads them each time it
runs. On the server, replace them, check with --check-tls, and send
SIGHUP to xymond. Replace a file by renaming a complete new one over it,
so that nothing reads it half-written. With an ACME client, copy the
certificate and key into $XYMONHOME/etc/tls/ from its deploy hook, owned
by the user xymond runs as — the client's own key is root-owned and
mode 0600, which xymond refuses to read — then --check-tls
&& kill -HUP the xymond process. --check-tls exits 0 when
the files load and 1 when they do not, so it can gate the HUP from a hook
or cron.
For example, with OpenSSL, a key and a request for
web01.example.com, made on that host:
- openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes
-keyout web01.key -out web01.csr -subj "/CN=web01.example.com"
-addext subjectAltName=DNS:web01.example.com
then signed by the CA, keeping the request's subjectAltName:
- openssl x509 -req -in web01.csr -CA ca.pem -CAkey ca.key -CAcreateserial
-days 365 -copy_extensions copy -out web01.pem
-copy_extensions needs OpenSSL 3.0 or later; with an older one,
give the subjectAltName with -extfile instead.
- Revocation is not checked: no CRL, no OCSP. A certificate stays good until
it expires, or until its CA is replaced.
- xymonproxy(8), and msgcache(8) with xymonfetch(8), use connections of
their own, in plaintext only.
- A certificate cannot be given rights beyond its own host: reporting for
other hosts, and the maintenance and administration commands, are allowed
by address, with the --*-senders options of xymond(8).
- TLS encrypts; it does not say who may connect. Without
--status-senders and the other --*-senders lists of
xymond(8), anyone who reaches the TLS port can still read "config
hosts.cfg" — which may hold credentials — and query
statuses, only now encrypted. Set the lists as for the plaintext port.
- NAME
- DESCRIPTION
- THE SERVER
- THE CLIENTS
- THREE LEVELS
- ROLLING IT OUT
- CERTIFICATES
- LIMITS
- SEE ALSO