Skip to content

feat(protocol): Introduce 'RemoteRun' target type (Shell, OpenStack, K8s) - #1551#1634

Closed
senolcolak wants to merge 6 commits intowarp-tech:mainfrom
senolcolak:wip-protocol-remoterun
Closed

feat(protocol): Introduce 'RemoteRun' target type (Shell, OpenStack, K8s) - #1551#1634
senolcolak wants to merge 6 commits intowarp-tech:mainfrom
senolcolak:wip-protocol-remoterun

Conversation

@senolcolak
Copy link
Copy Markdown

Description

Closes #1551

This PR introduces a new protocol module warpgate-protocol-remoterun. The goal is instead of strictly proxying connections to static hosts, Warpgate can now manage ephemeral environments and execute direct remote commands.

This feature adds a new RemoteRun target type with three distinct execution strategies:

  1. Shell Execution: Runs a specific command on a remote host (or the gateway itself).
  2. OpenStack Ephemeral VM: Provision a fresh VM via OpenStack APIs, injects public keys from GitHub, connects the user, and destroys the VM upon session termination.
  3. Kubernetes Ephemeral Pod: Spawns a temporary Pod (e.g., ceph-tools), waits for readiness, attaches the user via kubectl exec, and cleans up the pod afterwards.

Technical Changes

Backend (warpgate-protocol-remoterun & warpgate-common)

  • Created new crate warpgate-protocol-remoterun.
  • Updated Target and TargetKind structs to support the RemoteRun variant.
  • Shell Mode: Implemented standard command execution wrapper.
  • OpenStack Mode: Implemented reqwest client to interact with Nova/Compute APIs for server creation and key injection.
  • K8s Mode: Integrated kube-rs to handle Pod lifecycle (Create -> Wait -> Exec -> Delete).

Frontend (warpgate-admin)

  • Updated the Add/Edit Target modal.
  • Added dynamic form logic: Selecting "Remote Run" reveals a sub-type selector (Shell vs. OpenStack vs. K8s).
  • Form fields validate dynamically based on the selected strategy (e.g., "Flavor ID" is only visible/required for OpenStack).

Configuration Examples

Users can configure these targets via warpgate.yaml:

1. Shell Execution

targets:
  - name: "raw-ssh-jump"
    kind: RemoteRun
    mode: Shell
    command: "ssh -J user@bastion internal-host"

2. OpenStack Ephemeral VM

targets:
  - name: "dev-sandbox"
    kind: RemoteRun
    mode: OpenStack
    api_url: "https://openstack.example.com:5000/v3"
    auth_token: "secret-token-ref" # Or use Vault reference
    flavor_id: "m1.small"
    image_id: "ubuntu-22.04-LTS"
    network_id: "net-uuid"
    github_username: "developer-account" # Fetches keys from github.com/developer-account.keys

3. Kubernetes Ephemeral Pod (e.g., Ceph Tools)

targets:
  - name: "ceph-admin"
    kind: RemoteRun
    mode: Kubernetes
    kubeconfig: "/etc/warpgate/kubeconfig.yaml"
    namespace: "rook-ceph"
    pod_image: "rook/ceph:master"
    command: "/bin/bash"

Comment thread warpgate-protocol-remoterun/src/openstack.rs Fixed
let url = format!("https://github.com/{}.keys", username);

let response = client
.get(&url)

Check failure

Code scanning / CodeQL

Cleartext transmission of sensitive information High

This 'get' operation transmits data which may contain unencrypted sensitive data from
username
.
@LarsSven
Copy link
Copy Markdown
Contributor

That's actually an amazing feature, we may also want to use this!

@LarsSven
Copy link
Copy Markdown
Contributor

@senolcolak I'm curious, how would this work with multiple users on the same target? Would they all log into the same VM/pod, or would each access to a target spin up its own pod/VM?

@senolcolak
Copy link
Copy Markdown
Author

@senolcolak I'm curious, how would this work with multiple users on the same target? Would they all log into the same VM/pod, or would each access to a target spin up its own pod/VM?

Here the goal is to create an ephemeral connection. Each user will trigger a command for a new session.
like you need a temporary access to a Rook/Ceph cluster, for each access a temporary pod will be created

kubectl run -n rook-ceph ceph-tools-temp-session \
  --rm -it \
  --image=$(kubectl get deployment -n rook-ceph rook-ceph-tools -o jsonpath='{.spec.template.spec.containers[0].image}') \
  --restart=Never -- bash

@LarsSven
Copy link
Copy Markdown
Contributor

Ah okay fair, that's unfortunate. We were mainly looking for something where an ephemeral environment is spun up for a group that is destroyed if no one is in it, but when multiple people connect they all connect to the same ephemeral environment, but your usecase makes sense.

@senolcolak
Copy link
Copy Markdown
Author

Ah okay fair, that's unfortunate. We were mainly looking for something where an ephemeral environment is spun up for a group that is destroyed if no one is in it, but when multiple people connect they all connect to the same ephemeral environment, but your usecase makes sense.

This will be a bit difficult, but still achievable via using openstack integration. This can be implemented as an enhancement to our functionality.

let url = format!("https://github.com/{}.keys", username);

let response = client
.get(&url)

Check failure

Code scanning / CodeQL

Cleartext transmission of sensitive information

This 'get' operation transmits data which may contain unencrypted sensitive data from [username](1).
@LarsSven
Copy link
Copy Markdown
Contributor

LarsSven commented Mar 4, 2026

@Eugeny is this a feature you would be interested at merging at some point in the future? Because I'd be very interested in this feature

@senolcolak
Copy link
Copy Markdown
Author

@LarsSven I will check this once more, create a more narrowed version. The current version supports too much in a single stack.

@senolcolak
Copy link
Copy Markdown
Author

#1530 solves this

@senolcolak senolcolak closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Allow Running Contextual Commands (e.g., kubectl) or direct access to k8s

3 participants