An stunnel like program that utilizes the Noise protocol.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
John-Mark Gurney c47d74f353 make -m ntunnel work, and use that now that we've made ntunnel into 5 years ago
ntunnel make -m ntunnel work, and use that now that we've made ntunnel into 5 years ago
.gitignore first code that implements a simple echo server for noise in twisted 5 years ago
LICENSE.txt add license text.. 5 years ago
Makefile Turn this into a proper python module using setup.py... 5 years ago
NOTES.md first code that implements a simple echo server for noise in twisted 5 years ago
README.md make -m ntunnel work, and use that now that we've made ntunnel into 5 years ago
makemessagelengths.py include the program used to generate the handshake message lengths 5 years ago
requirements.txt Turn this into a proper python module using setup.py... 5 years ago
setup.py Turn this into a proper python module using setup.py... 5 years ago
twistednoise.py last bit of work on the twisted version before I stopped... 5 years ago

README.md

ntunnel

The ntunnel program is designed to tunnel Unix domain sockets over TCP, using the Noise Protocol. The goal is to be secure and simple to use and setup. Due to the flexibility, it can forward any standard stream socket to another stream socket, including TCP sockets.

Example

Generate the keys:

python -m ntunnel genkey serverkey
python -m ntunnel genkey clientkey

Create the target for the pass through:

nc -lU finalsock

Start the server and client:

python -m ntunnel server serverkey unix:$(pwd)/servsock unix:$(pwd)/finalsock
python -m ntunnel client clientkey serverkey.pub unix:$(pwd)/clientsock unix:$(pwd)/servsock

Attach to the client:

nc -U clientsock

Now when you type text into either of the nc windows, you should see the same text come out the other side.

Running Tests

Currently ntunnel requires Python 3.7 or later. If the default virtualenv is not 3.7 or later, you can set the VIRTUALENV variable to specify which one to use, such as: make env VIRTUALENV=virtualenv-3.7

If you want to use an alternate version of python, you can specify VIRTUALENVARGS, such as: make env VIRTUALENV=virtualenv-3.7 VIRTUALENVARGS="-p $(which pypy3)"

Note that I have not been able to test this w/ pypy3, as when compiling the cryptography libraries, it would pick the wrong ones, despite setting CFLAGS and LDFLAGS.

Known Issues

  • Code coverage appears to be worse than it is. When launching the subprocesses, their coverage does not get measured. Patches to fix this would be greatly appreciated.
  • Possible memory leak for each connection Error message is: Task exception was never retrieved See the commented out assertion at the end of test_clientkeymismatch

TODO/Future Features

  • DoS protection. Limiting number of connections. Limit resource consumption by opening connection and starting negotiation but not completing it, etc.
  • Select forwarding destination based upon client key.