Skip to content

Automation

github-actions[bot] edited this page Dec 3, 2026 · 1 revision

Automation

WebSSH runs ordered SSH command steps on saved hosts, immediately or through explicitly approved cron schedules. It does not interpret Ansible playbooks, YAML/Jinja or declarative desired state. No agent is installed on targets.

Enable

Enable Automation in Administration → Integrations. This persisted runtime setting requires no Compose change or restart. New installations default to disabled. Upgrades migrate an existing configured opt-in; afterwards the admin setting is authoritative. Password storage is a separate setting; see Saved Passwords.

Automation needs HTTPS. Over plain HTTP the switch can be turned on, but every automation request is refused, and Administration marks the switch as needing HTTPS. Serve WebSSH over HTTPS, directly or through a reverse proxy listed in TRUSTED_PROXY_CIDRS; see Production Deployment and Reverse Proxy and Subfolder Deployment. The only exception is a development setup: with DEBUG=true in the homelab profile, AUTOMATION_ALLOW_INSECURE_LOOPBACK=true admits a browser on the same machine over HTTP.

Save and verify SSH hosts first. Unknown, changed or revoked host keys are rejected, never automatically accepted. Direct SSH and hosts behind one saved jump host are supported with usable stored keys or assigned passwords. Each hop needs its own verified host key and credential: a password-based jump host needs its own saved password. The jump host and a target it reaches by address follow the SSH network policy; a target name that only the jump host can resolve must be on PROXY_JUMP_REMOTE_DNS_ALLOWLIST while internal SSH is blocked, exactly as for interactive connections. Changing the jump host invalidates reviewed runs and approved schedules. Gateways, Tailscale SSH and interactive prompts remain unsupported by this execution engine.

Hosts with a SOCKS5 proxy route are also unsupported for immediate runs, workflows and schedules. Readiness explains that limitation, and execution rejects the target instead of connecting directly. Changing an approved host to a SOCKS route invalidates the existing schedule's target authorization and requires review. Interactive terminal sessions and their SFTP source remain available through the proxy.

Run now

  1. Open Automation → Workflows in the main application. The searchable list shows saved workflows with their steps and Execute now, Edit and Delete actions. Choose New or Edit to open the separate Editor tab. Switching back to Workflows preserves the editor draft; deleting requires confirmation of the named workflow.
  2. Add named steps. Select a step in the ordered list to edit its command, timeout and sudo settings beside it. Narrow screens stack the list and command editor. Steps run in independent shells: use a complete command such as cd /path && command. Copies from the command library are independent and require parameter review.
  3. Continue to Choose targets and select hosts or groups. Filtering preserves hidden selections. Review the actual target count. The numbered stages stay directly accessible, and Back preserves your draft. The active stage is centered; Schedule is optional when running immediately.
  4. Save & review run freezes exact commands, destinations and credential state for five minutes. Confirm the count and complete account reauthentication, including configured MFA.
  5. Runs shows actual states, exit codes and durations. Stop remains available. Changing tabs preserves the terminal workspace.

Sudo uses sudo -n and requires remote noninteractive permission: the command runs under sh as root, as with sudo -n -- sh -c .... No separate sudo password is stored. Stop-on-error and timeout controls remain enforced.

Several hosts

The hosts of a run work in parallel, at most AUTOMATION_MAX_PARALLEL_HOSTS at a time (default 4; see the configuration reference). The steps on one host still run one after the other, in their order. 1 runs the hosts one after the other in the order of the review, as before 3.4.3, except that a host that runs WebSSH still comes last (see below).

  • Stop on error: the first host of the review runs on its own (the canary). Only when it succeeded do the other hosts start, up to AUTOMATION_MAX_PARALLEL_HOSTS at a time; when it fails, no other host starts. After the canary, the first host with an error stops the start of further hosts; hosts that are already working finish, the rest are marked skipped. This also applies to schedules approved before 3.4.4: a failing change reaches one host first, not up to AUTOMATION_MAX_PARALLEL_HOSTS. A host that runs WebSSH is never the canary (it still runs last, on its own), unless it is the only host of the run. The review and the schedule review say how the hosts run.
  • Each host needs one SSH session of the user's QUOTA_SSH_SESSION_PER_USER. When the quota is used up, for example by open terminals, further hosts wait for a session instead of failing; Runs shows such a host as queued, waiting for a free SSH session.
  • The output a run keeps (64 KiB) is split into equal shares for the hosts when several work at the same time, so what a host keeps does not depend on which host finishes first. One host at a time keeps the order of the hosts, as before.
  • Runs shows the state of every host as it changes; several hosts can be running at once.

