Skip to main content

sshtuntap

Linux TUN/TAP using the openssh and Python3

This package comes with two command line interfaces:

  • ssh-tuntap-server
  • ssh-tuntap-client

this tutorial show's how to use this project:

Tutorial

Currently only point-to-point (tun) layer-3 tunneling is supported.

Install

You have to install this package on both client and server.

sudo -H pip3 install sshtuntap

Or

sudo -H pip3 install git+https://github.com/pylover/sshtuntap.git

Bash auto completion

ssh-tuntap-server completion install   # On server
ssh-tuntap-client completion install   # On client

Open new bash instance to perform changes.

Help?

ssh-tuntap-server --help
ssh-tuntap-client --help

Server setup

The server cli stands for setup network, add, delete and list users. this is just a utility to perform user and tuntap interface management and ip address assignment.

OpenSSH Server

Enable ssh tunneling on the server by editing the /etc/ssh/sshd_config and ensure the line:

PermitTunnel yes

Or

PermitTunnel point-to-point

see man 5 sshd_config for more info.

Restart the ssh server to perform the changes.

service ssh restart

Create Network and systemd service

sudo ssh-tuntap-server install

Or

sudo ssh-tuntap-server install 192.168.22.0/24

you may use uninstall sub-command to remove systemd service.

sudo ssh-tuntap-server uninstall

Add foo host

You have to create the server user mannualy (depends on your distro).

Here I'm using ubuntu server 18.04. and assume the server's hostname is example.com.

Run these commands on the server:

sudo adduser foo

Then use this command to create /home/foo/.ssh/tuntap.yml:

sudo ssh-tuntap-server add foo

Client

Client command line stands for fetch host configuration from the server and perform connection using the ssh -w.

ssh-copy-id foo@example.com
ssh-tuntap-client setup foo@example.com

Use this to connect:

sudo ssh-tuntap-client connect

Nat

Edit /etc/sysctl.conf on the server to enable ip forwarding.

net.ipv4.ip_forward = 1

Run sysctl -p to refresh with the new configuration

sudo sysctl -p

Configure NAT

sudo iptables -tnat -APOSTROUTING -s192.168.22.0/24 -jMASQUERADE

iptables persistency

sudo apt install iptables-persistent netfilter-persistent

Metadata

Release files for sshtuntap 2.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sshtuntap 2.0.7
File Size Uploaded Provenance
sshtuntap-2.0.7.tar.gz 8.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sshtuntap 2.0.7
File Interpreter ABI Platform
sshtuntap-2.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / sshtuntap-2.0.7.tar.gz

Download URL sshtuntap-2.0.7.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a22728096da1409fcedcf3412479f909f093818aa39285100185ee52de33cd5f
BLAKE2b-256 checksum
How to use checksums
b20114664e315ad7faa3310adcffc1651826d3a60965c73cb0c94f4142adbf4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / sshtuntap-2.0.7-py3-none-any.whl

Download URL sshtuntap-2.0.7-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
883491f0a6c5bb9b52f9660d0f449d52f0a8802b07e40613b2511532170b3a97
BLAKE2b-256 checksum
How to use checksums
f329c632b76e5967da333bcbb2fca7092361929835530767b5d3e2e27cbf791d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for sshtuntap 2.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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