Skip to content

WebSSH v3.5.2

Latest

Choose a tag to compare

@github-actions github-actions released this 03 Dec 21:49
Immutable release. Only release title and notes can be modified.
0ee5f69

WebSSH 3.5.2 adds directories of the WebSSH server as file sources, raises
the default transfer limits to 5 GiB, says why an upload failed instead of
reporting a generic error, admits SSH targets named in /etc/hosts under
BLOCK_INTERNAL_SSH, and documents how to put an AppArmor or SELinux
profile on top of the native service.

These notes compare with 3.5.0. 3.5.1, released in between, is a
maintenance release that changes none of this; where they say "before",
that includes 3.5.1. Its own changes are in
the 3.5.1 notes.

Local directories as file sources

An administrator can share directories of the WebSSH server itself as file
sources: a Docker bind mount, a folder of the Unraid array, a directory of
an LXC or Incus container, or a network share mounted on the host. They
appear in the file workspace as Local: for the accounts and roles
they are shared with and support everything the SFTP sources do: listing,
search and filter, preview, download, folder download as ZIP, the editor,
uploads with the conflict question, new files and folders, rename and move,
delete, Unix permissions and copies to and from every other source.

  • Off by default. Nothing changes until LOCAL_SOURCES_FILE names a
    JSON file with the directories. Each source is read-only unless the file
    says "mode": "read-write"; a read-only source refuses every change on
    the server.
  • Shared on the server. A source is offered only to the listed accounts
    (alice, ldap:alice, github:alice) and roles (admin, user), checked
    each time it is opened. user means every account, including ones created
    by registration or provisioned at sign-in; with registration open the
    start logs a warning for such a source. A listed local name can no longer be registered by
    a visitor, and an account GitHub created under that name cannot become
    the local account by unlinking GitHub. An account that loses
    administrator rights loses a source shared with admin at once. All
    shared accounts act as the WebSSH process: this is not per-user
    separation.
  • Confined. Paths never leave the directory, links are never followed at
    the last element, FIFOs and devices are never opened, and a directory that
    is, contains or lies in DATA_DIR, BACKUP_TEMP_DIR or a system directory
    is refused, compared by device and inode so bind mounts of DATA_DIR
    are found too.
    When DATA_DIR is mounted somewhere below a source, the source opens but
    DATA_DIR cannot be entered, changed or deleted through it. Share single
    folders rather than a whole array such as /mnt/user on Unraid, which
    contains appdata: the same files reached through another file system
    (/mnt/cache) cannot be recognised.
  • Marker file hidden. The marker is not listed and not part of folder
    downloads.
  • Missing mounts. A marker file (.webssh-source) must exist in the
    root of the directory; an empty mount point is refused instead of being
    written to. Every change, and every upload once more before it takes its
    name, checks that the configured path still leads to the open directory:
    an upload into a share that was unmounted or mounted over in the
    meantime fails instead of reporting success for a file nobody can see.
  • Read-only mounts. A read-write source on a file system mounted
    read-only is marked as such in the administration view.
  • Hanging network shares cannot exhaust the process: calls per source are
    bounded and time out.
  • Administration → Integrations shows each source and its state.
    Opening and refusals are audited (LOCAL_SOURCE_OPENED,
    LOCAL_SOURCE_REFUSED), changes as FILE_SOURCE_OPERATION with
    source_kind=local.
  • The native systemd unit needs a drop-in with ReadOnlyPaths= or
    ReadWritePaths= for each directory.

The files of a local source and the configuration file are not part of a
WebSSH backup. 3.5.0 and 3.5.1 ignore LOCAL_SOURCES_FILE, so the way
back is unchanged, but see the note on reserved names under Upgrade. Setup for Docker, Unraid and the native service:
Local Directories.

New dependency: golang.org/x/sys is now imported directly (it was already
part of the build) for renameat2 and the *at system calls.

Transfer limits default to 5 GiB

This changes a default. Installations that do not set the variables get
the new values:

Setting Before 3.5.2
MAX_UPLOAD_SIZE 100 MiB 5 GiB (5368709120)
MAX_DOWNLOAD_SIZE 100 MiB 5 GiB
MAX_ZIP_DOWNLOAD_SIZE (folder archives and host-to-host copies) 500 MiB 5 GiB
QUOTA_TEMP_BYTES_PER_USER (caps a folder archive) 512 MiB 5 GiB
QUOTA_TEMP_BYTES_GLOBAL 1 GiB 10 GiB

Explicit values keep working unchanged. The values stay plain numbers of
bytes; units such as 5G are refused, as before. Uploads, downloads,
archives and copies stream, so memory use does not grow with the limit.

A reverse proxy in front of WebSSH has its own limit for request bodies and
refuses larger uploads before WebSSH sees them: nginx allows 1 MiB unless
client_max_body_size is set, and Cloudflare allows 100 MB on its Free and
Pro plans. Raise the proxy limit to the new default, or set
MAX_UPLOAD_SIZE=104857600 to keep the earlier one. Traefik 3 allows 60
seconds for reading a whole request; uploads that take longer, such as
5 GiB over a link slower than about 700 Mbit/s, need its
respondingTimeouts.readTimeout raised. The examples in
Reverse Proxy and Subfolder Deployment
now allow 5 GiB.