The host that runs WebSSH

A host that runs WebSSH itself, for example in Docker, runs last and alone, after all other hosts of the run. The review and the schedule review name it and warn about it: an upgrade of Docker or a reboot of that host interrupts WebSSH. With detached steps (the default), the steps keep running on the host (see below), and WebSSH collects the result after it is back. A step on a host without systemd or setsid, or any step with AUTOMATION_DETACHED_STEPS=false, runs in the SSH session and is interrupted when WebSSH restarts; run such updates outside WebSSH.

WebSSH recognises such a host in two ways:

  • This host runs WebSSH in the saved host's editor marks it.
  • Before its first step on a host, a run checks without privileges whether the host runs this WebSSH: the host must have the same boot id as the kernel WebSSH runs on, and either a process in WebSSH's container (by the container id in /proc/<pid>/cgroup) or, without a container, WebSSH's own process (pid and start time). A host found this way is remembered for later reviews and runs for seven days; when you save the host with This host runs WebSSH off after that finding, your choice counts until a later run finds it again. The check does not see the container when the host mounts /proc with hidepid and the SSH account is not root, or when WebSSH runs in a container whose id it cannot read; mark such a host by hand. If the check finds the host only while other hosts are already working, the host waits and runs after them.

Detached steps

Since 3.4.3 a step does not depend on the SSH connection that started it. WebSSH hands the step to a runner on the host and collects its exit status and output when the step ends. When the connection breaks or WebSSH restarts, for example because the step restarted Docker on the host that runs WebSSH, the step continues on the host; WebSSH reconnects, or after its restart signs in again, and fetches the result instead of reporting an unknown outcome. Steps collected after a restart say so in Runs.

  • A sudo step runs as a transient systemd unit (systemd-run) on hosts with systemd; a step without sudo runs as a unit of the account's user manager where the account lingers (loginctl enable-linger). Otherwise the runner starts in its own session with setsid. Hosts that offer neither (no Linux /proc, no setsid, no writable home directory) run the step in the SSH session as before, and the step's details say so.
  • The runner keeps its files in ~/.local/state/webssh-jobs/ of the account (mode 0700, one directory per run, host and step) and its unit is named after that directory. File names and unit names hold no part of the command; the command is in the account's private directory and, as before, in the process list of the host while it runs. No password is written anywhere: sudo steps still use sudo -n.
  • The step's time limit is enforced on the host: SIGTERM at the limit, SIGKILL ten seconds later. Such a step is failed with reason timeout, with the exit status the host reported. After the time limit or a stop, processes the step started in its process group end with it, also those that ignore SIGTERM, before the result is reported.
  • The step runs with the account's login shell, home directory and PATH as in the SSH session. Variables that only the SSH session sets (SSH_CONNECTION and similar) are not available, and a sudo step in a systemd unit starts in the home directory with the unit's environment.
  • At most 128 KiB per stream stay on the host while the step runs; more output is read and discarded.
  • After the result is collected, or when WebSSH gives a step up and can still sign in, WebSSH removes the directory. Directories of steps that ended or were lost more than two days ago are removed the next time WebSSH signs in to that host for a run or a collection, so the output of a step does not stay on the host when its result never could be collected; only directories named webssh-job-* whose step no longer runs are touched. WebSSH never collects a step later than a day after its start.
  • The job directory and the directories above it up to the home directory must belong to the account (or root) and must not be writable by other accounts; group write is accepted only for the account's own primary group. Otherwise the step runs in the SSH session. The runner deletes the command file as soon as it has read it.
  • After a restart, WebSSH collects open steps right away, the hosts in parallel (at most AUTOMATION_MAX_PARALLEL_HOSTS at a time), and what is left every two minutes, for up to 24 hours. A Stop after a restart reaches the host at once. A collected step shows the run time the host recorded, and the run ends with the last step that ended. It signs in only while the saved host still has the address, port and user of the run, its saved password is still assigned, the account still exists, and automation is enabled. For a locked account WebSSH ends the step on the host, as Stop would, and records it as cancelled; for a removed account it gives the step up. When the run was deleted in the meantime (for example by 3.4.2 after a way back), the result is not stored and the audit log records AUTOMATION_STEP_COLLECTED_WITHOUT_RUN.
  • If DATA_DIR/go/automation-jobs.db cannot be opened, WebSSH starts anyway, logs a warning and runs every step in the SSH session until the file opens again. The file may be deleted; steps still open on hosts are then no longer collected. When a step is still running, WebSSH waits for it within the step's time limit. A collection uses one background job and one SSH session of the user's quota; while the user's own runs and terminals use them up, it waits for the next pass. After 24 hours WebSSH gives up, leaves the step unknown and removes its directory from the host when it can still sign in.
  • A step collected after a restart ends that host's part of the run: the later steps of that host and hosts the run had not started yet are marked skipped, and the host and the run are unknown with the note that WebSSH restarted during the run, not cancelled: nobody stopped them. WebSSH does not run the later steps on its own after the restart. They would run outside the run that was reviewed, without its grant, its deadline and without anyone watching, and the restart may have been caused by an earlier step. Check the host and start the run again for them. Only a Stop makes a collected run cancelled.
  • When a host refuses the sign-in of a collection (password or key no longer accepted, a one-time code asked for) or its host key is not trusted, WebSSH does not repeat it every two minutes: the next attempt follows after ten minutes, and the pause doubles after each further refusal, up to six hours. The first refusal is written to the audit log as AUTOMATION_JOB_COLLECTION_REFUSED, and Runs marks the host as needing attention. A network failure is retried as before. Stop on such a run does not wait out the pause: it allows one attempt at once, at the earliest a minute after the last refusal, so a stop reaches the host as soon as you have fixed its host key or password. This waiting is kept in memory: after a restart of WebSSH each host is tried once at once. The same applies during a run: a refused sign-in when the connection is opened again is not repeated, the step stays open, and the collection after the run takes over.
  • The host clock only measures a collected step: the run ends at the step's start on WebSSH's clock plus the run time the host recorded, never later than the collection. A host clock that is ahead or behind does not move the end of a run.
  • AUTOMATION_DETACHED_STEPS=false turns detached steps off: every step runs in the SSH session as before 3.4.3, and nothing is written to the hosts.

