Skip to content

uFTP 4.4.0 release notes

Changes since 4.3.0.

New

  • Users from your own program (AUTH_HOOK): database, LDAP, a web API or a file, without restarting uFTP and without libraries in the server. It is the last step of a login, only for names that nobody else knows; a hook that does not answer never lets anybody in. It can give a user every setting of the configuration file. Ready examples in contrib/auth-hooks/.
  • Run scripts (SITE RUN, SITE STATUS; the output files are never overwritten, and the reply comes when they are made): a user with the new permission run starts, in the background, a script that you listed (SITE_COMMAND_<name>), with one checked parameter, a time limit and a size limit. For backups and database dumps. Scripts and recipes (lftp, curl, rclone) in contrib/site-commands/ and on the site.
  • Stronger password hashes: PBKDF2-SHA256 with 600,000 iterations by default, the value recommended for this algorithm. The check runs in a thread, so the other clients are not kept waiting; the hashes of before keep the count they have.
  • Checksums without downloading: HASH (and OPTS HASH), XCRC, XMD5, XSHA1, XSHA256, and MFMT to keep the date of a file (HASH_MAX_SIZE_MB).
  • Permissions for each user (PERMISSIONS_n, READ_ONLY_n): list, download, upload, overwrite, delete, rename, mkdir, chmod and run.
  • Speed limits for each user, shared by all of his connections (MAX_DOWNLOAD_SPEED, MAX_UPLOAD_SPEED and the _n of each user).
  • Users in a file of their own (USERS_FILE) and ./uFTP --split-users to make it from the users you already have.
  • Users whose numbers have gaps (USER_0, USER_2, USER_10 are three users, read in increasing order). Every USER_n needs PASSWORD_n and HOME_n, and an option of a number that has no USER_n stops the server instead of being ignored.
  • uftpctl adduser and uftpctl passwd: an FTP user is added, or a password changed, without editing the file. The password is asked on the terminal, saved as a PBKDF2 hash (the iteration count is chosen with --iterations), and the file keeps its mode and owner, with a copy of before (.bak). adduser writes to USERS_FILE when there is one.
  • Logs where the system looks: syslog, stderr and a transfer log in the standard xferlog format (SYSLOG_ENABLED, LOG_TO_STDERR, XFERLOG_FILE).
  • A private key with a password (TLS_KEY_PASSWORD_FILE): the password is read from a file, once at start. Without it a protected key stops the server with a clear message: it never asks the terminal.
  • TLS options: minimum version, ciphers, and the reuse of the TLS session on the data connection (TLS_*). PAM service of your choice (PAM_SERVICE_NAME).
  • Without root: a hardened systemd unit (contrib/systemd/) and a Docker image that does not run as root (contrib/docker/), with guides on the site.
  • A new certificate and new users without a restart: SIGHUP (systemctl reload, uftpctl reload) reads the TLS certificate and its key again, and the users of the configuration file and of USERS_FILE. A new user can log in, a removed one can not, a new password and new permissions work; the open connections go on with the settings they had. If the new certificate or the users file is not valid, the ones in use stay. A hook for certbot in contrib/certbot/.
  • Health and metrics (HEALTH_PORT, off): /livez, /readyz and /metrics for Prometheus, without names of users or files.
  • uftpctl (CONTROL_SOCKET, off): who is connected, close a connection, read the certificate again. uFTP --check: what the server would find at start.
  • Networks for each user (ALLOW_FROM_n, DENY_FROM_n) and permissions of new files (UMASK, UMASK_n).
  • Manual pages and packages: .deb for Debian/Ubuntu amd64, arm64 and armhf (Raspberry Pi OS; armhf needs ARMv7), and .rpm for Rocky Linux/EL 9 and 10 on x86_64 and aarch64. Signed APT and DNF repositories for the same systems. The uftpserver packages include TLS and PAM, with PAM off by default. The package configuration blocks FTP login as root.
  • Orderly stop (SHUTDOWN_GRACE_SECONDS): SIGTERM lets the transfers in progress end.
  • Continuous integration on GitHub (.github/workflows/ci.yml): five builds, the tests, the sanitizers and a minute of fuzzing.

