https://github.com/karimsa/tnl
Reverse-tcp (over TLS) serial tunnel for remote serial administration.
https://github.com/karimsa/tnl
Last synced: 3 months ago
JSON representation
Reverse-tcp (over TLS) serial tunnel for remote serial administration.
- Host: GitHub
- URL: https://github.com/karimsa/tnl
- Owner: karimsa
- License: mit
- Created: 2017-02-22T02:54:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-25T07:45:24.000Z (over 8 years ago)
- Last Synced: 2025-03-11T21:03:58.458Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🕳️ tnl
Reverse-tcp (over TLS) serial tunnel for remote serial administration.
- [Client setup](#client-setup)
- [Server setup](#server-setup)
- [License](#license)## Usage
The tunnel requires a reverse-tcp client and a server on a personal
network.### Client setup
You'll need:
- Some sort of *nix OS
- Latest stable node.js (developed on 6.10)
- Serial to USB adapterTo setup the client, plop this repository onto your client device (I
use a raspberry pi 3). Now adjust the configuration by editing 'config.json'.
If you are using this remotely, I recommend get a [keymetrics](http://keymetrics.io)
account and [linking your client device](http://docs.keymetrics.io/docs/usage/setup/).If you don't know the vendor ID and product ID of your serial adapter off by heart,
you should plug the device in, and run `npm run devices` and you will see a list of
devices that looks something like this:```sh
$ npm run devices
[vid:pid] My Serial Adapter (/dev/cu.adapter)
```Once you figure out which one is yours, save the 'vid' and 'pid' as the `DEV_VID`
and `DEV_PID` in `config.json`.Next, you're going to want to generate SSH key & certificate pair that is unique to
your setup. To do this, go to the `ssl/` folder in this repo and run `./gen.sh`. You
will need to put your server behind some domain for the code to work and for proper SSL
verification (configure this as your `SERVER_HOST` above). It also saves you money on buying
a static IP for your network since you can just change your IP on the domain. Once you have
your keypair, keep it safe. It'll be your only means of authentication.Once you are satisfied with your config, run `npm install && npm start` which
should install your dependencies and get the client running via pm2. You can confirm
that the client started successfully by running `npm run monit` and your script should
be visible. Don't worry aboutt the errors that show up in the log, they're expected.*Once you spin up the client, you may wish to configure it to run on startup. This can
be done via pm2. Simply run `npm run startup`.*### Server setup
You'll need:
- Any OS should do (though why would you want to use Windows?)
- Latest stable node.js (developed on 6.10)
- Network access
- Control over your network (i.e. admin access to your router)First, setup your network so that port `8093` (or whatever port you configured above)
is accessible publicly. If you have no idea what this means, you need to setup port
forwarding on your router. If you know what you're doing, DMZ zones and connecting to
your modem are fine too (I'm not responsible for what other ports you leave open).Next, grab your public IP and setup the DNS of your domain to resolve properly.
You can now clone the repo locally, as long as you copy `ssl/client.crt` from your client
device to your server. Grab the dependencies by running `npm install`. Whenever you'd like
to connect to your serial device, simply run `node server`.*Note: Before each run of `node server`, you can edit the local `config.json` file to change
your serial settings like baud rate and parity. These options are not read from file on the client,
they're sent when you connect. So don't worry if you have to make changes on the fly.*## License
Licensed under [MIT license](LICENSE).
Copyright © 2017 Karim Alibhai.