Stop and a shutdown of WebSSH differ on purpose. Stop ends the work on the host: SIGTERM to the step's processes, SIGKILL after ten seconds, and the unit is stopped; the step is then cancelled with its exit status. The same happens when the run's grant no longer holds, when the sign-in that started it is revoked, and at the 30-minute run deadline. When the stop cannot reach the host, or when you stop a run after a restart of WebSSH whose step still runs on the host, WebSSH records it and ends the step at the next collection, before it fetches the result. After a restart, Runs offers Stop only for a run with a step that is still open on its host and not stopped yet. Once stopped, Runs says that the stop has not reached the host yet and offers Stop again, for example after you fixed a refused sign-in. Such a run cannot be deleted until the step was collected: deleted, the step would run on unseen and could no longer be stopped; Runs says so, and Delete finished runs leaves it out. Stop on a run that ended, with no step left on a host, is refused with not_running (HTTP 409) and changes nothing. A shutdown or restart of WebSSH, including one caused by the step itself, does not end the work on the host.

A sudo step in a transient system unit is started by systemd, not by sudo: the sudo log shows sh -c with the job's launcher, not the step's command, and sudo's I/O logging and secure_path do not apply to the step. The unit uses KillMode=mixed: when the step ends, processes it left in the background (nohup ... &) end with the unit, after the ten-second grace. On the setsid path and in the SSH session, such processes keep running as before.

Commands run without interactive input. Package upgrades that ask for confirmation can therefore abort even when SSH and authentication succeeded. Review the package manager's unattended options explicitly; WebSSH does not add confirmation flags or answer prompts. The editor warns about common apt upgrade confirmation requirements, short package-upgrade timeouts and a duplicate sudo prefix when the sudo option is already enabled. Recognized apt confirmation-abort output is explained in the run details while preserving the original output and exit status. These hints are not a complete command validator. Automation executes SSH commands; it does not provide Ansible modules or idempotency guarantees.

Saved workflows provide Execute now. Choose destinations before reviewing: a workflow defines commands, while schedules retain their explicitly approved destinations. Nothing executes until the existing review and account-verification steps are complete.

