Skip to content

Live tests ​

A live test runs a sensor or a protocol client against a real server: a Windows machine, a mail server, a router, a database. The servers belong to whoever runs the tests, so a live test learns where its target is from environment variables. Addresses, names, user names and passwords of a lab never go into the repository.

The convention ​

  • A variable is named PROBEWARD_TEST_<AREA>_<WHAT>. One area is one lab target: WINRM is a Windows machine, MAIL is a mail server, NETEM is the impaired network, and so on. WHAT is HOST, USER, PASSWORD, NAME (the name the target's certificate carries), PIN (a certificate fingerprint) or something the area needs.
  • Passwords and secrets are only ever in the environment. Give a variable the contents of a file with export PROBEWARD_TEST_MAIL_PASSWORD="$(cat /path/to/file)", so that the secret is not copied into a script that is kept.
  • Examples in this page use the documentation range 192.0.2.0/24 and the domain example.org.

When variables are not set ​

A live test whose variables are not all set does not fail. It prints one line that names the missing variables and returns, so it counts as passed:

text
mail_failures: PROBEWARD_TEST_MAIL_HOST/USER/PASSWORD not set, live test not run

Cargo hides the output of a passing test, so add -- --nocapture to see these lines. A test that prints nothing and returns, or one that panics because a variable is missing, is a bug.

Two kinds of test are not in this rule:

  • A variable that only widens a test is optional, and the test does what it can without it.
  • The daemon tests (see Local daemons) run real programs on this machine. A missing program fails the test and says what to install, unless PROBEWARD_SKIP_DAEMON_TESTS=1 asks for a skip.

Running a group ​

Set the area's variables, then run the test file that reads them. A name after -- filters the tests:

sh
export PROBEWARD_TEST_MAIL_HOST=192.0.2.30 PROBEWARD_TEST_MAIL_NAME=mail.example.org   # and the rest of the area
cargo test -p probeward-sensors --test mail_ftp_live -- --nocapture
cargo test -p probeward-sensors --test live_protocols ldap -- --nocapture   # only the tests with "ldap" in the name

A person with a lab keeps all its variables in one shell file outside the repository, with mode 600, and sources it: . ~/lab/live-tests.env. Everything in the tables below that the lab has can then run in one go with cargo test -p probeward-sensors, and the groups it lacks print their one line and return.

Windows (WINRM, KRB, WMI, AD, WIN) ​

Read by crates/probeward-sensors/tests/winrm_live.rs, except where the last column says otherwise.

VariableMeaningNeededDefault
PROBEWARD_TEST_WINRM_HOSTAddress of the machine, optionally with :portRequiredPort 5985
PROBEWARD_TEST_WINRM_USERAccount: user, or DOMAIN\userRequired
PROBEWARD_TEST_WINRM_PASSWORDIts passwordRequired
PROBEWARD_TEST_WINRM_ROLESComma-separated server roles the machine has: iis, sql, ad. The tests of a role run only when it is listedOptionalNone, so those tests print a line and return
PROBEWARD_TEST_AD_EXPECThealthy or broken: the state the domain's replication is inOptionalThe replication test only checks the shape of the answer
PROBEWARD_TEST_WIN_FILE_DIRA prepared folder on the machine, for the win_file test (see the page of the sensor)OptionalThe test prints a line and returns
PROBEWARD_TEST_WINRM_REALMThe Active Directory domain's DNS name. With _HOSTNAME, the whole suite logs in with Kerberos instead of Negotiate. Setting only one of the two panicsOptionalNegotiate
PROBEWARD_TEST_WINRM_HOSTNAMEThe machine's full DNS name, which names its service principalOptional, with _REALM
PROBEWARD_TEST_WINRM_KDCA domain controller's address, when DNS cannot find oneOptionalFound through DNS
PROBEWARD_TEST_WQLA WQL query for record_raw, which prints the decrypted responses to it for making fixturesOptionalNothing is recorded
PROBEWARD_TEST_NSThe namespace for that queryOptionalroot/cimv2

Also read, in crates/probeward-sensors/src/proto/winrm/mod.rs: PROBEWARD_TEST_WINRM_HOST, _USER and _PASSWORD, for one test that needs the session's insides.

Kerberos against a domain controller, read by the unit tests in crates/probeward-sensors/src/proto/winrm/kerberos/tests.rs (run with cargo test -p probeward-sensors --lib kerberos -- --nocapture):

VariableMeaningNeededDefault
PROBEWARD_TEST_KRB_KDCThe controller's address, with or without a portRequired
PROBEWARD_TEST_KRB_WSMANIts WinRM address:portRequired
PROBEWARD_TEST_KRB_PASSWORDThe account's passwordRequired
PROBEWARD_TEST_KRB_REALMThe realm, for example CORP.EXAMPLE. Setting it selects the domain controller tests and turns the MIT lab tests offRequired for the dc_ tests
PROBEWARD_TEST_KRB_USERThe account name without the realmRequired for the dc_ tests
PROBEWARD_TEST_KRB_HOSTThe controller's DNS name, which the service principal is made from. It need not resolve hereRequired for the dc_ tests

Without _REALM the same _KDC, _WSMAN and _PASSWORD point at the MIT Kerberos lab that crates/probeward-sensors/tests/kerberos-lab/Dockerfile builds, and the lab_ tests run.

Native WMI over DCOM, read by crates/probeward-sensors/src/proto/wmi/windows.rs. These tests only exist in a Windows build (see building the Windows probe): PROBEWARD_TEST_WMI_HOST (another machine than the one running the test), PROBEWARD_TEST_WMI_USER (DOMAIN\user or user) and PROBEWARD_TEST_WMI_PASSWORD, all required together.

SQL Server, PostgreSQL, MySQL and MariaDB (MSSQL, PGQ, MYSQL, MARIADB) ​

Read by crates/probeward-sensors/tests/db_live.rs. The account only needs to read.

VariableMeaningNeededDefault
PROBEWARD_TEST_PGQ_ADDR, _USER, _PASSWORDPostgreSQL server as host:port, and a loginAll three, or noneThe server of PROBEWARD_TEST_DATABASE_URL
PROBEWARD_TEST_PGQ_TLS1 if the server has TLS with a certificate that is not trusted. Turns on the encryption and pin testOptionalThe TLS test prints a line and returns
PROBEWARD_TEST_MYSQL_ADDR, _USER, _PASSWORDMySQL server as host:port, and a loginAll threeTest prints a line and returns
PROBEWARD_TEST_MYSQL_TLS1 if the server insists on TLSOptionalOff
PROBEWARD_TEST_MARIADB_ADDR, _USER, _PASSWORD, _TLSThe same for MariaDBAs for MySQL
PROBEWARD_TEST_MSSQL_ADDR, _USER, _PASSWORDSQL Server as host:port, and a SQL loginAll threeTest prints a line and returns
PROBEWARD_TEST_MSSQL_TLS1 if the server insists on TLSOptionalOff
PROBEWARD_TEST_MSSQL_WINDOWS_USER, _WINDOWS_PASSWORDA Windows account (DOMAIN\user) for the same server, for the Windows authentication testBoth, with _ADDRTest prints a line and returns

just ci sets MySQL and MariaDB to the containers of compose.dev.yml; see the justfile.

Protocol services: mail, FTP, SFTP, LDAP, RADIUS, NTP, SIP, DHCP ​

Mail, FTP and SFTP are read by crates/probeward-sensors/tests/mail_ftp_live.rs. Run it with -- --test-threads=1: its tests share one mailbox, and the round trip tests count what is in it.

VariableMeaningNeededDefault
PROBEWARD_TEST_MAIL_HOSTAddress of the mail serverRequired
PROBEWARD_TEST_MAIL_NAMEThe name its certificate carriesOptionalEmpty
PROBEWARD_TEST_MAIL_USER, _PASSWORDAn account on itRequired
PROBEWARD_TEST_MAIL_ADDRESSThe account's mail addressRequired
PROBEWARD_TEST_MAIL_CA_FILEPEM file of the authority that issued the certificateRequired
PROBEWARD_TEST_FTP_HOST, _NAME, _USER, _PASSWORD, _CA_FILEThe same for an FTP server (explicit TLS)As for mail, _NAME optional
PROBEWARD_TEST_FTP_FOLDERA folder of the account with files 0, 1, 7 and 30 days old, named file-<n>d.txtRequired
PROBEWARD_TEST_SFTP_HOST, _USER, _PASSWORDAn SFTP server (no certificate to check)Required
PROBEWARD_TEST_SFTP_FOLDERThe same kind of folderRequired

LDAP, RADIUS, NTP, SIP and DHCP are read by crates/probeward-sensors/tests/live_protocols.rs.

VariableMeaningNeededDefault
PROBEWARD_TEST_LDAP_HOSTAddress of the directoryRequired
PROBEWARD_TEST_LDAP_BASEA search base the server holds entries belowRequired
PROBEWARD_TEST_LDAP_USERThe bind name, a distinguished name whose first part is uid=...Required
PROBEWARD_TEST_LDAP_PASSWORDIts passwordRequired
PROBEWARD_TEST_LDAP_NAMEThe name the certificate carries. With SSL_CERT_FILE, turns on the test that checks the certificate against a trust storeOptionalThat test prints a line and returns
SSL_CERT_FILEThe standard variable: a PEM file of the authority. Also read by the MQTT test. Do not export it for the mail and FTP tests: they check that an authority nobody trusts is refused, and this makes the lab's trustedOptional
PROBEWARD_TEST_RADIUS_HOSTAddress of the RADIUS serverRequired
PROBEWARD_TEST_RADIUS_SECRETThe shared secretRequired
PROBEWARD_TEST_RADIUS_USER, _PASSWORDAn account that is acceptedRequired
PROBEWARD_TEST_NTP_HOSTAn NTP serverRequired
PROBEWARD_TEST_SIP_HOSTA SIP server that answers OPTIONS with 200 over UDP and TCPRequired
PROBEWARD_TEST_DHCP_VENDORA vendor class the server answers. Also what turns the DHCP test on. Needs port 68Required
PROBEWARD_TEST_DHCP_INTERFACEThe network interface to useOptionalThe system's choice
PROBEWARD_TEST_DHCP_SERVERAn address an offer must come fromOptionalNot checked

Web, MQTT, Modbus and OPC UA ​

The web tests are read by crates/probeward-sensors/tests/web_flow_live.rs.

VariableMeaningNeededDefault
PROBEWARD_TEST_WEB_HOSTAddress of the web server. Every web test needs itRequired
PROBEWARD_TEST_WEB_NAMEThe name its certificate carriesRequired for the page load test
PROBEWARD_TEST_WEB_PINThe SHA-256 fingerprint of that certificateRequired for the page load test
PROBEWARD_TEST_WEB_USER, _PASSWORDAn account of the identity serverRequired for the sign-in test
PROBEWARD_TEST_WEB_REALM, _CLIENTThe realm and the client of the identity serverRequired for the sign-in test
PROBEWARD_TEST_WEB_KEYCLOAK_PORTThe identity server's portOptional8080

The industrial tests are read by crates/probeward-sensors/tests/industrial_live.rs.

VariableMeaningNeededDefault
PROBEWARD_TEST_MQTT_HOST, _USER, _PASSWORDThe broker and a loginRequired
PROBEWARD_TEST_MQTT_TOPICA retained topic that holds a numberRequired
PROBEWARD_TEST_MQTT_VALUEThat numberRequired
PROBEWARD_TEST_MQTT_ROUNDTRIP_TOPICA topic the login may publish to and subscribe toOptionalThe round trip test prints a line and returns
PROBEWARD_TEST_MQTT_NAMEThe name the broker's TLS certificate carriesOptionalThe TLS test prints a line and returns
SSL_CERT_FILEThe authority's PEM file, for the trust store check of the TLS testOptionalThat check prints a line
PROBEWARD_TEST_MODBUS_HOSTA Modbus TCP deviceRequired
PROBEWARD_TEST_MODBUS_PORTIts portOptional502
PROBEWARD_TEST_OPCUA_HOSTAn OPC UA server that allows anonymous use with security NoneRequired
PROBEWARD_TEST_OPCUA_PORTIts portOptional4840
PROBEWARD_TEST_OPCUA_NODEAn extra node id to readOptionalOnly the standard i=2267

Network quality (NETEM, TRACE) ​

Read by crates/probeward-sensors/tests/live_quality.rs. The target is a machine with one address per impairment, applied to what it sends back. See the QoS sensor.

VariableMeaningNeededDefault
PROBEWARD_TEST_NETEM_CLEANAddress with no impairmentRequired by every test of the file
PROBEWARD_TEST_NETEM_DELAY50Delay of 50 msRequired by the ping, QoS tests and trace tests that use it
PROBEWARD_TEST_NETEM_DELAY100JDelay of 100 ms with a jitter setting of 20 msAs above
PROBEWARD_TEST_NETEM_LOSS55 % lossAs above
PROBEWARD_TEST_NETEM_DELAY80J_LOSS280 ms, plus or minus 10 ms, and 2 % lossAs above
PROBEWARD_TEST_NETEM_BLACKHOLEEverything droppedAs above
PROBEWARD_TEST_NETEM_OPEN_PORTA TCP port that is open on the clean address, with the four ports around it closedRequired by the port range test
PROBEWARD_TEST_NETEM_ECHO_PORTUDP port of a plain echo on each addressRequired by the QoS tests
PROBEWARD_TEST_NETEM_REFLECTOR_PORTUDP port of a Probeward reflector on each addressRequired by the QoS tests
PROBEWARD_TEST_TRACE_FARAn address a few routers awayRequired by the multi-hop traceroute test

The tests share one target, so the file runs them one at a time. Each test names the variables it lacks.

SNMP ​

The recordings of devices are read by crates/probeward-sensors/tests/snmpsim_live.rs; a Linux machine is read by crates/probeward-sensors/tests/pve_live.rs, which shares its file with the Proxmox tests.

VariableMeaningNeededDefault
PROBEWARD_TEST_SNMPSIM_HOSTAddress of an SNMP simulator that serves recordings, each under a community named after itRequired
PROBEWARD_TEST_SNMPSIM_COMMUNITIESThe recordings it serves, separated by commas or white space. A test whose recording is not listed prints that and goes onRequired
PROBEWARD_TEST_SNMPSIM_PORTIts UDP portOptional161
PROBEWARD_TEST_SNMP_HOSTA Linux machine with an SNMP agent (pve_live.rs)Required
PROBEWARD_TEST_SNMP_COMMUNITYA v2c community on itOptional, one of the two logins
PROBEWARD_TEST_SNMP_V3_USER, _V3_AUTH, _V3_PRIVA v3 user with authentication (SHA) and privacy (AES) passwordsOptional, all three

The recordings are licensed for their own use and are never copied into the repository.

Proxmox and SSH ​

Read by crates/probeward-sensors/tests/pve_live.rs.

VariableMeaningNeededDefault
PROBEWARD_TEST_PVE_HOSTAddress of a Proxmox VE hostRequired
PROBEWARD_TEST_PVE_TOKEN_ID, _TOKEN_SECRETAn API token with the audit roleRequired
PROBEWARD_TEST_PVE_NODEThe node's nameOptionalpve
PROBEWARD_TEST_PVE_USER, _PASSWORDA login used to read the truth from the host, to compare values withOptional, bothValues are not compared
PROBEWARD_TEST_PVE_NOPRIV_TOKEN_ID, _NOPRIV_TOKEN_SECRETA token with no role, for the permission message testOptional, bothThat test prints a line and returns
PROBEWARD_TEST_PVE_BACKUP_VMIDA guest with a recent backupOptionalNot checked
PROBEWARD_TEST_PVE_NO_BACKUP_VMIDA guest that has never been backed upOptionalNot checked
PROBEWARD_TEST_PVE_RECORD_PATHAn API path whose raw answer record_raw prints, for making fixturesOptionalNothing is recorded
PROBEWARD_TEST_SSH_HOST, _USERA Linux machine and an accountRequired for the SSH test
PROBEWARD_TEST_SSH_KEY_FILEA readable file with the account's private keyRequired for the SSH test

VMware and BMC ​

VMware is read by crates/probeward-sensors/tests/vmware_live.rs.

VariableMeaningNeededDefault
PROBEWARD_TEST_VSPHERE_HOSTAddress of an ESXi host or vCenterRequired
PROBEWARD_TEST_VSPHERE_USER, _PASSWORDA login that can readRequired

Redfish is read by crates/probeward-sensors/tests/bmc_live.rs. All six are required.

VariableMeaning
PROBEWARD_TEST_REDFISH_HOSTAddress of the Redfish service
PROBEWARD_TEST_REDFISH_PORTIts port
PROBEWARD_TEST_REDFISH_NAMEThe name its certificate carries
PROBEWARD_TEST_REDFISH_PINThat certificate's SHA-256 fingerprint
PROBEWARD_TEST_REDFISH_USER, _PASSWORDA login

AWS CloudWatch ​

Read by crates/probeward-sensors/tests/aws_cloudwatch_live.rs. The target is a CloudWatch-compatible endpoint such as AWS Emulator (see the sensor's page; run it with --telemetry off). The tests put their own metrics in a namespace of their own with PutMetricData, so the key needs that permission too. The wrong-secret test expects the endpoint to check signatures, as the emulator does.

VariableMeaningNeededDefault
PROBEWARD_TEST_AWS_ENDPOINTThe service's URL, with an IP address as host, for example https://192.0.2.10:9297Required
PROBEWARD_TEST_AWS_REGIONThe region to sign for, for example us-east-1Required
PROBEWARD_TEST_AWS_KEY_ID, _SECRETAn access key the endpoint acceptsRequired
PROBEWARD_TEST_AWS_PINSHA-256 fingerprint of the endpoint's certificate, when it is self-signedOptionalThe system's trust store decides

The same five variables are read by the screenshots of the sensor, where _PIN is required: the picture run seeds the metrics it shows with PutMetricData first.

Receivers (TRAP, SYSLOG) ​

Read by crates/probeward-sensors/tests/live_receivers.rs. The tests listen on the ports devices use and wait for a device to send something, so something has to make it send while they wait. They need ports 162 and 514.

VariableMeaningNeededDefault
PROBEWARD_TEST_TRAP_SOURCEThe address a device sends traps from. Turns the trap test onRequired
PROBEWARD_TEST_TRAP_OIDThe trap OID (or a prefix) at least one trap must haveOptionalAny trap
PROBEWARD_TEST_SYSLOG_SOURCEThe address a device sends syslog from. Turns the syslog test onRequired
PROBEWARD_TEST_SYSLOG_TEXTText at least one message must containOptionalAny message
PROBEWARD_TEST_RECEIVER_WAIT_SECSHow long to wait for the deviceOptional90

Flows (FLOW) ​

Read by crates/probeward-sensors/tests/live_flows.rs. The tests run the real sensors with the real collectors, which listen on UDP 2055 and 6343 (above 1023, so no privilege is needed), and poll until the device's traffic shows, so something has to make the device carry traffic while they wait: many short connections to it, or through it (a router exports a flow when it ends or has been idle, so one long ping shows only when it stops). A NetFlow v9 or IPFIX device sends its templates now and then, so the first reading can take a minute or two. Run with PROBEWARD_FLOW_INTERVAL_SECS=5.

VariableMeaningNeededDefault
PROBEWARD_TEST_FLOW_NETFLOW_SOURCEThe address a device exports NetFlow or IPFIX from. Turns the NetFlow test onRequired
PROBEWARD_TEST_FLOW_SFLOW_SOURCEThe address a device exports sFlow from. Turns the sFlow test onRequired
PROBEWARD_TEST_FLOW_SFLOW_RATEThe sampling rate that device is set to; the sensor's message must say soOptionalNot checked
PROBEWARD_TEST_FLOW_INTERFACEAn interface index the sFlow device exports; a second sensor for that interface alone must see traffic and its countersOptionalNot run
PROBEWARD_TEST_FLOW_WAIT_SECSHow long to wait for trafficOptional120

Database tests of the project itself ​

These are not lab targets. Their defaults work with just dev-up, and just ci sets them.

VariableMeaningDefaultRead by
PROBEWARD_TEST_DATABASE_URLThe PostgreSQL server every database test makes its own database on. The account must be allowed to create databasespostgres://probeward:probeward@127.0.0.1:54329/probewardcrates/probeward-store/src/testkit.rs, crates/probeward-sensors/tests/db_live.rs, the examples chart_bench and capacity
PROBEWARD_TEST_PG_CONTAINERThe container the backup tests run pg_dump inprobeward-dev-postgres-1crates/probeward-store/tests/db/backup.rs
PROBEWARD_TEST_PG_USERThe user for those toolsprobewardthe same

Local daemons ​

The tests in crates/probeward-sensors/tests/live.rs, live_more.rs and crates/probeward-server/tests/live/main.rs start real programs (snmpd, sshd, dnsmasq and others) on this machine, and need no lab.

VariableMeaningDefault
PROBEWARD_SKIP_DAEMON_TESTS1 skips a test whose program is not installed, and says so. Otherwise it fails and says what to installOff
PROBEWARD_TEST_PLUGIN_DIRA directory of monitoring plugins for the plugin testsThe usual system folders, then a copy extracted from a container
PROBEWARD_TEST_HIDE_BINARYA program name the tests pretend is missing, to check what a machine without it seesUnset

Names hidden in screenshots ​

The Playwright run that makes the screenshots of the sensors reads the same variables as the live tests, plus some of its own, and does not write their values anywhere. A _HIDE variable is a comma-separated list of names that the run replaces in every picture with a neutral one. A case whose variables are not set is skipped, and the run says which. The list is the lab's host names, domains and account names, so keep it with the other variables.

VariableHides
PROBEWARD_TEST_WINRM_HIDENames of the Windows machine, such as its host name and domain
PROBEWARD_TEST_VSPHERE_HIDEThe ESXi host's and the machines' names. An entry is name or name=shown instead
PROBEWARD_TEST_PGQ_HIDE, _MYSQL_HIDE, _MSSQL_HIDENames of a database server (only the SQL Server one is masked, and the address becomes 192.0.2.10)
PROBEWARD_TEST_NETSVC_HIDENames of the protocol services machine: host, domain, organisation
PROBEWARD_TEST_NETSVC_ACCOUNTSThe accounts of that machine
PROBEWARD_TEST_IOT_HIDENames of the MQTT, Modbus and OPC UA machine
PROBEWARD_TEST_WEB_HIDENames of the web server and its identity server

The pictures also read these variables that no live test does:

VariableMeaning
PROBEWARD_TEST_NETSVC_HOST, _NETSVC_PASSWORDThe protocol services machine's address, and the one password every account has. The live tests give the same machine as _LDAP_HOST, _RADIUS_HOST and so on
PROBEWARD_TEST_VSPHERE_VMA powered-on machine, for the vmware_vm picture
PROBEWARD_TEST_VSPHERE_DATASTOREThe datastore to photograph, default datastore1

Tests that need privileges ​

Three tests need a port below 1024 that an ordinary user may not bind:

TestPortVariables
dhcp_discover_gets_an_offer_and_never_requests_it in live_protocols.rsUDP 68PROBEWARD_TEST_DHCP_VENDOR
a_real_device_s_traps_are_read in live_receivers.rsUDP 162PROBEWARD_TEST_TRAP_SOURCE
a_real_device_s_syslog_is_read in live_receivers.rsUDP 514PROBEWARD_TEST_SYSLOG_SOURCE

Run as an ordinary user they print that the port needs a privilege and return. To run them, build the test binary as yourself and run the binary in a container on the host network, where the container's root may bind the ports:

sh
cargo test -p probeward-sensors --test live_protocols --no-run   # prints the path of the test binary
BIN=target/debug/deps/live_protocols-0123456789abcdef            # use the path it printed
docker run --rm --network host -v "$PWD/$BIN:/t/live_protocols:ro" \
  -e PROBEWARD_TEST_DHCP_VENDOR -e PROBEWARD_TEST_DHCP_INTERFACE -e PROBEWARD_TEST_DHCP_SERVER \
  debian:stable-slim /t/live_protocols dhcp --nocapture

For the receivers, name live_receivers instead, pass PROBEWARD_TEST_TRAP_SOURCE, _TRAP_OID, _SYSLOG_SOURCE, _SYSLOG_TEXT and _RECEIVER_WAIT_SECS with -e, and make the device send while the test waits. The host's firewall must let the device's packets in on the port. PROBEWARD_TRAP_LISTEN and PROBEWARD_SYSLOG_LISTEN move the listeners to other ports, which a device that cannot be told another port does not help.

The container only runs the binary, so the machine needs no Rust toolchain in it, and the binary has to be one that runs on the container's C library: build it on a machine with an equal or older glibc than the image, or use an image of the same distribution as the one you build on.

AGPL-3.0-only