Skip to main content

cloudmesh-ai-ssh

cloudmesh-ai-ssh is a professional SSH management extension for the Cloudmesh AI ecosystem. It provides a high-level Python API and CLI tools for managing SSH tunnels, configuration files, authorized keys, and RSA encryption, designed specifically for AI agents and cloud automation.

🚀 Key Features

  • AI-Powered Config Repair: Automatically diagnose malformed ~/.ssh/config entries and submit them to a vLLM server for expert AI-driven repair suggestions.

  • Advanced Tunneling: Create and manage SSH port-forwarding tunnels with automatic lifecycle management and aggressive "force-stop" cleanup.

  • SSH Config Management: Programmatically read, modify, and generate ~/.ssh/config entries with a rich CLI list view.

  • Secure File Transfer: High-level wrappers for SFTP uploads and downloads via Fabric.

  • Key Management: Manage authorized_keys files and generate public key fingerprints.

  • RSA Encryption: Encrypt and decrypt files using RSA keys via OpenSSL.

  • Robust Error Handling: A dedicated exception hierarchy for precise error catching in automation pipelines.

📦 Installation

pip install .

🛠 Quick Start

CLI Usage

The cmc ssh command group provides a convenient way to manage tunnels from the terminal.

Create a tunnel:

# Format: cmc ssh tunnel "SSH_HOST:REMOTE_PORT"
cmc ssh tunnel "my-server:8000"

This creates a tunnel from localhost:8000 $\rightarrow$ localhost:8000 via my-server.

Advanced tunnel options:

cmc ssh tunnel "my-server:8000" --local-port 9000 --remote-host "db-internal.local" --ssh-user "admin"

List SSH Hosts (with details):

cmc ssh list

Displays a rich table of all hosts, their hostnames, users, and detailed configuration options.

Diagnose and Repair Config with AI:

# Uses default vLLM server (localhost:17704) and master key from ~/gemma/server_master_key.txt
cmc ssh check ai

# Specify a custom vLLM server and API key
cmc ssh check ai --url http://ai-server:17704 --api-key YOUR_API_KEY

Detects syntax errors in your SSH config and provides an AI-generated corrected version.

List SSH Hosts (with details):

cmc ssh list

Displays a rich table of all hosts, their hostnames, users, and detailed configuration options.

Diagnose and Repair Config with AI:

# Uses default vLLM server (localhost:17704) and master key from ~/gemma/server_master_key.txt
cmc ssh check ai

# Specify a custom vLLM server and API key
cmc ssh check ai --url http://ai-server:17704 --api-key YOUR_API_KEY

Detects syntax errors in your SSH config and provides an AI-generated corrected version.

Python API Usage

1. SSH Tunneling

from cloudmesh.ai.ssh.tunnel import Tunnel

# Using the context manager for automatic cleanup
with Tunnel(local_port=8080, remote_host="localhost", remote_port=80, ssh_host="jump-box") as tunnel:
    print("Tunnel is active! Access the remote service at http://localhost:8080")
    # Your application logic here

2. SSH Configuration

from cloudmesh.ai.ssh.ssh_config import SSHConfig

cfg = SSHConfig()
# Generic generation: no more hardcoded defaults!
cfg.generate(host="my-server", hostname="1.2.3.4", user="ubuntu")
print(f"Hosts defined in config: {cfg.names()}")

3. RSA Encryption

from cloudmesh.ai.ssh.encryption import SSHEncryption

enc = SSHEncryption(file_in="secrets.txt", file_out="secrets.enc")
enc.pem_create() # Create public PEM from private key
enc.encrypt()    # Encrypt the file
enc.decrypt()    # Decrypt the file

📚 Documentation

For detailed technical information, please visit the API Reference and Usage Guides.

⚙️ Core Dependencies

This project is part of the Cloudmesh AI ecosystem and depends on:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudmesh_ai_ssh-0.1.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file cloudmesh_ai_ssh-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudmesh_ai_ssh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c29b40987f14582d12f96429380c7051a6b2e1a2ab79208ae2bcfefe9b9b0709
MD5 cef685ce3a1ee7e55616a550099b3b57
BLAKE2b-256 c7fd8813973c30d5fd2b2369ee1232e85ea2b2f253c3a98054df6ebe0edda0d5

See more details on using hashes here.

Release history Release notifications | RSS feed

7.1.11

1 file

7.1.9

1 file

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page