Scheduled execution

Choose Schedule, then select hourly, daily, weekdays, weekly or monthly. Set the time or day and the IANA timezone. The summary explains the selected cadence; Review schedule shows the next execution times calculated by the server. Monthly dates that do not occur in a month are skipped. Advanced schedules remain available through Custom cron; existing custom expressions are preserved when reopened. For example, 0 3 * * * in Europe/Berlin means 03:00 daily in that timezone. Review exact commands and hosts and explicitly authorize unattended execution with account reauthentication and host-count confirmation.

A schedule is a durable, scoped authorization. Assigned passwords work without an open browser or temporary unlock. Normal logout does not revoke schedules; a scheduled run already in progress finishes. Newly added group members are not silently included. Changes to the workflow, target, relevant keys/passwords, account security generation or feature policy require fresh approval. Account lock/deletion and restored session epochs invalidate grants.

  • Pause stops future dispatch and further active steps. Delete removes the schedule, preserving run history.
  • Missed occurrences during downtime are not replayed. There is no backlog or automatic retry.
  • Overlapping occurrences are skipped while a previous claim remains active.
  • Missing spring-forward local times are skipped; repeated autumn times fire only at their first occurrence.
  • Crashes and ambiguous dispatches are not retried automatically. Unknown outcomes require inspection and explicit reapproval.
  • Restored backups do not silently resume old unattended grants. Native backups exclude saved remote passwords, legacy password vaults and SSH keys; normal restore also ignores them in older archives and removes existing copies. Reimport keys, recreate passwords and reassign credentials, then review and explicitly re-enable schedules.

Execute now on a schedule reviews its stored commands and destinations for a separate immediate run, including when paused. It does not change the next scheduled time or enable a paused schedule. It uses fresh interactive authorization and current credentials, rather than reusing the unattended grant. Editing or deleting the source schedule invalidates a pending immediate-run review.

Disabling Automation preserves definitions, blocks starts and interrupts further work. Schedules remain accessible for pausing/removal while disabled.

Results and boundaries

For finished runs on several hosts, Compare hosts groups the hosts per step by status, exit code, standard output and error output (trailing whitespace ignored), largest group first. It uses the retained output; a step with truncated output is never reported as identical on all hosts. When some steps differ, only those are shown until Show only steps that differ is cleared.

Keep restart and update status current

WebSSH never checks updates on its own. The Updates and restart status template reads whether a restart is required (/var/run/reboot-required, any Linux) and, on Debian and Ubuntu, how many updates and security updates the local package lists show (a simulated apt-get -s upgrade). It uses no sudo, refreshes nothing, takes no lock and writes no file, also as root: apt's planner log and binary caches are switched off. apt-check and dnf are not used because both write caches or logs even when only reading, so Fedora and other systems report only the restart marker. The host controls this output, so the overview shows the values as reported and never acts on them. Counts lag behind the repositories until the host refreshes its lists. Run the template yourself or approve a schedule, for example daily. The overview takes the result only from that exact, unchanged step without sudo, with exit status 0 and untruncated output, and only for hosts whose address, port, user and route still match. When security updates are pending and Automation is enabled, the overview offers Open upgrade workflow for the Debian or Ubuntu hosts concerned; it opens the upgrade template as a draft with those hosts selected. While the overview shows a restart hint for a saved host, each login to that host rereads only the restart marker (two existence tests, no sudo, no package manager, no writes). When the marker is gone, the hint disappears; the update counts stay until the template runs again. Any answer other than exactly reboot=yes or reboot=no, or none, keeps the hint and stops these rereads until the next full check, because a forced command (command= in authorized_keys, ForceCommand) may have answered in place of the test. Hosts without a restart hint are never asked. Check restart status again opens the template as a draft for the hosts concerned.

Expand a step in Runs to see its exit code, duration, execution reason and captured standard/error output. New immediate and scheduled runs retain bounded output; older records explicitly indicate that output was not recorded. Output becomes available when the step ends. A confirmed zero exit status means the command reported success, not that WebSSH independently verified the intended change.

