All Projects → riotkit-org → tunman

riotkit-org / tunman

Licence: other
Comprehensive solution for SSH tunnels - respawning, healthchecking/monitoring

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to tunman

Lanproxy
lanproxy是一个将局域网个人电脑、服务器代理到公网的内网穿透工具,支持tcp流量转发,可支持任何tcp上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面、http代理、https代理、socks5代理...)。技术交流QQ群 678776401
Stars: ✭ 4,784 (+11025.58%)
Mutual labels:  tunnel, firewall, nat, reverse-proxy
Frp
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Stars: ✭ 51,746 (+120239.53%)
Mutual labels:  tunnel, firewall, nat, reverse-proxy
Frpc Android
Android,安卓版frpc,一个快速反向代理,可帮助您将NAT或防火墙后面的本地服务器暴露给Internet。
Stars: ✭ 205 (+376.74%)
Mutual labels:  tunnel, firewall, nat
Fasttunnel
NAT 内网穿透 远程内网计算机 域名访问内网站点 反向代理内网服务 花生壳 端口转发 http代理 微信 小程序 expose a local server behind a NAT or firewall to the internet like ngrok and frp. NAT ssh proxy tunnel reverse-proxy
Stars: ✭ 248 (+476.74%)
Mutual labels:  tunnel, nat, reverse-proxy
nat-tunnel
NAT Tunnel: to effortlessly serve from behind NAT
Stars: ✭ 75 (+74.42%)
Mutual labels:  tunnel, nat, port-forwarding
Wireguard Docs
📖 Unofficial WireGuard Documentation: Setup, Usage, Configuration, and full example setups for VPNs supporting both servers & roaming clients.
Stars: ✭ 3,201 (+7344.19%)
Mutual labels:  tunnel, nat, vpn
Nps
一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
Stars: ✭ 19,537 (+45334.88%)
Mutual labels:  tunnel, firewall, nat
Spike
📣 A fast reverse proxy written in PHP that helps to expose local services to the internet
Stars: ✭ 582 (+1253.49%)
Mutual labels:  tunnel, nat, reverse-proxy
Mr2
Mr.2 can help you expose local server to external network. Support both TCP/UDP, of course support HTTP. Zero-Configuration.
Stars: ✭ 1,102 (+2462.79%)
Mutual labels:  tunnel, firewall, nat
Tcptunnel
将本地内网服务器映射到公网。
Stars: ✭ 72 (+67.44%)
Mutual labels:  tunnel, nat, reverse-proxy
Sidedoor
SSH connection daemon for Debian/Raspbian/Ubuntu/etc
Stars: ✭ 97 (+125.58%)
Mutual labels:  tunnel, nat, reverse-proxy
anytunnel
内网穿透,内网穿透代理服务器,商用内网穿透代理系统,内网穿透平台,内网穿透多用户会员系统。
Stars: ✭ 115 (+167.44%)
Mutual labels:  tunnel, nat, reverse-proxy
FastTunnel
expose a local server to the internet. 高性能跨平台的内网穿透解决方案 远程内网计算机 域名访问内网站点 反向代理内网服务 端口转发 http代理
Stars: ✭ 815 (+1795.35%)
Mutual labels:  tunnel, nat, reverse-proxy
Ahri
Ahri is an intranet sharing tool. Like VPN
Stars: ✭ 205 (+376.74%)
Mutual labels:  tunnel, firewall, vpn
Vpnfailsafe
IP leak prevention for OpenVPN
Stars: ✭ 130 (+202.33%)
Mutual labels:  firewall, routing, vpn
Core
OPNsense GUI, API and systems backend
Stars: ✭ 1,827 (+4148.84%)
Mutual labels:  firewall, routing, vpn
rconn
rconn is a multiplatform program for creating generic reverse connections. Lets you consume services that are behind firewall or NAT without opening ports or port-forwarding.
Stars: ✭ 231 (+437.21%)
Mutual labels:  reverse-proxy, port-forwarding, firewall-bypass
Vycontrol
vyos frontend
Stars: ✭ 92 (+113.95%)
Mutual labels:  firewall, nat, vpn
Docker Host
A docker sidecar container to forward all traffic to local docker host or any other host
Stars: ✭ 769 (+1688.37%)
Mutual labels:  tunnel, firewall, nat
edgevpn
⛵ The immutable, decentralized, statically built p2p VPN without any central server and automatic discovery! Create decentralized introspectable tunnels over p2p with shared tokens
Stars: ✭ 223 (+418.6%)
Mutual labels:  tunnel, nat, vpn

TunMan

Maintainability Test Coverage Build Status

Network setup automation and supervising. Provides monitoring, health checking, validating the connection with custom Python methods. Replaces old, slow maintained autossh.

Super-elastic, allows for dynamic IP resolving on local and remote using Python callback functions. It means you can achieve totally everything.

Allows to create multiple tunnels from inside of NAT to the external server, and vice-versa.

Works in at least those cases:

  • #1: Can expose a NAT hidden service to the external server (or to the internet via external server)
  • #2: Can encrypt a connection with external server by adding SSH layer (eg. MySQL replication with external server with SSH encryption layer)
  • #3: Can expose local hidden service to the remote server
  • #4: Can forward remote services hidden in docker containers (eg. connecting to some_ssh_1 and forwarding some_db_1:3306 to localhost from remote)

