Codumentor logo Codumentor

Remote SSH Plugin

Experimental — This plugin is under active development. APIs and behavior may change in future releases.

The Remote SSH plugin registers ssh_exec, ssh_upload, and ssh_download so the agent can run commands and transfer files on remote hosts via SSH/SFTP.

asyncssh is a Codumentor dependency (already in requirements.txt).

Configuration

plugins:
  - module: codumentor.plugins.remote_ssh
    class: RemoteSSHPlugin
    args:
      enabled: true
      target_agents: "main"
      allow_adhoc: true
      default_timeout: 30
      max_output_size: 10240
      keepalive_interval: 30
      idle_timeout: 60
      max_connections_per_session: 5
      known_hosts_path: ./data/ssh_known_hosts
      hosts:
        prod-server:
          hostname: 192.168.1.10
          port: 22
          username: deploy
          key_path: ~/.ssh/id_rsa
          host_key_policy: known_hosts
        lab:
          hostname: lab.example.com
          username: ubuntu
          host_key_policy: trust_first

Plugin parameters

ParameterTypeDefaultDescription
enabledbooltrueEnable or disable the plugin
target_agentsstring"main"Which agents get the tools: "main", "subagent", or "all"
allow_adhocbooltrueAllow connections to hosts not listed in hosts
default_timeoutint30Default ssh_exec timeout (seconds)
max_output_sizeint10240Maximum output size per tool call (bytes)
keepalive_intervalint30SSH keepalive interval (seconds)
idle_timeoutint60Close idle pooled connections after this many seconds
max_connections_per_sessionint5Maximum pooled connections per conversation
known_hosts_pathstring./data/ssh_known_hostsOpenSSH-format file used when a host's host_key_policy is trust_first

Per-host parameters (args.hosts.<alias>)

ParameterTypeDefaultDescription
hostnamestring(required)Hostname or IP
portint22SSH port
usernamestring"root"SSH username
key_pathstringNonePrivate key file. If unset, default keys / ssh-agent are used
host_key_policystring"known_hosts""known_hosts" (system known_hosts), "trust_first" (TOFU into known_hosts_path), or "disabled" (no verification). Unknown values fall back to "known_hosts".

Tools

ssh_exec

ParameterRequiredDescription
hostYesPre-configured alias, or hostname/IP when ad-hoc is allowed
commandYesShell command to run
usernameNoAd-hoc username (pre-configured hosts use their config)
key_pathNoAd-hoc private key path
portNoAd-hoc SSH port (default 22)
timeoutNoCommand timeout in seconds

ssh_upload / ssh_download

ParameterRequiredDescription
hostYesAlias or hostname/IP
local_pathYesPath on the Codumentor server
remote_pathYesPath on the remote host
username / key_path / portNoSame ad-hoc overrides as ssh_exec

Host key verification

Default (host_key_policy: known_hosts) uses the system OpenSSH known_hosts files. The first connection to an unknown host fails until that host is in those files.

trust_first records the host key in known_hosts_path on first connect and verifies it afterwards (TOFU). A later key mismatch prompts the user to accept or reject. disabled skips verification entirely.

User settings

Users can override two settings in the Web UI (Settings → Remote SSH):

Notes