tunnel-manager 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tunnel-manager might be problematic. Click here for more details.
- tests/test_tunnel.py +3 -4
- tunnel_manager/tunnel_manager.py +138 -39
- tunnel_manager/tunnel_manager_mcp.py +680 -181
- {tunnel_manager-1.0.0.dist-info → tunnel_manager-1.0.1.dist-info}/METADATA +106 -57
- tunnel_manager-1.0.1.dist-info/RECORD +11 -0
- tunnel_manager-1.0.0.dist-info/RECORD +0 -11
- {tunnel_manager-1.0.0.dist-info → tunnel_manager-1.0.1.dist-info}/WHEEL +0 -0
- {tunnel_manager-1.0.0.dist-info → tunnel_manager-1.0.1.dist-info}/entry_points.txt +0 -0
- {tunnel_manager-1.0.0.dist-info → tunnel_manager-1.0.1.dist-info}/licenses/LICENSE +0 -0
- {tunnel_manager-1.0.0.dist-info → tunnel_manager-1.0.1.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tunnel-manager
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Create SSH Tunnels to your remote hosts and host as an MCP Server for Agentic AI!
|
|
5
5
|
Author-email: Audel Rouhi <knucklessg1@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -38,7 +38,7 @@ Dynamic: license-file
|
|
|
38
38
|

|
|
39
39
|

|
|
40
40
|
|
|
41
|
-
*Version: 1.0.
|
|
41
|
+
*Version: 1.0.1*
|
|
42
42
|
|
|
43
43
|
This project provides a Python-based `Tunnel` class for secure SSH connections and file transfers, integrated with a FastMCP server (`tunnel_manager_mcp.py`) to expose these capabilities as tools for AI-driven workflows. The implementation supports both standard SSH (e.g., for local networks) and Teleport's secure access platform, leveraging the `paramiko` library for SSH operations.
|
|
44
44
|
|
|
@@ -49,31 +49,34 @@ This project provides a Python-based `Tunnel` class for secure SSH connections a
|
|
|
49
49
|
- **Key Functionality**:
|
|
50
50
|
- **Run Remote Commands**: Execute shell commands on a remote host and retrieve output.
|
|
51
51
|
- **File Upload/Download**: Transfer files to/from a single host or all hosts in an inventory group using SFTP.
|
|
52
|
-
- **Passwordless SSH Setup**: Configure key-based authentication for secure, passwordless access.
|
|
52
|
+
- **Passwordless SSH Setup**: Configure key-based authentication for secure, passwordless access, with support for RSA and Ed25519 key types.
|
|
53
53
|
- **SSH Config Management**: Copy local SSH config files to remote hosts.
|
|
54
|
-
- **Key Rotation**: Generate and deploy new SSH key pairs, updating `authorized_keys`.
|
|
54
|
+
- **Key Rotation**: Generate and deploy new SSH key pairs (RSA or Ed25519), updating `authorized_keys`.
|
|
55
55
|
- **Inventory Support**: Operate on multiple hosts defined in an Ansible-style YAML inventory, with group targeting (e.g., `all`, `homelab`, `poweredge`).
|
|
56
56
|
- **Teleport Support**: Seamlessly integrates with Teleport's certificate-based authentication and proxying.
|
|
57
57
|
- **Configuration Flexibility**: Loads SSH settings from `~/.ssh/config` by default, with optional overrides for username, password, identity files, certificates, and proxy commands.
|
|
58
58
|
- **Logging**: Optional file-based logging for debugging and auditing.
|
|
59
59
|
- **Parallel Execution**: Support for parallel operations across multiple hosts with configurable thread limits.
|
|
60
|
+
- **Key Type Support**: Explicit support for both RSA and Ed25519 keys in authentication, generation, and rotation for enhanced security and compatibility.
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
## FastMCP Server
|
|
62
63
|
- **Purpose**: Exposes `Tunnel` class functionality as a FastMCP server, enabling AI tools to perform remote operations programmatically.
|
|
63
64
|
- **Tools Provided**:
|
|
64
|
-
- `
|
|
65
|
-
- `
|
|
66
|
-
- `
|
|
65
|
+
- `run_command_on_remote_host`: Runs a shell command on a single remote host.
|
|
66
|
+
- `send_file_to_remote_host`: Uploads a file to a single remote host via SFTP.
|
|
67
|
+
- `receive_file_from_remote_host`: Downloads a file from a single remote host via SFTP.
|
|
67
68
|
- `check_ssh_server`: Checks if the SSH server is running and configured for key-based authentication.
|
|
68
69
|
- `test_key_auth`: Tests key-based authentication for a host.
|
|
69
70
|
- `setup_passwordless_ssh`: Sets up passwordless SSH for a single host.
|
|
70
71
|
- `copy_ssh_config`: Copies an SSH config file to a single remote host.
|
|
71
72
|
- `rotate_ssh_key`: Rotates SSH keys for a single host.
|
|
72
73
|
- `remove_host_key`: Removes a host’s key from the local `known_hosts` file.
|
|
73
|
-
- `
|
|
74
|
-
- `
|
|
75
|
-
- `
|
|
76
|
-
- `
|
|
74
|
+
- `configure_key_auth_on_inventory`: Sets up passwordless SSH for all hosts in an inventory group.
|
|
75
|
+
- `run_command_on_inventory`: Runs a command on all hosts in an inventory group.
|
|
76
|
+
- `copy_ssh_config_on_inventory`: Copies an SSH config file to all hosts in an inventory group.
|
|
77
|
+
- `rotate_ssh_key_on_inventory`: Rotates SSH keys for all hosts in an inventory group.
|
|
78
|
+
- `send_file_to_inventory`: Uploads a file to all hosts in an inventory group via SFTP.
|
|
79
|
+
- `receive_file_from_inventory`: Downloads a file from all hosts in an inventory group via SFTP.
|
|
77
80
|
- **Transport Options**: Supports `stdio` (for local scripting) and `http` (for networked access) transport modes.
|
|
78
81
|
- **Progress Reporting**: Integrates with FastMCP's `Context` for progress updates during operations.
|
|
79
82
|
- **Logging**: Comprehensive logging to a file (`tunnel_mcp.log` by default) or a user-specified file.
|
|
@@ -82,8 +85,9 @@ This project provides a Python-based `Tunnel` class for secure SSH connections a
|
|
|
82
85
|
<summary><b>Usage:</b></summary>
|
|
83
86
|
|
|
84
87
|
## Tunnel Class
|
|
85
|
-
The `Tunnel` class can be used standalone for SSH operations.
|
|
88
|
+
The `Tunnel` class can be used standalone for SSH operations. Examples:
|
|
86
89
|
|
|
90
|
+
### Using RSA Keys
|
|
87
91
|
```python
|
|
88
92
|
from tunnel_manager.tunnel_manager import Tunnel
|
|
89
93
|
|
|
@@ -96,7 +100,6 @@ tunnel = Tunnel(
|
|
|
96
100
|
certificate_file="/path/to/cert", # Optional for Teleport
|
|
97
101
|
proxy_command="tsh proxy ssh %h", # Optional for Teleport
|
|
98
102
|
ssh_config_file="~/.ssh/config",
|
|
99
|
-
log_file="tunnel.log"
|
|
100
103
|
)
|
|
101
104
|
|
|
102
105
|
# Connect and run a command
|
|
@@ -110,21 +113,60 @@ tunnel.send_file("/local/file.txt", "/remote/file.txt")
|
|
|
110
113
|
# Download a file
|
|
111
114
|
tunnel.receive_file("/remote/file.txt", "/local/downloaded.txt")
|
|
112
115
|
|
|
113
|
-
# Setup passwordless SSH
|
|
114
|
-
tunnel.setup_passwordless_ssh(local_key_path="~/.ssh/id_rsa")
|
|
116
|
+
# Setup passwordless SSH with RSA
|
|
117
|
+
tunnel.setup_passwordless_ssh(local_key_path="~/.ssh/id_rsa", key_type="rsa")
|
|
115
118
|
|
|
116
119
|
# Copy SSH config
|
|
117
120
|
tunnel.copy_ssh_config("/local/ssh_config", "~/.ssh/config")
|
|
118
121
|
|
|
119
|
-
# Rotate SSH key
|
|
120
|
-
tunnel.rotate_ssh_key("/path/to/
|
|
122
|
+
# Rotate SSH key with RSA
|
|
123
|
+
tunnel.rotate_ssh_key("/path/to/new_rsa_key", key_type="rsa")
|
|
124
|
+
|
|
125
|
+
# Close the connection
|
|
126
|
+
tunnel.close()
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Using Ed25519 Keys
|
|
130
|
+
```python
|
|
131
|
+
from tunnel_manager.tunnel_manager import Tunnel
|
|
132
|
+
|
|
133
|
+
# Initialize with a remote host (assumes ~/.ssh/config or explicit params)
|
|
134
|
+
tunnel = Tunnel(
|
|
135
|
+
remote_host="192.168.1.10",
|
|
136
|
+
username="admin",
|
|
137
|
+
password="mypassword",
|
|
138
|
+
identity_file="/path/to/id_ed25519",
|
|
139
|
+
certificate_file="/path/to/cert", # Optional for Teleport
|
|
140
|
+
proxy_command="tsh proxy ssh %h", # Optional for Teleport
|
|
141
|
+
ssh_config_file="~/.ssh/config",
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Connect and run a command
|
|
145
|
+
tunnel.connect()
|
|
146
|
+
out, err = tunnel.run_command("ls -la /tmp")
|
|
147
|
+
print(f"Output: {out}\nError: {err}")
|
|
148
|
+
|
|
149
|
+
# Upload a file
|
|
150
|
+
tunnel.send_file("/local/file.txt", "/remote/file.txt")
|
|
151
|
+
|
|
152
|
+
# Download a file
|
|
153
|
+
tunnel.receive_file("/remote/file.txt", "/local/downloaded.txt")
|
|
154
|
+
|
|
155
|
+
# Setup passwordless SSH with Ed25519
|
|
156
|
+
tunnel.setup_passwordless_ssh(local_key_path="~/.ssh/id_ed25519", key_type="ed25519")
|
|
157
|
+
|
|
158
|
+
# Copy SSH config
|
|
159
|
+
tunnel.copy_ssh_config("/local/ssh_config", "~/.ssh/config")
|
|
160
|
+
|
|
161
|
+
# Rotate SSH key with Ed25519
|
|
162
|
+
tunnel.rotate_ssh_key("/path/to/new_ed25519_key", key_type="ed25519")
|
|
121
163
|
|
|
122
164
|
# Close the connection
|
|
123
165
|
tunnel.close()
|
|
124
166
|
```
|
|
125
167
|
|
|
126
168
|
## Tunnel Manager CLI Usage
|
|
127
|
-
The `tunnel_manager.py` script provides a CLI for managing SSH operations across hosts defined in an Ansible-style YAML inventory file. Below are examples for each command, targeting different inventory groups (`all`, `homelab`, `poweredge`).
|
|
169
|
+
The `tunnel_manager.py` script provides a CLI for managing SSH operations across hosts defined in an Ansible-style YAML inventory file. Below are examples for each command, targeting different inventory groups (`all`, `homelab`, `poweredge`). The CLI now supports both RSA and Ed25519 keys via the `--key-type` flag for relevant commands (default: `ed25519`).
|
|
128
170
|
|
|
129
171
|
**Inventory File Example (`inventory.yml`)**:
|
|
130
172
|
```yaml
|
|
@@ -133,7 +175,7 @@ all:
|
|
|
133
175
|
r510:
|
|
134
176
|
ansible_host: 192.168.1.10
|
|
135
177
|
ansible_user: admin
|
|
136
|
-
|
|
178
|
+
ansible_ssh_private_key_file: "~/.ssh/id_ed25519"
|
|
137
179
|
r710:
|
|
138
180
|
ansible_host: 192.168.1.11
|
|
139
181
|
ansible_user: admin
|
|
@@ -141,13 +183,13 @@ all:
|
|
|
141
183
|
gr1080:
|
|
142
184
|
ansible_host: 192.168.1.14
|
|
143
185
|
ansible_user: admin
|
|
144
|
-
|
|
186
|
+
ansible_ssh_private_key_file: "~/.ssh/id_rsa"
|
|
145
187
|
homelab:
|
|
146
188
|
hosts:
|
|
147
189
|
r510:
|
|
148
190
|
ansible_host: 192.168.1.10
|
|
149
191
|
ansible_user: admin
|
|
150
|
-
|
|
192
|
+
ansible_ssh_private_key_file: "~/.ssh/id_ed25519"
|
|
151
193
|
r710:
|
|
152
194
|
ansible_host: 192.168.1.11
|
|
153
195
|
ansible_user: admin
|
|
@@ -155,13 +197,13 @@ homelab:
|
|
|
155
197
|
gr1080:
|
|
156
198
|
ansible_host: 192.168.1.14
|
|
157
199
|
ansible_user: admin
|
|
158
|
-
|
|
200
|
+
ansible_ssh_private_key_file: "~/.ssh/id_rsa"
|
|
159
201
|
poweredge:
|
|
160
202
|
hosts:
|
|
161
203
|
r510:
|
|
162
204
|
ansible_host: 192.168.1.10
|
|
163
205
|
ansible_user: admin
|
|
164
|
-
|
|
206
|
+
ansible_ssh_private_key_file: "~/.ssh/id_ed25519"
|
|
165
207
|
r710:
|
|
166
208
|
ansible_host: 192.168.1.11
|
|
167
209
|
ansible_user: admin
|
|
@@ -173,93 +215,93 @@ Replace IPs, usernames, and passwords with your actual values.
|
|
|
173
215
|
### CLI Commands
|
|
174
216
|
|
|
175
217
|
#### 1. Setup Passwordless SSH
|
|
176
|
-
Set up passwordless SSH for hosts in the inventory, distributing a shared key.
|
|
177
|
-
- **Target `all` group (sequential)**:
|
|
218
|
+
Set up passwordless SSH for hosts in the inventory, distributing a shared key. Use `--key-type` to specify RSA or Ed25519 (default: ed25519).
|
|
219
|
+
- **Target `all` group (sequential, Ed25519)**:
|
|
178
220
|
```bash
|
|
179
|
-
tunnel-manager setup-all --inventory inventory.yml --shared-key-path ~/.ssh/id_shared --
|
|
221
|
+
tunnel-manager setup-all --inventory inventory.yml --shared-key-path ~/.ssh/id_shared --key-type ed25519
|
|
180
222
|
```
|
|
181
|
-
- **Target `homelab` group (parallel, 3 threads)**:
|
|
223
|
+
- **Target `homelab` group (parallel, 3 threads, RSA)**:
|
|
182
224
|
```bash
|
|
183
|
-
tunnel-manager setup-all --inventory inventory.yml --shared-key-path ~/.ssh/
|
|
225
|
+
tunnel-manager setup-all --inventory inventory.yml --shared-key-path ~/.ssh/id_shared_rsa --key-type rsa --group homelab --parallel --max-threads 3
|
|
184
226
|
```
|
|
185
|
-
- **Target `poweredge` group (sequential)**:
|
|
227
|
+
- **Target `poweredge` group (sequential, Ed25519)**:
|
|
186
228
|
```bash
|
|
187
|
-
tunnel-manager setup-all --inventory inventory.yml --shared-key-path ~/.ssh/id_shared --
|
|
229
|
+
tunnel-manager --log-file setup_poweredge.log setup-all --inventory inventory.yml --shared-key-path ~/.ssh/id_shared --key-type ed25519 --group poweredge
|
|
188
230
|
```
|
|
189
231
|
|
|
190
232
|
#### 2. Run a Command
|
|
191
233
|
Execute a shell command on all hosts in the specified group.
|
|
192
234
|
- **Run `uptime` on `all` group (sequential)**:
|
|
193
235
|
```bash
|
|
194
|
-
tunnel-manager run-command --inventory inventory.yml --remote-command "uptime"
|
|
236
|
+
tunnel-manager run-command --inventory inventory.yml --remote-command "uptime"
|
|
195
237
|
```
|
|
196
238
|
- **Run `df -h` on `homelab` group (parallel, 5 threads)**:
|
|
197
239
|
```bash
|
|
198
|
-
tunnel-manager run-command --inventory inventory.yml --remote-command "df -h" --group homelab --parallel --max-threads 5
|
|
240
|
+
tunnel-manager run-command --inventory inventory.yml --remote-command "df -h" --group homelab --parallel --max-threads 5
|
|
199
241
|
```
|
|
200
242
|
- **Run `whoami` on `poweredge` group (sequential)**:
|
|
201
243
|
```bash
|
|
202
|
-
tunnel-manager run-command --inventory inventory.yml --remote-command "whoami" --group poweredge
|
|
244
|
+
tunnel-manager run-command --inventory inventory.yml --remote-command "whoami" --group poweredge
|
|
203
245
|
```
|
|
204
246
|
|
|
205
247
|
#### 3. Copy SSH Config
|
|
206
248
|
Copy a local SSH config file to the remote hosts’ `~/.ssh/config`.
|
|
207
249
|
- **Copy to `all` group (sequential)**:
|
|
208
250
|
```bash
|
|
209
|
-
tunnel-manager copy-config --inventory inventory.yml --local-config-path ~/.ssh/config
|
|
251
|
+
tunnel-manager copy-config --inventory inventory.yml --local-config-path ~/.ssh/config
|
|
210
252
|
```
|
|
211
253
|
- **Copy to `homelab` group (parallel, 4 threads)**:
|
|
212
254
|
```bash
|
|
213
|
-
tunnel-manager copy-config --inventory inventory.yml --local-config-path ~/.ssh/config --group homelab --parallel --max-threads 4
|
|
255
|
+
tunnel-manager copy-config --inventory inventory.yml --local-config-path ~/.ssh/config --group homelab --parallel --max-threads 4
|
|
214
256
|
```
|
|
215
257
|
- **Copy to `poweredge` group with custom remote path**:
|
|
216
258
|
```bash
|
|
217
|
-
tunnel-manager copy-config --inventory inventory.yml --local-config-path ~/.ssh/config --remote-config-path ~/.ssh/custom_config --group poweredge
|
|
259
|
+
tunnel-manager --log-file copy_config.log copy-config --inventory inventory.yml --local-config-path ~/.ssh/config --remote-config-path ~/.ssh/custom_config --group poweredge
|
|
218
260
|
```
|
|
219
261
|
|
|
220
262
|
#### 4. Rotate SSH Keys
|
|
221
|
-
Rotate SSH keys for hosts, generating new keys with a prefix.
|
|
222
|
-
- **Rotate keys for `all` group (sequential)**:
|
|
263
|
+
Rotate SSH keys for hosts, generating new keys with a prefix. Use `--key-type` to specify RSA or Ed25519 (default: ed25519).
|
|
264
|
+
- **Rotate keys for `all` group (sequential, Ed25519)**:
|
|
223
265
|
```bash
|
|
224
|
-
tunnel-manager rotate-key --inventory inventory.yml --key-prefix ~/.ssh/id_ --
|
|
266
|
+
tunnel-manager rotate-key --inventory inventory.yml --key-prefix ~/.ssh/id_ --key-type ed25519
|
|
225
267
|
```
|
|
226
|
-
- **Rotate keys for `homelab` group (parallel, 3 threads)**:
|
|
268
|
+
- **Rotate keys for `homelab` group (parallel, 3 threads, RSA)**:
|
|
227
269
|
```bash
|
|
228
|
-
tunnel-manager rotate-key --inventory inventory.yml --key-prefix ~/.ssh/
|
|
270
|
+
tunnel-manager rotate-key --inventory inventory.yml --key-prefix ~/.ssh/id_rsa_ --key-type rsa --group homelab --parallel --max-threads 3
|
|
229
271
|
```
|
|
230
|
-
- **Rotate keys for `poweredge` group (sequential)**:
|
|
272
|
+
- **Rotate keys for `poweredge` group (sequential, Ed25519)**:
|
|
231
273
|
```bash
|
|
232
|
-
tunnel-manager rotate-key --inventory inventory.yml --key-prefix ~/.ssh/id_ --
|
|
274
|
+
tunnel-manager --log-file rotate.log rotate-key --inventory inventory.yml --key-prefix ~/.ssh/id_ --key-type ed25519 --group poweredge
|
|
233
275
|
```
|
|
234
276
|
|
|
235
277
|
#### 5. Upload a File
|
|
236
278
|
Upload a local file to all hosts in the specified group.
|
|
237
279
|
- **Upload to `all` group (sequential)**:
|
|
238
280
|
```bash
|
|
239
|
-
tunnel-manager send-file --inventory inventory.yml --local-path ./myfile.txt --remote-path /home/user/myfile.txt
|
|
281
|
+
tunnel-manager send-file --inventory inventory.yml --local-path ./myfile.txt --remote-path /home/user/myfile.txt
|
|
240
282
|
```
|
|
241
283
|
- **Upload to `homelab` group (parallel, 3 threads)**:
|
|
242
284
|
```bash
|
|
243
|
-
tunnel-manager send-file --inventory inventory.yml --local-path ./myfile.txt --remote-path /home/user/myfile.txt --group homelab --parallel --max-threads 3
|
|
285
|
+
tunnel-manager send-file --inventory inventory.yml --local-path ./myfile.txt --remote-path /home/user/myfile.txt --group homelab --parallel --max-threads 3
|
|
244
286
|
```
|
|
245
287
|
- **Upload to `poweredge` group (sequential)**:
|
|
246
288
|
```bash
|
|
247
|
-
tunnel-manager send-file --inventory inventory.yml --local-path ./myfile.txt --remote-path /home/user/myfile.txt --group poweredge
|
|
289
|
+
tunnel-manager --log-file upload_poweredge.log send-file --inventory inventory.yml --local-path ./myfile.txt --remote-path /home/user/myfile.txt --group poweredge
|
|
248
290
|
```
|
|
249
291
|
|
|
250
292
|
#### 6. Download a File
|
|
251
293
|
Download a file from all hosts in the specified group, saving to host-specific subdirectories (e.g., `downloads/R510/myfile.txt`).
|
|
252
294
|
- **Download from `all` group (sequential)**:
|
|
253
295
|
```bash
|
|
254
|
-
tunnel-manager receive-file --inventory inventory.yml --remote-path /home/user/myfile.txt --local-path-prefix ./downloads
|
|
296
|
+
tunnel-manager receive-file --inventory inventory.yml --remote-path /home/user/myfile.txt --local-path-prefix ./downloads
|
|
255
297
|
```
|
|
256
298
|
- **Download from `homelab` group (parallel, 3 threads)**:
|
|
257
299
|
```bash
|
|
258
|
-
tunnel-manager receive-file --inventory inventory.yml --remote-path /home/user/myfile.txt --local-path-prefix ./downloads --group homelab --parallel --max-threads 3
|
|
300
|
+
tunnel-manager receive-file --inventory inventory.yml --remote-path /home/user/myfile.txt --local-path-prefix ./downloads --group homelab --parallel --max-threads 3
|
|
259
301
|
```
|
|
260
302
|
- **Download from `poweredge` group (sequential)**:
|
|
261
303
|
```bash
|
|
262
|
-
tunnel-manager receive-file --inventory inventory.yml --remote-path /home/user/myfile.txt --local-path-prefix ./downloads --group poweredge
|
|
304
|
+
tunnel-manager --log-file download_poweredge.log receive-file --inventory inventory.yml --remote-path /home/user/myfile.txt --local-path-prefix ./downloads --group poweredge
|
|
263
305
|
```
|
|
264
306
|
|
|
265
307
|
### CLI Command Table
|
|
@@ -270,6 +312,7 @@ Download a file from all hosts in the specified group, saving to host-specific s
|
|
|
270
312
|
| | setup-all | Setup passwordless SSH for all hosts in inventory | Yes* | None |
|
|
271
313
|
| | --inventory | YAML inventory path | Yes | None |
|
|
272
314
|
| | --shared-key-path | Path to shared private key | No | ~/.ssh/id_shared |
|
|
315
|
+
| | --key-type | Key type (rsa or ed25519) | No | ed25519 |
|
|
273
316
|
| | --group | Inventory group to target | No | all |
|
|
274
317
|
| | --parallel | Run operation in parallel | No | False |
|
|
275
318
|
| | --max-threads | Max threads for parallel execution | No | 5 |
|
|
@@ -280,6 +323,7 @@ Download a file from all hosts in the specified group, saving to host-specific s
|
|
|
280
323
|
| | --remote-config-path | Remote path for SSH config | No | ~/.ssh/config |
|
|
281
324
|
| | rotate-key | Rotate SSH keys for all hosts in inventory | Yes* | None |
|
|
282
325
|
| | --key-prefix | Prefix for new key paths (appends hostname) | No | ~/.ssh/id_ |
|
|
326
|
+
| | --key-type | Key type (rsa or ed25519) | No | ed25519 |
|
|
283
327
|
| | send-file | Upload a file to all hosts in inventory | Yes* | None |
|
|
284
328
|
| | --local-path | Local file path to upload | Yes | None |
|
|
285
329
|
| | --remote-path | Remote destination path | Yes | None |
|
|
@@ -302,6 +346,7 @@ One of the commands (`setup-all`, `run-command`, `copy-config`, `rotate-key`, `s
|
|
|
302
346
|
- Use `--log-file` for file-based logging or omit for console output.
|
|
303
347
|
- The `--parallel` option speeds up operations but may overload resources; adjust `--max-threads` as needed.
|
|
304
348
|
- The `receive-file` command saves files to `local_path_prefix/<hostname>/<filename>` to preserve original filenames and avoid conflicts.
|
|
349
|
+
- Ed25519 keys are recommended for better security and performance over RSA, but RSA is supported for compatibility with older systems.
|
|
305
350
|
|
|
306
351
|
## FastMCP Server
|
|
307
352
|
The FastMCP server exposes the `Tunnel` functionality as AI-accessible tools. Start the server with:
|
|
@@ -335,14 +380,18 @@ Configure `mcp.json`
|
|
|
335
380
|
"tunnel_manager_mcp"
|
|
336
381
|
],
|
|
337
382
|
"env": {
|
|
338
|
-
"TUNNEL_REMOTE_HOST": "
|
|
383
|
+
"TUNNEL_REMOTE_HOST": "192.168.1.12", // Optional
|
|
339
384
|
"TUNNEL_USERNAME": "admin", // Optional
|
|
340
|
-
"TUNNEL_PASSWORD": "",
|
|
341
|
-
"TUNNEL_REMOTE_PORT": "22",
|
|
342
|
-
"TUNNEL_IDENTITY_FILE": "",
|
|
343
|
-
"
|
|
344
|
-
"
|
|
345
|
-
"
|
|
385
|
+
"TUNNEL_PASSWORD": "", // Optional
|
|
386
|
+
"TUNNEL_REMOTE_PORT": "22", // Optional
|
|
387
|
+
"TUNNEL_IDENTITY_FILE": "", // Optional
|
|
388
|
+
"TUNNEL_INVENTORY": "~/inventory.yaml", // Optional
|
|
389
|
+
"TUNNEL_INVENTORY_GROUP": "all", // Optional
|
|
390
|
+
"TUNNEL_PARALLEL": "true", // Optional
|
|
391
|
+
"TUNNEL_CERTIFICATE": "", // Optional
|
|
392
|
+
"TUNNEL_PROXY_COMMAND": "", // Optional
|
|
393
|
+
"TUNNEL_LOG_FILE": "~/tunnel_log.txt", // Optional
|
|
394
|
+
"TUNNEL_MAX_THREADS": "6" // Optional
|
|
346
395
|
},
|
|
347
396
|
"timeout": 200000
|
|
348
397
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tests/test_tunnel.py,sha256=Dj6z1EM50uGqEJA0GBDP6L8ZPUMRAJNT7dAnwkuSgNU,2461
|
|
2
|
+
tunnel_manager/__init__.py,sha256=cqAitAkoCcEkaCQcP7Y8tngiUK7pU6SIMlmpABShh9g,807
|
|
3
|
+
tunnel_manager/__main__.py,sha256=Z1uxNLjwIjJpvu97bXrvsawnghJScA52E2wtAgg5MLo,152
|
|
4
|
+
tunnel_manager/tunnel_manager.py,sha256=DZn2Zs0OPxB_2wWqkro--UbFLdoe8kivaeLvKZKWANM,39384
|
|
5
|
+
tunnel_manager/tunnel_manager_mcp.py,sha256=_TVDIH7fZpNsADbCKpMU8uzTUU41l9YqKNuK6dvaxl4,76157
|
|
6
|
+
tunnel_manager-1.0.1.dist-info/licenses/LICENSE,sha256=Z1xmcrPHBnGCETO_LLQJUeaSNBSnuptcDVTt4kaPUOE,1060
|
|
7
|
+
tunnel_manager-1.0.1.dist-info/METADATA,sha256=ky7DsUsho_CrI18mKDvvY74aE-L29tcJiI1jwkdg89w,20683
|
|
8
|
+
tunnel_manager-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
tunnel_manager-1.0.1.dist-info/entry_points.txt,sha256=hYtm4jvOAew8CbeqqUBH2nXY51mSQwhF4GhU0yclV6c,154
|
|
10
|
+
tunnel_manager-1.0.1.dist-info/top_level.txt,sha256=W4J-lyPPNeOS696f0LneZsP2MVERR8HE9UHbAFQ550A,21
|
|
11
|
+
tunnel_manager-1.0.1.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
tests/test_tunnel.py,sha256=_IYZ4XnTgJckdigi6kWm2g0omnNvMGyCXpTwPOjVrow,2500
|
|
2
|
-
tunnel_manager/__init__.py,sha256=cqAitAkoCcEkaCQcP7Y8tngiUK7pU6SIMlmpABShh9g,807
|
|
3
|
-
tunnel_manager/__main__.py,sha256=Z1uxNLjwIjJpvu97bXrvsawnghJScA52E2wtAgg5MLo,152
|
|
4
|
-
tunnel_manager/tunnel_manager.py,sha256=0CQ9N7l3hB3QawNA5AB1G55NRtV-c5Mq1c56EQQtt3c,35026
|
|
5
|
-
tunnel_manager/tunnel_manager_mcp.py,sha256=lcjmsuT4H3rhGVj-X8IyYINCPcKZ559K0iYiaK8iKfw,57419
|
|
6
|
-
tunnel_manager-1.0.0.dist-info/licenses/LICENSE,sha256=Z1xmcrPHBnGCETO_LLQJUeaSNBSnuptcDVTt4kaPUOE,1060
|
|
7
|
-
tunnel_manager-1.0.0.dist-info/METADATA,sha256=62UzKmIayq1M6IUO73g9P49_7ivVkpqEnPov9IV3YYc,18280
|
|
8
|
-
tunnel_manager-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
tunnel_manager-1.0.0.dist-info/entry_points.txt,sha256=hYtm4jvOAew8CbeqqUBH2nXY51mSQwhF4GhU0yclV6c,154
|
|
10
|
-
tunnel_manager-1.0.0.dist-info/top_level.txt,sha256=W4J-lyPPNeOS696f0LneZsP2MVERR8HE9UHbAFQ550A,21
|
|
11
|
-
tunnel_manager-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|