Skip to main content

Full-featured SSH tunnel & Cloudflare DNS management library and CLI

Project description

tunnelmate

🚀 A robust SSH tunnel and automatic Cloudflare DNS management library & CLI

Easily create, manage, and auto-reconnect SSH tunnels—with automatic SSH key generation and seamless Cloudflare CNAME linking. Use as a Python library or a lightning-fast CLI tool.


Installation

pip install .

CLI Usage

tunnelmate \
  --tunnel localhost:3000:my-app.example.com \
  --cf-zone-id <ZONE_ID> \
  --cf-api-token <API_TOKEN>

The tool will generate an SSH key if not already present and prints the public key to add to your destination server.


Library Usage

from tunnelmate.core import SSHTunnel

tunnels = [
    {"local_host": "localhost", "local_port": 3000, "subdomain": "my-app.example.com"},
]

t = SSHTunnel(
    tunnels=tunnels,
    key_path="/root/.ssh/id_ed25519"
)
t.run_tunnel()

Features

  • Autogenerates SSH keys if not found, and prints your public key.
  • Automatic reconnection if the tunnel closes.
  • Accepts all configuration—ports, hosts, Cloudflare API and DNS details—from CLI, environment, or YAML.
  • Live logs and easy-to-use interface for managing as many tunnels as you want.
  • CLI and Python API both supported.
  • Clean, maintainable code—ready to extend or integrate.

Cloudflare CNAME Update Example (Python):

from tunnelmate.cloudflare import update_cname

resp = update_cname(
    zone_id="yourZoneId",
    api_token="yourToken",
    subdomain="my-app.example.com",
    content="target.example.com"
)
print(resp)

Folder structure

ssh_tunneler/
  core.py         # Tunnel and key handling core logic
  cli.py          # Command-line interface (entrypoint)
  config.py       # Loading config from yaml/env
  cloudflare.py   # Cloudflare DNS API routines
  ssh_utils.py    # SSH key/tool helpers
  __init__.py
setup.py
README.md

Developed by Parsa Lakzian
Architected by Tara AI

Project details


Download files

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

Source Distribution

tunnelmate-1.0.9.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

tunnelmate-1.0.9-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tunnelmate-1.0.9.tar.gz.

File metadata

  • Download URL: tunnelmate-1.0.9.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tunnelmate-1.0.9.tar.gz
Algorithm Hash digest
SHA256 27a6c5203f8f045cd2ce37eabeb46064b64ee2f67e4d5296f31cc3d16fdc9c62
MD5 ee9a43d0c67b0d80e534a23dfd5aa1ad
BLAKE2b-256 a0a7e0e3e09d4da0f7c53ae552ed285c991b6d3efb47c1ca8f66c84b060333cd

See more details on using hashes here.

File details

Details for the file tunnelmate-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: tunnelmate-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tunnelmate-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6df4cf06f8798cb916e515e606a1f6fdbf78f80cb1c730acb8d7e2e467fd7043
MD5 e50fa28dfff9b812f85dc8625f6bc932
BLAKE2b-256 855805d9e54713fa837af12cc6fa7b022dc29b81f7dc79a7912e3024183070fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page