PROTOCOLS.CFG

Section: File Formats (5)
Updated: Version 4.3.31: 6 Nov 2026
Index Return to Main Contents

 

protocols.cfg - Configuration of TCP network services

 

$XYMONHOME/etc/protocols.cfg

 

protocols.cfg contains definitions of how xymonnet(1) should test a TCP-based network service (i.e. all common network services except HTTP and DNS). For each service, a simple dialogue can be defined to check that the service is functioning normally, and optional flags determine if the service has e.g. a banner or requires SSL- or telnet-style handshaking to be tested.

 

protocols.cfg is a text file. A simple service definition for the SMTP service would be this:

   [smtp]
      expect "220" until "220 "
      send "ehlo xymonnet\r\n"
      expect "250" until "250 "
      options banner

The lines run in the order they are written, which is the order of the conversation: wait for a greeting beginning with "220", send EHLO, check the answer begins with "250". What the service said is included in the status message.

Order is what a definition expresses. A server that speaks first is written with expect first; one that says nothing until asked -- clamd and spamd -- with send first. Sending before the greeting violates SMTP, and Postfix 3.9 and later reject the session for it.

A definition may hold as many steps as the conversation needs.

For services that require ALPN protocol negotiation (such as IMAPS multiplexed by Nginx on the same port as HTTPS), you can define:

   [imaps443]
      options ssl,alpn=imap
      port 443

The full set of commands available for the protocols.cfg file are:

[NAME]
Define the name of the TCP service, which will also be the column-name in the resulting display on the test status. If multiple tests share a common definition (e.g. ssh, ssh1 and ssh2 are tested identically), you may list these in a single "[ssh|ssh1|ssh2]" definition, separating each service-name with a pipe-sign.

Defines the strings to send to the service after a connection is established, and the response that is expected. Either of these may be omitted, in which case xymonnet(1) will simply not send any data, or match a response against anything.

An expect takes one line. Where a reply runs to several, say where it ends:

      expect "250" until "250 "

SMTP and FTP continue with "250-" and finish with "250 ", NNTP ends a block with ".", IMAP with the command tag. Naming the terminator reads to the end of the reply however it is split across packets; without it the tail would be matched as the answer to the next command.

A terminator ending in a space also matches that text at the end of a line, so "250 " accepts a last line of "250" with no text after it. "250-" does not match either way.

The send- and expect-strings use standard escaping for non-printable characters. "\r" represents a carriage-return (ASCII 13), "\n" represents a line-feed (ASCII 10), "\t" represents a TAB (ASCII 9). Binary data is input as "\xNN" with NN being the hexadecimal value of the byte.

Switch on something the CLIENT does. The word names code in xymonnet, not anything sent to the server, and there are two: tls and iac. Anything else is refused when the file is read.

start tls upgrades the connection where the line sits, after the server has agreed to it:

   [submissiontls]
      expect "220" until "220 "
      send "ehlo xymonnet\r\n"
      expect "250" until "250 "
      send "starttls\r\n"
      expect "220"
      start tls
      send "ehlo xymonnet\r\n"
      expect "250" until "250 "
      port 587

Plaintext before the line, encrypted after it, on one socket -- what SMTP on 25, submission on 587 and IMAP on 143 do, and the only way those ports reach a certificate. The certificate is read from the upgraded session, so the service reaches the sslcert column with its expiry checked.

As the FIRST step it is TLS from the first byte, which is what implicit-TLS ports need: [smtps], [imaps] and the rest are written that way.

Two words because the request is protocol-specific and the step is not: FTP asks "AUTH TLS", POP3 "STLS", SMTP and IMAP "STARTTLS", and the asking is left to a send.

start iac negotiates telnet options where the line sits:

   [mud]
      start iac
      expect "Welcome"
      port 1701

IAC belongs to the telnet protocol, not to port 23 -- MUDs and BBSes negotiate on their own ports. The commands are stripped off the front of the reply, so the next step sees the text behind them, and they are refused: WILL is answered DONT and DO is answered WONT, which is what gets a server talking that holds its greeting until the client replies. WONT and DONT are answered with nothing -- RFC 854 makes them the end of that option's negotiation, and replying starts an exchange that never stops.