Improvements

  • Much less memory when idle: a slot that is not used takes about 1 KB. 10,000 slots took 385 MB before the first client, now about 20 MB.
  • A slow command does not stop the others: checksums, STAT of a path and the PAM check run in a thread of their own.
  • File permissions: the group of a file now gives the group bits only (it used to give full access); a chown that fails is written in the log.
  • Fatal errors at start also go to standard error (journalctl, docker logs show why the server stopped).
  • A silent server for devices with no place to write: with MAXIMUM_LOG_FILES = 0 (and no syslog, LOG_TO_STDERR or xferlog) uFTP now writes nothing in normal operation, not even the start-up banner or a line on standard error. Only a [FATAL] line and a crash report say why it stopped. (Before, the start-up lines and a few perror calls still went to standard output and standard error.)

Fixes

  • Crash: USER during a transfer could use freed memory (with a speed limit or a transfer log).
  • The server stopped: LIST or NLST with options, sent while its TLS data connection was being closed, could end the whole server (only logged-in users; a very short window).
  • Lost descriptors: PASV or EPSV followed at once by ABOR or another data command lost a descriptor each time, until nobody could connect; an upload stopped while its file was being opened could lose one, and one stopped while its file was being closed could end the server (only logged-in users).
  • The server no longer waits for one client: STAT over TLS, a slow authentication hook, the lack of free descriptors, a transfer on a disk that does not answer and the check of a hashed password could stop all of them. Too many checks of passwords at the same time are answered 421; too many HASH, X checksums and STAT of a path are answered 450 (try again).
  • File permissions: HASH and the X checksums need to read the file and MFMT to write it; with HOME_n = / the check of the root directory was skipped; RMD can not remove the home.
  • TLS data connections: PROT C sent during a transfer no longer makes the rest of it go in clear text: PROT is for the next data connection. A transfer on a connection that was opened with the other protection is answered 425.
  • A listing cancelled by the client (the data connection closed during LIST, NLST or MLSD) is answered 426 and the session goes on: it was closed.
  • Large files on 32 bit systems: a file over 2 GB was not seen, and an upload that went on after 4 GB could write in the wrong place of the file.
  • Interrupted transfers (ABOR, a new PASV, a connection that is lost) leave a line in the logs.
  • RNTO must come right after RNFR (only NOOP and STAT in between): after another command it is 503.
  • After a restart by the supervisor, a SIGTERM sent to the server was passed on to a process that was not its own.
  • A full server sends away the connection without login that came first: of the ones that came in the same second it could send away the newest.
  • Limits by address: a connection that is refused no longer pushes out another client when the server is full; two addresses no longer reset each other's count of MAX_CONNECTION_RATE_PER_IP; the failed logins no longer grow without end (4,096 addresses for each table).
  • PAM with AUTH_HOOK: a user refused by PAM and accepted by the hook was answered 530.
  • Logs: lines of different threads and processes do not mix; when the log can not be written (a full disk) the server says it once on standard error, and how many lines are missing when it works again.
  • TLS: with TLS_REQUIRE_SESSION_REUSE only a session of the same control connection is accepted; an upload that ends with a TLS error answers 426, not 226.
  • Configuration: the last line counts also without an end of line (a READ_ONLY_n = "true" there was lost); a readonly= of the hook that is not valid refuses the login.
  • The rest of a command line that is too long is not a command; a refused command does not change the REST of the transfer in progress; a read error of a download is not 226; the checksum cache, the days of the log files and the dates under load are right.
  • --version and --help; an unknown option of the command line is reported.
  • An interrupted upload belongs to its owner. Relative paths work in daemon mode. The log says, at start, which options are not known or repeated, and which files others can change.

