Files
windmill/backend/windmill-worker/src/ssh_executor_oss.rs
T
Ruben Fiszel afddfe8445 feat(worker): #ssh directive to run a bash script on a remote SSH host (#9479)
* feat(worker): #ssh directive to run a bash script on a remote SSH host

Add a first-class `#ssh <resource_path>` bash directive that reroutes a
normal bash script to run on a remote host reached over SSH (a
jump/utility node) instead of on the worker, with full parity: typed
positional args in, structured result out, live streamed logs,
cancellation, and remote exit-code propagation.

It mirrors the existing `# sandbox <image>` precedent: the directive is
parsed in handle_bash_job and reroutes to a specialized handler that
reuses handle_child for all execution plumbing.

- windmill-common: BashAnnotations::ssh_target() parser (+ unit test)
  and the ssh_execution_enabled instance setting (off by default)
- windmill-worker: reroute hook in bash_executor + ssh_executor_oss
  shim. OSS returns a clear "enterprise feature" error; the real
  handler lives in ssh_executor_ee.rs (private feature) and is gated by
  a valid enterprise license + the instance setting.
- examples/usecase/ssh-execution-wrapper: the ssh_target resource type,
  a userland wrapper (no-license fallback), and a README documenting
  both paths and the trade-offs vs agent workers.

EE companion: windmill-labs/windmill-ee-private (ee-repo-ref.txt bumped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(worker): ssh host-key opt-in, 0600 key write, instance setting UI

* chore: update ee-repo-ref

* feat(worker): #ssh $arg form to take the ssh target from a job argument

* fix(worker): #ssh token must look like a target; $arg restricted to path strings

* fix(worker): tighten #ssh parser to exact directive; add -- ssh destination guard

* chore: update ee-repo-ref to d45b9a6cbe40f7fe5d322c850c50f64a6980e4f0

This commit updates the EE repository reference after PR #609 was merged in windmill-ee-private.

Previous ee-repo-ref: 2804f1aa8e74b3a7733aeb6f5044d5085193872a

New ee-repo-ref: d45b9a6cbe40f7fe5d322c850c50f64a6980e4f0

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
2026-06-10 15:14:37 +00:00

28 lines
1.1 KiB
Rust

#[cfg(feature = "private")]
#[allow(unused)]
pub(crate) use crate::ssh_executor_ee::*;
// OSS stub: the `#ssh <resource>` directive is an enterprise feature. The real
// implementation lives in ssh_executor_ee.rs (compiled under the `private`
// feature). See examples/usecase/ssh-execution-wrapper/ for the userland
// (no-license) alternative.
#[cfg(not(feature = "private"))]
pub(crate) async fn handle_ssh_bash_job(
_ssh_path: &str,
_mem_peak: &mut i32,
_canceled_by: &mut Option<windmill_queue::CanceledBy>,
_job: &windmill_queue::MiniPulledJob,
_conn: &windmill_common::worker::Connection,
_client: &windmill_common::client::AuthedClient,
_content: &str,
_job_dir: &str,
_worker_name: &str,
_occupancy_metrics: &mut crate::common::OccupancyMetrics,
) -> Result<Box<serde_json::value::RawValue>, windmill_common::error::Error> {
Err(windmill_common::error::Error::ExecutionErr(
"SSH execution (#ssh) is an enterprise feature. Use the enterprise image, or the userland \
SSH wrapper in examples/usecase/ssh-execution-wrapper/."
.to_string(),
))
}