Skip to main content

Python implementation of SSH No Ports daemon

Project description

The Atsign Foundation

GitHub License PyPI version SLSA 3

SSHNPD Python (beta)

SSH No Ports provides a way to ssh to a remote linux host/device without that device or the client having any open ports (not even 22) on external interfaces. All network connectivity is outbound and there is no need to know the IP address the device has been given. As long as the device and client has an IP address (public or private 1918), DNS and Internet access, you will be able to connect to it.

This version is SSHNP Daemon written in Python, it is still in its beta stage of developement.

Prerequisites

SSHNPD Python requires the following:

  • Python 3.10 or later on a system where the following packages containing native code are available[1]:
    • bcrypt
    • cffi
    • charset-normalizer
    • cryptography
  • Two atSigns, one for the client and one for the device
    • The device atSign keys file should be placed in ~/.atsign/keys
  • An sshd bound to (at least) localhost
    • Port 22 is the assumed default, but can be overridden

[1] A common problem with installation is that native packages for a given architecture or libc aren't available. Pip will then download the source and try to compile that, which usually fails because the required toolchain isn't present.

Installation

This package can be installed from PyPI with:

pip install sshnpd

Though some systems will need pip3 rather than pip:

pip3 install sshnpd

Python virtual environments (venv)

Recent Linux distributions such as Debian 12 and derivatives (including Ubuntu 24.04 and Rapberry Pi OS 'Bookworm') no longer allow the installation of packages from PyPI into the system Python. It's therefore necessary to use a virtual environment (venv).

First ensure that pip and the venv module are available:

sudo apt install -y python3-pip python3-venv

Then create and activate a venv:

python3 -m venv sshnpd
. sshnpd/bin/activate

The daemon can then be installed as before:

pip install sshnpd

Just remember to activate the venv first whenever using the daemon.

Installing from source

Alternatively clone this repo and from the repo root:

cd packages/python/sshnpd
pip install -r requirements.txt
pip install .

Running the daemon

sshnpd -m @{clientAtsign} -a @{deviceAtsign} -d {deviceName} -u

e.g.

sshnpd -m @zaphod -a @heartofgold -d eddie -u

Connecting to the daemon

The Python version of SSHNPD presently implements v4 functionality, so it's a little behind the Dart implementation, and the latest client needs some flags to ensure compatibility:

sshnp -f @{clientAtsign} -t @{deviceAtsign} -d {deviceName} \
-r @{rvPoint} -u {user} --no-ad --no-et

e.g.

sshnp -f @zaphod -t @heartofgold -d eddie -r @rv_am -u ubuntu --no-ad --no-et

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

sshnpd-0.4.11.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

sshnpd-0.4.11-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

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