Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 08876ac

Browse files
committed
Changes proposed architecture for ssh MITM driver
Signed-off-by: Bella Khizgiyaev <bkhizgiy@redhat.com>
1 parent febeef5 commit 08876ac

7 files changed

Lines changed: 345 additions & 713 deletions

File tree

packages/jumpstarter-driver-ssh-mitm/README.md

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# SSH MITM Driver
22

3-
`jumpstarter-driver-ssh-mitm` provides secure SSH proxy functionality where private keys
4-
are stored on the exporter and never transmitted to clients.
3+
`jumpstarter-driver-ssh-mitm` provides a secure SSH proxy layer where private keys
4+
are stored on the exporter and never transmitted to clients. It is designed to be
5+
used as a child of `SSHWrapper`.
56

67
## Installation
78

@@ -10,52 +11,72 @@ are stored on the exporter and never transmitted to clients.
1011
$ pip3 install --extra-index-url {{index_url}} jumpstarter-driver-ssh-mitm
1112
```
1213

14+
## Architecture
15+
16+
```
17+
SSHWrapper --> SSHMITM --> TcpNetwork --> DUT
18+
```
19+
20+
- **SSHWrapper**: Handles SSH CLI and command execution
21+
- **SSHMITM**: Provides authenticated proxy connection (stores the SSH key)
22+
- **TcpNetwork**: Raw TCP connection to the DUT
23+
1324
## Configuration
1425

15-
Example configuration with inline key:
26+
The command name is determined by the key in the `export` section. Use `ssh_mitm` to get the `j ssh_mitm` command:
1627

1728
```yaml
1829
export:
19-
ssh_mitm:
20-
type: jumpstarter_driver_ssh_mitm.driver.SSHMITM
30+
ssh_mitm: # ← This gives you "j ssh_mitm" command
31+
type: jumpstarter_driver_ssh.driver.SSHWrapper
2132
config:
22-
default_username: "root"
23-
ssh_identity: |
24-
-----BEGIN OPENSSH PRIVATE KEY-----
25-
...
26-
-----END OPENSSH PRIVATE KEY-----
33+
default_username: root
2734
children:
2835
tcp:
29-
type: jumpstarter_driver_network.driver.TcpNetwork
36+
type: jumpstarter_driver_ssh_mitm.driver.SSHMITM
3037
config:
31-
host: "192.168.1.100"
32-
port: 22
38+
ssh_identity_file: /path/to/private/key
39+
default_username: root
40+
children:
41+
tcp:
42+
type: jumpstarter_driver_network.driver.TcpNetwork
43+
config:
44+
host: 192.168.1.100
45+
port: 22
3346
```
3447
35-
Example configuration with key file:
48+
Or with inline key:
3649
3750
```yaml
3851
export:
39-
ssh_mitm:
40-
type: jumpstarter_driver_ssh_mitm.driver.SSHMITM
52+
ssh_mitm: # ← This gives you "j ssh_mitm" command
53+
type: jumpstarter_driver_ssh.driver.SSHWrapper
4154
config:
42-
default_username: "root"
43-
ssh_identity_file: "/path/to/private/key"
55+
default_username: root
4456
children:
4557
tcp:
46-
type: jumpstarter_driver_network.driver.TcpNetwork
58+
type: jumpstarter_driver_ssh_mitm.driver.SSHMITM
4759
config:
48-
host: "192.168.1.100"
49-
port: 22
60+
default_username: root
61+
ssh_identity: |
62+
-----BEGIN OPENSSH PRIVATE KEY-----
63+
...
64+
-----END OPENSSH PRIVATE KEY-----
65+
children:
66+
tcp:
67+
type: jumpstarter_driver_network.driver.TcpNetwork
68+
config:
69+
host: 192.168.1.100
70+
port: 22
5071
```
5172
52-
### Config parameters
73+
### SSHMITM Config parameters
5374
54-
| Parameter | Description | Type | Required | Default |
55-
| ----------------- | -------------------------------------------------------- | ---- | -------- | ------- |
56-
| default_username | Default SSH username | str | no | "" |
57-
| ssh_identity | SSH private key content (inline) | str | no* | None |
58-
| ssh_identity_file | Path to SSH private key file | str | no* | None |
75+
| Parameter | Description | Type | Required | Default |
76+
| ----------------- | ---------------------------------------- | ----- | -------- | ------- |
77+
| default_username | SSH username for DUT connection | str | no | "" |
78+
| ssh_identity | SSH private key content (inline) | str | no* | None |
79+
| ssh_identity_file | Path to SSH private key file | str | no* | None |
5980
6081
\* Either `ssh_identity` or `ssh_identity_file` must be provided.
6182

@@ -65,28 +86,26 @@ export:
6586

6687
## Usage
6788

89+
Since SSHMITM is used as a child of SSHWrapper, you use the configured command name (e.g., `ssh_mitm`):
90+
6891
```bash
6992
# Execute a command
7093
j ssh_mitm whoami
7194
72-
# Interactive shell (native SSH via port forwarding)
73-
j ssh_mitm shell
95+
# Interactive shell
96+
j ssh_mitm
7497
75-
# Interactive shell (gRPC REPL, no local SSH required)
76-
j ssh_mitm shell --repl
98+
# With arguments
99+
j ssh_mitm ls -la /tmp
77100
78-
# Port forward for ssh/scp/rsync
79-
j ssh_mitm forward -p 2222
80-
# Then: ssh -p 2222 localhost
101+
# With SSH flags
102+
j ssh_mitm -v hostname
81103
```
82104

105+
**Note**: The command name (`ssh_mitm`) is determined by the key in your exporter config's `export` section. You can use any name you prefer.
106+
83107
## API Reference
84108

85109
```{eval-rst}
86110
.. autoclass:: jumpstarter_driver_ssh_mitm.driver.SSHMITM()
87111
```
88-
89-
```{eval-rst}
90-
.. autoclass:: jumpstarter_driver_ssh_mitm.client.SSHMITMClient()
91-
:members: execute, run
92-
```

packages/jumpstarter-driver-ssh-mitm/examples/exporter.yaml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,31 @@ kind: ExporterConfig
33
metadata:
44
namespace: default
55
name: ssh-mitm-example
6+
endpoint: "grpc.jumpstarter.example.com:443"
7+
token: "your-exporter-token"
68
export:
9+
# "j ssh_mitm" command - secure SSH with key on server
710
ssh_mitm:
8-
type: jumpstarter_driver_ssh_mitm.driver.SSHMITM
11+
type: jumpstarter_driver_ssh.driver.SSHWrapper
912
config:
10-
default_username: "root"
11-
# Option 1: Provide SSH key directly in config
12-
ssh_identity: |
13-
-----BEGIN OPENSSH PRIVATE KEY-----
14-
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAFwAAAAdz
15-
c2gtcnNhAAAAAwEAAQAAAQEAy... (your private key here)
16-
-----END OPENSSH PRIVATE KEY-----
17-
# Option 2: Or provide path to key file (uncomment to use)
18-
# ssh_identity_file: "/path/to/your/private/key"
13+
# Change to the user you will SSH as on the DUT
14+
default_username: root
1915
children:
2016
tcp:
21-
type: jumpstarter_driver_network.driver.TcpNetwork
17+
type: jumpstarter_driver_ssh_mitm.driver.SSHMITM
2218
config:
23-
host: "192.168.1.100"
24-
port: 22
19+
# Must match the user on the DUT
20+
default_username: root
21+
# Option 1: Path to key file (on exporter machine)
22+
ssh_identity_file: /etc/jumpstarter/ssh_keys/dut_key
23+
# Option 2: Inline key (from secret management)
24+
# ssh_identity: |
25+
# -----BEGIN OPENSSH PRIVATE KEY-----
26+
# ...key content...
27+
# -----END OPENSSH PRIVATE KEY-----
28+
children:
29+
tcp:
30+
type: jumpstarter_driver_network.driver.TcpNetwork
31+
config:
32+
host: 192.168.1.100
33+
port: 22

0 commit comments

Comments
 (0)