TunMan's motto is: Be bulletproof! Switch to VPN, switch from WiFi to LTE, hibernate computer in Poland - wake up in Spain, cut off the internet for a few hours. Nothing matters, it should work when you go back online!

screenshot

example structure

Note: The project was renamed from "reverse-networking" into TunMan from 3.0.0 release

Requirements

Those very basic packages needs to be installed:

  • Bash
  • Pipenv
  • Python 3.5+
  • autossh (optional, can be used additionally, not recommended)
  • sshpass (if you use passwords)
  • docker (optional, if you want to run TunMan in a docker container)

Development packages for development:

  • tox
  • unittest-data-provider

Works with GNU utils as well as with Busybox. Tested on Arch Linux, Debian and Alpine Linux.

The preferred way of authorization with remote is key based authorization

Installing

You may want to use docker or baremetal installation.

Baremetal installation

git clone [email protected]:riotkit-org/reverse-networking.git -b v3.1.0-rc2 # change "v3.1.0-rc2" to some version
cd reverse-networking

sudo ./setup.py install

Installing from PIP

sudo pip3 install tunman

Setup

Put your configuration files into conf.d of a directory you specified as configuration directory (-c or --config param, /conf.d docker volume) Please check out the example/scenario-* directories for example configuration directories.

1. File must be written in Python syntax
2. You can import any library you have in system or in docker container, including "paramiko" and "subprocess"
3. You can use any shell commands available in the shell ex. mysql or psql in the configuration callbacks

Send public key to all servers described in your configuration so the communication could be without a password using a ssh key.

Configure and start:

# you can use command-line switches ex. "--config" or environment variables
export TUNMAN_CONFIG="path-to-config-directory"   # -c / --config
export TUNMAN_SECRET_PREFIX=""                    # -s / --secret-prefix
export TUNMAN_ENV="prod"                          # -e / --env

tunman add-to-known-hosts
tunman send-public-key
tunman start

That's all! Your local services should be exposed to the remote server and be visible on eg. http://localhost:1234, so you need an internal proxy or a load balancer like nginx to forward the traffic to the internet.

Health checking and status monitoring

Health check:

curl http://localhost:8015/health

HTML status page: http://localhost:8015/

Notice: The URL can be prefixed with (-s/--secret-prefix/TUNMAN_SECRET_PREFIX) ex. http://localhost/some-secret-prefix/health

Using with Docker

Notice: It's recommended to use a stable version ex. v3.1.0-x86_64 instead of latest-dev-x86_64. For demo reasons you may want to check out latest-dev-x86_64

Please check out a list of available tags there: https://quay.io/repository/riotkit/reverse-networking?tab=tags

version: "2"
services:
    proxy:
        image: quay.io/riotkit/reverse-networking:latest-dev-x86_64
        volumes:
            - "./configuration:/config:ro"   # see example directory structure in "example/scenario-*" directories
            - "./id_rsa:/id_rsa:ro"          # a place for your private key, you may pick other one and point to it in the configuration
            - "./id_rsa.pub:/id_rsa.pub:ro"
        environment:
            - TUNMAN_SECRET_PREFIX=
            - TUNMAN_ENV=prod

Docker container configuration reference

List of all environment variables that could be used.

- TUNMAN_CONFIG # (default: /config)

# Environment, options: dev, prod
- TUNMAN_ENV # (default: prod)

# Secret prefix in the URL ex. https://your-app.org/super-hiper-secret-here/health
- TUNMAN_SECRET_PREFIX # (default: )

Example configuration

Please check the example directory for examples.

Variables table

Often you do not know on which IP address is the docker container, or interface listening. TunMan allows to retrieve dynamic values using variables.

You can use variables instead of ex. host name

Variable Description
{{ remote_gw }} IP address of ssh destination host
{{ remote_interface_gw }} IP address of a interface that is a default gateway in route table on remote SSH
{{ remote_docker_host }} Autodetected docker host IP address (local bridge)
{{ remote_docker_container }} If SSH server is containerized, then it will point to a IP address of a container
{{ remote_interface_eth0 }} eth0 interface ip address
{{ remote_interface_eth1 }} eth1 interface ip address
{{ remote_interface_eth2 }} eth2 interface ip address

FAQ

  1. Cannot connect to SSH, invalid key or unsupported key type
paramiko.ssh_exception.SSHException: Invalid key
paramiko.ssh_exception.SSHException: not a valid OPENSSH private key file

It is a common problem in Paramiko library, that we use. Generate the key using a different format, examples:

ssh-keygen -t ed25519 -b 4096

More documentation

See here: docs/pages

Configuration reference

For list of all possible options to use in configuration file please check example configuration file.

Here: example/reference.py

Developing

  • The docker container is built on quay.io and hub.docker com
  • When you start working on it locally, at first run make dev@develop to install git hooks
  • README.md is automatically generated from README.md.j2, do not edit the generated version!
  • Use make for building, pushing, etc.

Project Keywords

tunneling, ssh tunnel restart, autossh, sshpass, autorestart tunnel, ssh proxy, expose service behind nat, revproxy, how to tunnel mysql, tunnel manager, tunnel supervisor, tunnel monitoring, ssh monitoring, ssh automation, ssh setup automation, access service behind nat, nginx through ssh

Copyleft

Created by RiotKit Collective, a libertarian, grassroot, non-profit organization providing technical support for the non-profit Anarchist movement.

Check out those nice non-profit initiatives we are friends with:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].