A 5250 or 3270 host sends no text at any point: once the options settle it waits for a terminal to negotiate itself, which a probe is not. Such a service can only be checked as a connect, and no version of Xymon has done more.

The TCP port for this service. Every entry in the shipped file names one.

An entry without it takes the port the host's /etc/services gives its name, and xymonnet logs a warning naming the entry on every run: that port can differ from machine to machine, and nothing in this file shows it. This keeps an entry written before every entry named its port -- an upgrade keeps the sections already in this file -- tested until it gets one. A name /etc/services does not know either can only be tested where hosts.cfg names a port for that host.

A port may be given per host in hosts.cfg as SERVICE:PORT, which overrides the entry.

Defines test options. The possible options are
   banner - read the socket once when no step asks to
   ssl - TLS from the first byte (the older spelling of a leading "start tls")
   telnet - negotiate telnet options (the older spelling of "start iac")
   alpn=protocol1,protocol2 - specify ALPN protocols to negotiate during SSL handshake

ssl, banner and telnet are kept for files that already use them; no shipped entry does. A step says the same thing and says where: ssl is a leading start tls, telnet is start iac (an entry carrying the option is given that step), and banner is an expect -- which also asks for an answer, where banner takes the first read and judges nothing, so a service that accepts the connection and never speaks reports up with an empty banner.

An entry with no send and no expect is a connect check: nothing is asked and nothing is matched, so the port opening is the whole of it. ldap, ldaps, qmtp, qmqp, netbios-ssn and lpd ship that way -- each waits for a length-prefixed binary request whose reply a prefix match cannot judge -- and so does bbd, where xymond answers only after the client half-closes the write side.

Such an entry reports up wherever the port is open, which is also what a half-written one does. The file cannot tell them apart, so the shipped set is pinned in the test suite rather than marked here.

 

An expect matches the start of a reply and consumes to the end of the LINE. Binary protocols work as a single exchange -- [rdp] ships one, matching raw bytes written as \exNN -- but not as a conversation: when a step follows, the reply must end in a newline first, and binary framing has none. Leave such a service its port and no steps rather than write ones that will wait for a terminator that never comes.

Matching is anchored: expect compares the start of the reply, and until the start of a line. A token appearing anywhere else cannot be reached. [oratns], whose useful payload follows a length-prefixed packet header, and [ircd], where the 001 welcome is the second token on a line beginning with the server's name, are both out of reach this way.

An empty expect "" is the fallback: it matches any reply and rejects none, so it cannot say whether the answer was the right one -- only that the server sent one. Both entries above use it. It is worth having because a step that only sends reports up against a port that accepts the request and never answers, which is what a wedged server looks like from outside.

There is no branching either. A reply that may legitimately take one of two forms -- EHLO answered with 250, or with 500 by a server that speaks only HELO -- cannot be written here.

 

A line xymonnet cannot resolve refuses the whole entry: an unrecognised directive or option, start with a feature other than tls, a second start tls, options ssl together with start tls, or a mistyped until. It is reported when the file is read, and the entry then sends nothing at all -- not even a TLS handshake.

Obeying the rest would report green: a dropped step leaves a shorter conversation that still succeeds, and options sssl would ask for TLS and get a plaintext probe. A refused entry is yellow with the reason in its status, because the check is broken rather than the service. --checkresponse=red escalates it; unlike an expect mismatch it is reported whether --checkresponse was given or not.

If the FILE cannot be opened, the same applies to every service: none is checked, and each says so. xymonnet once fell back to a set of probes compiled into the binary, so the columns kept reporting while the checks behind them had quietly become older and weaker ones. What is still compiled in is the name-to-port list described under port, and nothing else.

 

$XYMONHOME/etc/protocols.cfg

 

xymonnet(1)

 

NAME
SYNOPSIS
DESCRIPTION
FILE FORMAT
WHAT CANNOT BE EXPRESSED
WHEN SOMETHING CANNOT BE READ
FILES
SEE ALSO

This document was created by mandoc, using the manual pages.