At most 8 KiB of UTF-8 output per step and 64 KiB per run are retained. Truncation is marked; the history keeps at most 50 runs within its existing storage limit, so older entries may expire earlier. Runs lets the owner delete a single finished run or all finished runs; queued and running work cannot be deleted. Deleting removes only the stored result and output, never anything on the hosts, and is recorded in the security audit log. Known SSH authentication passwords and terminal control sequences are removed before storage. This is not a general secret detector: commands can print unrelated tokens, private data or other sensitive content. Run output is private to the owning account and is included in its stored history and backups. Avoid commands that print secrets.

A detached step reports a known outcome after a lost connection, a restart or a stop. Unknown remains for steps that ran in the SSH session (hosts without a runner), for a runner that vanished (the host rebooted during the step) and for a step whose result WebSSH could not collect in time; the command may have taken effect. Inspect the target before retrying. Stop does not undo remote changes. Reaching the output capture or history limit only truncates the retained log: WebSSH continues draining stdout and stderr until the exit status, cancellation or timeout. Captured data is bounded to 128 KiB per stream before redaction and the smaller history budget is applied. A large stdout stream cannot consume stderr's capture allocation.

  • One WebSSH process per DATA_DIR; schedule claims also use a transactional compare-and-swap in the database.
  • One active run per user, four globally, with existing SSH/background quotas.
  • At most 50 targets, 20 steps, 8192 UTF-8 bytes per command, 1–300 seconds per step and a 30-minute total deadline.
  • At most 50 schedules per user. Preview intents last five minutes and are single-use.
  • HTTPS, CSRF, action-bound account authorization, current destination bindings and verified SSH host keys remain mandatory.
  • No automatic retries, rollback, agent forwarding, controller-local command execution or plugin/collection loading.

Prefer dedicated remote accounts with limited permissions. Never embed secrets in commands. Replacing a credential revokes its previous execution approvals; unrelated credential changes do not.

The UI uses the chosen theme and reduced-motion preference. Narrow views change the inspector arrangement instead of shrinking text. Activity and progress reflect confirmed execution state.

Workflow examples

The Workflows landing page explains the steps-to-hosts-to-execution journey and offers 23 editable templates grouped into System, Network, Services and logs, Containers, and Packages. The selector previews the included steps, prerequisites, and whether the commands change the host.

Opening a template creates an unsaved draft with no destinations selected. It does not save a workflow, execute commands, or enable a schedule. Existing unsaved changes require confirmation before replacement. Templates begin with an explicit prerequisite check for the supported OS and required tools, plus systemd or Docker access where needed. A failed check stops that host before subsequent steps. Review and adapt every command for the destination OS and installed tools before saving and approving a run. Existing saved workflows are independent copies and are not rewritten by template updates; reopen a template to obtain its updated checks.

Most examples collect inventory or diagnostics. The Debian/Ubuntu and Fedora/RHEL upgrade examples modify installed packages, may restart services, and require noninteractive sudo permission. Their 300-second step timeout is a bound, not a completion guarantee; inspect the host after an uncertain result. Journal output may contain sensitive information and follows the same bounded history storage policy as other runs.

Saved command sets are available in a separate group in the template selector. Importing creates a copy as one shell step, preserving the resolved sequence and its shell context. Parameterized sets request fixed values and use the existing server-side parameter resolver. Missing references or oversized commands must be repaired before import. Later changes to the original set do not update a workflow copy.

Overview displays up to five recent runs, prioritizing queued and running jobs, with confirmed step counts and a direct link to the expanded run log. Status refreshes while Overview is visible; a failed refresh is marked as stale rather than shown as a successful result. The workflow action bar stays reachable while the editor and destination list scroll. Motion follows the reduced-motion preference.

Export and retention

Each retained run has Export JSON and Export CSV actions. Exports require the same authenticated owner and transport protections as run history. They contain the currently retained metadata and bounded stdout/stderr; they do not recover deleted or truncated output. CSV cells that could be interpreted as spreadsheet formulas are prefixed with an apostrophe. The CSV export keeps the columns of earlier releases: how a step ran (execution) and whether its result was collected after a restart (recovered) are only in the JSON export. Exported output can still contain sensitive remote data; store it appropriately.

The account history retains at most 50 runs within a 1 MiB document limit, so older results can be removed sooner when the size bound is reached. Per-step output becomes visible after that step finishes, including long-running steps. A silent running step does not imply that it failed or is safe to repeat. Unknown outcomes require checking the remote system before starting again.

Clone this wiki locally