Upgrading

  • SIGTERM and SIGINT now wait for the transfers in progress, up to 30 seconds (SHUTDOWN_GRACE_SECONDS); a second signal, or SHUTDOWN_GRACE_SECONDS = 0, stops at once as before. Make systemctl stop and docker stop wait at least that long (the shipped unit and Compose file do).
  • The memory of a slot is no longer reserved at start: MAXIMUM_ALLOWED_FTP_CONNECTION is only the limit of connections.
  • With an owner configured for a user (USER_NAME_OWNER_n), a file whose group is the user's group now gives the group permission bits, not full access.
  • HASH, XCRC, XMD5, XSHA1, XSHA256 and MFMT are on by default (HASH_MAX_SIZE_MB = 256; 0 turns the checksums off). They need the permissions download and overwrite.
  • FTPS data connections must resume their control connection's TLS session by default (TLS_REQUIRE_SESSION_REUSE = true). Set it to false for clients that do not support session reuse.
  • run is not part of all: SITE RUN is for the users that you name (PERMISSIONS_n = all,run).
  • The users of a file are no longer read until the first missing number: USER_0, USER_2 and USER_10 are all loaded. Every USER_n now needs PASSWORD_n and HOME_n, and an option of a number with no USER_n (a PERMISSIONS_5 with no USER_5) stops the server: it used to be ignored in silence. Check every file with uFTP --check before the restart.
  • USER on a connection that is already logged in stops a transfer in progress (426, then 331; an interrupted upload stays partial), closes a waiting PASV and drops a pending REST or RNFR. PASS without a new USER is refused with 503. This fixes a use-after-free that could stop the server, and an RNFR of one user completed by another.
  • New password hashes (--hash-password, uftpctl adduser and passwd) use 600,000 iterations by default. The hashes already in the file keep their count and keep working.
  • SIGHUP now reads the users too (the configuration file and USERS_FILE), not only the certificate: a new user or a new password needs no restart. A file that is not valid leaves the users in use. Nothing else of the configuration is read (ports, folders, the server limits, BLOCK_USER_n): a restart is needed for those.
  • With an owner configured, DELE, RMD, RNFR and RNTO also need to write the directory, like on the system: who deleted files in a directory that it can not write now gets 550.
  • The group root (0) is a group like the others: a user with another owner and the group root gets the group bits, not full access.
  • A hook that answers a readonly= different from 1, true, 0 and false (it used to give full access) is refused.
  • A last line of uftpd.cfg without an end of line, that was lost or cut, now counts: look at it before the restart.
  • An option that must be a number and is not (LOGIN_TIMEOUT = abc) stops the server at start: it was 0, which turns many limits off. A comment after the number is fine. So does a read error of the configuration file, which was taken as an empty file.
  • SIGHUP does not end a server in the foreground any more (closing its terminal neither): use Ctrl-C or SIGTERM.
  • A C11 compiler is needed (GCC 4.9 or later, or clang).
  • Building without the Makefile: the sources now include library/addressTable.c, networkList.c, health.c, control.c, doctor.c and library/ckeep/src/*.c (with -Ilibrary/ckeep/include), a copy of a part of our library ckeep.
  • PASS when the connection is logged in already is 503. The backup and the users file of --split-users are 0640 at most. A link in the place of the log file of the day is not followed (uftpLog.current is not touched).
  • Other optional features remain off or unset: AUTH_HOOK, SITE_COMMAND_<name>, USERS_FILE, speed limits, syslog, XFERLOG_FILE, TLS_KEY_PASSWORD_FILE, and custom TLS cipher lists. TLS 1.2 is the minimum by default; TLS session reuse is required by default.

Known limits

TYPE A does not convert line ends, STRU P is not implemented, and implicit FTPS (port 990) is not supported. A hook and a SITE RUN script run with the privileges of uFTP: run uFTP without root. SITE RUN jobs do not survive a restart. Tried before this release: the Docker image and the Compose file (built and run with the example folders, users and limits, docker stop with a transfer in progress), the system-call filters of the systemd unit, the packages on Debian 12/13, Ubuntu 22.04/24.04 and Rocky Linux 9/10 (amd64, arm64, armhf, x86_64, aarch64; the ARM packages in emulated containers), and the signed APT and DNF repositories (apt install in Debian 12 amd64/arm64 and Ubuntu 24.04, dnf install in Rocky 9 x86_64), and the FileZilla client. Not tried against the real thing: the examples for MySQL, PostgreSQL, LDAP and a web API, the rclone recipe, the GitHub workflow, the parts of the systemd unit that need a system service (User=, ProtectSystem), PAM with real users outside a container, certbot, a real Prometheus, and the full test suite on ARM.