Skip to content

FTP and FTPS server (ftp) ​

Connects to an FTP server, optionally protected with explicit FTPS (AUTH TLS) or implicit FTPS, signs in, and measures how long that takes. It can also look at one file (does it exist, how big, how old) or one folder (how many files, how big, how old is the newest), which is the "did the upload arrive" check. It reads only: it never uploads, deletes or renames.

What it looks like ​

The page of a ftp sensor in the light theme

The page of an FTP sensor after a few polls, using explicit FTPS and counting the files of a folder on a lab server. In the dark theme: the sensor's page. The form for adding it, with its parameters filled in: light, dark.

Channels ​

KeyNameUnitDefault limits
connect_msConnect timemswarning above 1000, error above 3000
login_msTime until signed in (connecting, TLS and the login)mswarning above 3000, error above 8000
response_msResponse time (signing in and looking at the item)mswarning above 5000, error above 15000
existsExists (with item)error below 1 (0 is Missing, 1 is Present)
age_sAge (the file, or the newest file in a folder)swarning above 26 hours (93600), error above 48 hours (172800)
size_bytesSize (the file, or all counted files in a folder)Bnone
file_countFiles (folders only)error below 1
cert_days_remainingDays until the certificate expires (with TLS)dayswarning below 21, error below 7
chain_days_remainingDays until the earliest expiry in the chain (with TLS)dayswarning below 21, error below 7

A missing file or folder is not a failed poll: it is a reading. exists is 0 and the age and size are unknown, so the default limit turns the sensor Down and the message says what was missing. A folder with no file in it, or none that matches the filter, gives file_count 0. That is the case of a backup that did not run. Only the files directly in a folder are counted, not those in its sub-folders. The age is measured from the last change time the server reports to the probe's clock, so a probe whose clock is wrong makes every age wrong; keep it on NTP. A file stamped in the future is as new as can be (age 0). The default limits suit a daily backup; change them on the sensor for anything else, as described for win_file.

The certificate is read from the connection the sensor itself made, also when it is untrusted and the sensor runs with verify_tls off or a pin; an expired certificate that is accepted that way makes the sensor Down, as for the HTTP sensors.

Parameters ​

ParameterDefaultMeaning
port21, or 990 with security tlsTCP port.
securitynonenone, starttls (explicit FTPS: AUTH TLS, then PBSZ and PROT P so that the data connection is protected as well) or tls (implicit FTPS).
passivetrueThe server opens the data connection, the usual way through firewalls. Off for active mode, where the server connects back to the probe.
anonymousfalseSign in as anonymous instead of with the login credential.
allow_plaintext_loginfalseAllow a login without starttls or tls, which sends the password in the clear.
itemnonefile or folder. Without item and path the sensor only signs in.
pathnoneThe file or folder, relative to where the login starts (the root of a chrooted account) or absolute. Needed with item.
filternoneFolders only. Count only the files whose name matches: * is any run of characters and ? is one, case ignored (*.bak). It is matched against the file name.
verify_tls, tls_fingerprint, server_name, check_certificateas for SMTPThe certificate rules.

Suggested interval: 300 seconds. Credential: an optional login credential; it is required unless anonymous is on.

Passive data connections go to the address the control connection is talking to, not to the address the server names in its reply, so a server behind address translation that names its inner address still works.

On the target ​

An account that can list and read the folder. Folders are listed with MLSD where the server has it, and with LIST otherwise (vsftpd, for one, has no MLSD); the age of the newest few files from a LIST is then read exactly with MDTM, since a listing only shows the minute. A single file is read with SIZE and MDTM. Times are taken as UTC.

Servers that require the data connection to resume the TLS session of the control connection (vsftpd's require_ssl_reuse, on by default) are served as far as the TLS library allows session resumption; if a folder listing fails there with a data connection error, set require_ssl_reuse=NO on the server.

Failures ​

MessageMeaning
a refused connection (kind unreachable), a timeout (kind timeout)The service is not listening, a firewall drops the traffic, or a data connection could not be made (for passive mode, check the server's passive port range).
the server rejected the login: ... (kind auth_failed)The user name or password is wrong, or anonymous access is not allowed.
TLS error: ... (kind protocol)The certificate is refused, or the port does not speak TLS (implicit FTPS on an explicit port, or the reverse); the message says which.
<path> is a folder; set item to folder ... (kind config)item is file and the path is a folder.

Testing ​

The live tests in crates/probeward-sensors/tests/mail_ftp_live.rs need PROBEWARD_TEST_FTP_HOST, PROBEWARD_TEST_FTP_NAME (the name the certificate carries), PROBEWARD_TEST_FTP_USER, PROBEWARD_TEST_FTP_PASSWORD, PROBEWARD_TEST_FTP_CA_FILE (PEM) and PROBEWARD_TEST_FTP_FOLDER (a folder of the account holding file-0d.txt, file-1d.txt, file-7d.txt and file-30d.txt, 0, 1, 7 and 30 days old), and skip cleanly without them. The client against a small server on the loopback interface (MLSD, LIST with MDTM, missing files and folders, login failures) is in tests/ftp_proto.rs.

AGPL-3.0-only