MAX_UPLOAD_SIZE is now listed where operators look for it: the homelab
docker-compose.yml and the Unraid template carry it (an advanced setting
of the template; existing templates need the variable added by hand),
docker-compose.production.yml and deploy/systemd/webssh.env.example name
it, and .env.example uses the new defaults. The start-up log names the
limits in effect in one line, msg="transfer limits".

Measured with the release build against OpenSSH: a 5 GiB upload took 23
seconds directly and 54 seconds through Caddy with the browser limited to
1 Gbit/s, and 8 minutes through Caddy at 100 Mbit/s; the file arrived
intact each time and the memory of WebSSH stayed below 71 MiB. There is no
overall time limit for an upload, only two minutes without data.

Why an upload failed

Most refused uploads used to end in "The transfer could not be completed."
The transfer queue now names the cause, and "What can I do?" below the
entry gives the next step; for administrators it also names the setting.

  • A proxy in front of WebSSH that refuses the size (HTTP 413), answers
    502, 503 or 504, or ends the connection, for example after its time
    limit, is named as such.
  • The destination is read-only, full or over quota. OpenSSH reports all
    three with the same status; WebSSH asks the server once about the
    destination folder (statvfs@openssh.com) and says which it is. SMB
    shares report the same for write-protected media, a full disk and an
    exceeded quota.
  • Too many transfers at once (QUOTA_TRANSFER_PER_USER) is named, also
    for host-to-host copies.
  • An upload without a Content-Length is answered with 411 instead of
    being reported as over the limit.
  • A failure over a limit adds that an administrator can raise it.
  • The summary that appears after an upload names the cause of the first
    failed file, so it is seen without opening the transfer queue.

The reason is a fixed value beside the unchanged error code (reason);
no text of a server reaches the browser. Texts are translated into all six
languages. Health Checks and Troubleshooting
has a table of every upload failure, its cause and how to check it.

SSH targets from /etc/hosts

With BLOCK_INTERNAL_SSH=true, a host name from /etc/hosts (or a Docker
extra_hosts entry) was refused with target_blocked while its address,
allowed through SSH_ALLOWED_INTERNAL_NETWORKS, connected. The resolver
answers such names with the IPv4-mapped form of the address, which the
policy never admits. Answers are now decided on the IPv4 address they
connect to. A mapped address typed as the target stays refused, and no
address becomes reachable that was not before. Tailscale SSH had the same
problem with names from /etc/hosts and is fixed as well.

AppArmor or SELinux on top of the native service

Install in LXC, Incus or Proxmox
describes how to add a profile to the systemd unit: the drop-in
AppArmorProfile=webssh, which makes the service refuse to start when the
profile is not loaded, the accesses WebSSH needs, the container specifics
and an example profile, checked with this release natively and in an
unprivileged Incus container, including local directory sources. WebSSH
does not ship a profile file.

Moving a 3.0 to 3.3 source installation

Installation from Source
describes the move from a source installation under Gunicorn to the
native binary and its unit, tested from 3.0.0 to 3.5.0: keep the old unit and
environment file, carry SECRET_KEY over before the first start, where the
data may stay, and the way back.

Two start-up messages help with it. When SECRET_KEY is set and
DATA_DIR/secret_key holds another secret, the start warns: the file would
take over as soon as the variable is removed. When DATA_DIR is on a
read-only file system, as under the unit's sandbox outside
/var/lib/webssh, the error names ReadWritePaths= instead of suggesting
chown; for other permission errors it adds that every directory above
DATA_DIR must be searchable.

Fixes

  • A first start that was stopped while the database was being created,
    for example by a restart right after systemctl enable --now, left an
    empty go/webssh.db; every later start then refused the data directory
    with go_database_unusable. An empty database file now counts as none,
    and the start completes the installation or the migration.
  • The audit record of a transfer whose source ended during the transfer
    (a lost mount or SSH connection) named the source as SFTP without a
    host; it now keeps the target seen when the transfer was prepared.
  • An SMB share connected with a saved password failed with "Invalid
    password." (invalid_request) since 3.4, both for a saved SMB source
    and for a typed share using a saved password. The connection was
    refused before the password was read from the vault; saved passwords
    themselves and their storage were never affected and need no action.

Upgrade

Docker: replace the image tag with 3.5.2 and restart. No migration runs
from 3.4 or 3.5. Check the reverse proxy limit first (see above). Native
installations replace the binary as described in the guide. Coming from
3.0 to 3.3, read Upgrading to 3.4 first, and
for a source installation
Moving a 3.x source installation.

The way back to 3.5.1 stays possible: replace the tag with 3.5.1 and
restart; 3.5.1 starts on the same data. It reads every value 3.5.2 accepts
and, where MAX_UPLOAD_SIZE is not set, uses its own default of 100 MiB.
It ignores LOCAL_SOURCES_FILE, so local sources are not offered. 3.5.1
does not reserve the names listed in users of that file: turn
registration off while it runs, and before upgrading again check that every
listed account is still the person the source was shared with.
CI checks this round trip with the released 3.5.1 image, pinned by
digest (tests/image/rollback.sh); 3.5.0 starts on that data as well.
As before every upgrade, take a backup first.