diff --git a/CHANGELOG.md b/CHANGELOG.md index 1172f4b..6eaa211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [6.0.3] - 2026-11-11 + +### Fixed + +- Logins failed with `500 OOPS: setgid` in some user namespaces (e.g. Podman with `UserNS=auto`), because 6.0.2 + ran vsftpd's unprivileged process as `nobody` (uid and gid 65534), which they don't map. It now runs as a + dedicated `vsftpd` user with low ids, which still can't reach your files. That name is now reserved: the + container won't start if `BF_FTPS_VSFTPD_USER` is `vsftpd`. + ## [6.0.2] - 2026-11-10 ### Changed @@ -39,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Images are built and published by the shared `bfren/docker` build workflow (`build.yml`), replacing the separate `dev.yml` and `publish.yml` workflows. +[6.0.3]: https://github.com/bfren/docker-ftps/compare/v6.0.2...v6.0.3 [6.0.2]: https://github.com/bfren/docker-ftps/compare/v6.0.1...v6.0.2 [6.0.1]: https://github.com/bfren/docker-ftps/compare/v6.0.0...v6.0.1 [6.0.0]: https://github.com/bfren/docker-ftps/compare/v5.2.5...v6.0.0 diff --git a/README.md b/README.md index 98c0726..7de528c 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,10 @@ Images are published to Docker Hub (`bfren/ftps`) and Quay.io (`quay.io/bfren/ft | `latest` | | You always want the newest image | | `MAJOR` | `6` | You want updates, but not breaking changes | | `MINOR` | `6.0` | You want fixes only - **recommended** | -| `VERSION` | `6.0.2` | You want to pin this image exactly | +| `VERSION` | `6.0.3` | You want to pin this image exactly | | `vsftpdX`, `vsftpdX.Y` | `vsftpd3.0` | You want a vsftpd version | | `vsftpdX.Y.Z` | `vsftpd3.0.5` | You want an exact vsftpd release | -| `vsftpdX.Y.Z-VERSION` | `vsftpd3.0.5-6.0.2` | You want to pin both | +| `vsftpdX.Y.Z-VERSION` | `vsftpd3.0.5-6.0.3` | You want to pin both | ## Configuration @@ -87,7 +87,7 @@ Publish the whole passive range, with the same numbers on the host and in the co | Variable | Values | Description | Default | | ---------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- | -| `BF_FTPS_VSFTPD_USER` | string | **Required.** The user name to log in with. | | +| `BF_FTPS_VSFTPD_USER` | string | **Required.** The user name to log in with (not `vsftpd`, which is reserved). | | | `BF_FTPS_VSFTPD_PASS` | string | **Required.** The user's password. | | | `BF_FTPS_EXTERNAL_URI` | host name | The address clients use - told to clients for passive connections. Takes priority over `BF_FTPS_EXTERNAL_IP`. | | | `BF_FTPS_EXTERNAL_IP` | IP address | The address clients use, if you don't have a host name. One of the two is required. | | diff --git a/VERSION b/VERSION index 7a9f89d..39c5d6a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.2 \ No newline at end of file +6.0.3 \ No newline at end of file diff --git a/overlay/etc/bf/templates/vsftpd.conf.esh b/overlay/etc/bf/templates/vsftpd.conf.esh index 77b9bd2..de1ed33 100644 --- a/overlay/etc/bf/templates/vsftpd.conf.esh +++ b/overlay/etc/bf/templates/vsftpd.conf.esh @@ -56,6 +56,9 @@ dirmessage_enable=YES # You may change the default value for timing out a data connection. #data_connection_timeout=120 # +# The unprivileged user vsftpd runs as before login - created by the image, it does not own /files. +nopriv_user=vsftpd +# # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. diff --git a/overlay/etc/nu/scripts/bf-ftps/checks.nu b/overlay/etc/nu/scripts/bf-ftps/checks.nu index f048305..74c52ab 100644 --- a/overlay/etc/nu/scripts/bf-ftps/checks.nu +++ b/overlay/etc/nu/scripts/bf-ftps/checks.nu @@ -6,6 +6,7 @@ export def environment []: nothing -> list { [ [((bf env --safe FTPS_VSFTPD_USER) == "") "BF_FTPS_VSFTPD_USER must be set."] [((bf env --safe FTPS_VSFTPD_PASS) == "") "BF_FTPS_VSFTPD_PASS must be set."] + [((bf env --safe FTPS_VSFTPD_USER) == "vsftpd") "BF_FTPS_VSFTPD_USER cannot be 'vsftpd' - that user name is reserved."] [$no_address "You must provide either BF_FTPS_EXTERNAL_URI or BF_FTPS_EXTERNAL_IP."] ] | where {|x| $x.0 } | each {|x| $x.1 } } diff --git a/overlay/etc/nu/scripts/tests/checks.nu b/overlay/etc/nu/scripts/tests/checks.nu index b625963..da9b1de 100644 --- a/overlay/etc/nu/scripts/tests/checks.nu +++ b/overlay/etc/nu/scripts/tests/checks.nu @@ -27,6 +27,13 @@ export def environment__reports_missing_user_and_password [] { assert equal ["BF_FTPS_VSFTPD_USER must be set." "BF_FTPS_VSFTPD_PASS must be set."] $result } +export def environment__rejects_reserved_user [] { + let result = with-env (valid | update BF_FTPS_VSFTPD_USER "vsftpd") { bf-ftps checks environment } + + assert equal 1 ($result | length) + assert ($result.0 =~ "reserved") +} + export def environment__reports_missing_address [] { let result = with-env (valid | reject BF_FTPS_EXTERNAL_IP) { bf-ftps checks environment } diff --git a/overlay/etc/nu/scripts/tests/conf.nu b/overlay/etc/nu/scripts/tests/conf.nu index bbc1d5d..085f1f5 100644 --- a/overlay/etc/nu/scripts/tests/conf.nu +++ b/overlay/etc/nu/scripts/tests/conf.nu @@ -47,6 +47,13 @@ export def vsftpd__keeps_users_in_files_directory [] { assert ("local_root=/files" in $conf) } +export def vsftpd__uses_own_unprivileged_user [] { + let conf = render vsftpd.conf + + assert ("nopriv_user=vsftpd" in $conf) + assert not ("nopriv_user=fred" in $conf) +} + export def vsftpd__uses_ip_for_passive_mode [] { let conf = render vsftpd.conf diff --git a/overlay/etc/nu/scripts/tests/image.nu b/overlay/etc/nu/scripts/tests/image.nu index 0d7f345..ef13229 100644 --- a/overlay/etc/nu/scripts/tests/image.nu +++ b/overlay/etc/nu/scripts/tests/image.nu @@ -24,6 +24,15 @@ export def install__ssl_directory_is_linked [] { assert equal "/ssl" (^readlink /etc/ssl/private | str trim) } +export def install__vsftpd_user_has_low_ids [] { + let user = open /etc/passwd | lines | split column ":" name x uid gid | where name == "vsftpd" + + assert equal 1 ($user | length) "the vsftpd user should exist" + # user namespaces such as Podman's UserNS=auto may map only the first 1024 ids + assert (($user.0.uid | into int) < 1000) "the vsftpd uid should be below 1000" + assert (($user.0.gid | into int) < 1000) "the vsftpd gid should be below 1000" +} + #====================================================================================================================== # scripts diff --git a/overlay/tmp/install b/overlay/tmp/install index 7d38d9a..f4ed29b 100644 --- a/overlay/tmp/install +++ b/overlay/tmp/install @@ -17,6 +17,12 @@ def main [] { bf write "Installing additional packages." bf pkg install [lftp openssl] + # vsftpd's unprivileged process runs as this user - it must not own /files, and its uid and gid must be low, + # because some user namespaces (e.g. Podman's UserNS=auto) don't map 'nobody' (65534) + bf write "Adding vsftpd user." + { ^addgroup -S vsftpd } | bf handle + { ^adduser -S -D -H -h /var/empty -s /sbin/nologin -G vsftpd vsftpd } | bf handle + # add bf-ftps module to config bf config use_mod bf-ftps