longcongduoi / rtty

Access your terminal behind a NAT or firewall over the web based on your terminal's macaddr.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rtty(中文)

license PRs Welcome Issue Welcome Release Version Build Status

Access your terminal behind a NAT or firewall over the web based on your terminal's macaddr.

It is composed of the client and the server. The server is written in go language and uses the vue+iview. You can access any of your terminals through a web browser based on the device ID you set(If the ID is not set, the MAC address of the device is used).

rtty is very suitable for remote maintenance your or your company's thousands of Linux devices deployed around the world.

Keep Watching for More Actions on This Space

For your security, it is strongly recommended that you use SSL

Features

  • Simple to deployment and easy to use
  • Reverse Proxy
  • Connect your device according to the ID you set up
  • Fully-featured terminal based on Xterm.js
  • SSL support: openssl, mbedtls, CyaSSl(wolfssl)
  • Support upload file to device
  • Support download file from devices
  • Support Execute a command remote
  • Cross platform: Linux, OpenWrt/LEDE

Dependencies for Client side

  • libubox - C utility functions for OpenWrt, but can also be used for the same purposes in other Linux systems. Reference
  • libuwsc - A Lightweight and fully asynchronous WebSocket client C library based on libubox for Embedded Linux.
  • ustream-ssl - If you need to support SSL
  • mbedtls - If you choose mbedtls as your SSL backend
  • CyaSSl(wolfssl) - If you choose wolfssl as your SSL backend
  • openssl - If you choose openssl as your SSL backend

How to build and install the Client - rtty

For Linux distribution, such as Ubuntu and Centos

Install build tools

sudo apt install gcc cmake git      # For Ubuntu

yum install gcc cmake git           # For Centos

Install dependent packages

sudo apt install libjson-c-dev      # For Ubuntu

sudo apt install json-c-devel       # For Centos

git clone https://git.openwrt.org/project/libubox.git
cd libubox && cmake -DBUILD_LUA=OFF . && sudo make install

git clone https://git.openwrt.org/project/ustream-ssl.git
cd ustream-ssl && cmake . && sudo make install

git clone https://github.com/zhaojh329/libuwsc.git
cd libuwsc && cmake . && sudo make install

Install RTTY

git clone https://github.com/zhaojh329/rtty.git
cd rtty && cmake . && sudo make install

Run RTTY Replace the following parameters with your own parameters

sudo rtty -I 'My-device-ID' -h 'your-server' -p 5912 -a -v -s -d 'My Device Description'

Query online devices

curl -k https://your-server:5912/devs
[{"id":"My-device-ID","description":"My device"}]

For Embedded Linux Platform

You need to cross compiling by yourself

For OpenWRT

Install

opkg update
opkg list | grep rtty
opkg install rtty-nossl

If the install command fails, you can compile it yourself.

Configuring the server parameter

uci add rtty rtty   # If it's the first configuration
uci set rtty.@rtty[0].host='your server host'
uci set rtty.@rtty[0].port='your server port'

You can customize an ID for your device. If the ID is not configured, RTTY will use the MAC address of the specified network interface as the ID. The format of the MAC address as the ID is: 1A2A3A4A5A6A

uci set rtty.@rtty[0].id='your-device-id'

You can add a description to your device

uci set rtty.@rtty[0].description='My device'

Use SSL

uci set rtty.@rtty[0].ssl='1'

Save configuration and apply

uci commit
/etc/init.d/rtty restart

Usage

Use your web browser to access your server: https://your-server-host:5912, then click the connection button

You can easily embed RTTY into your existing platform: https://your-server-host:5912?id=your-id

Automatic login: https://your-server:5912/?id=device-id&username=device-username&password=device-password

Upload file and download file

Open the context menu with the shortcut key: Ctrl+Shift+f

Execute a command remote

Shell

curl -k https://your-server:5912/cmd -d '{"devid":"test","username":"test","password":"123456","cmd":"ls","params":["/"],"env":[]}'

{"Err":0,"msg":"","code":0,"stdout":"bin\ndev\netc\nlib\nmnt\noverlay\nproc\nrom\nroot\nsbin\nsys\ntmp\nusr\nvar\nwww\n","stderr":""}

Jquery

var data = {devid: 'test', username: 'test', password: '123456', cmd: 'ls', params: ['/'], env: []};
$.post('https://your-server:5912/cmd', JSON.stringify(data), function(r) {console.log(r)});

Axios

var data = {devid: 'test', username: 'test', password: '123456', cmd: 'ls', params: ['/'], env: []};
axios.post('https://your-server:5912/cmd', JSON.stringify(data)).then(function (response) {
    console.log(response.data);
}).catch(function (error) {
    console.log(error);
});

Contributing

If you would like to help making rtty better, see the CONTRIBUTING.md file.

QQ group: 153530783

If the project is helpful to you, please do not hesitate to star. Thank you!

About

Access your terminal behind a NAT or firewall over the web based on your terminal's macaddr.

License:GNU Lesser General Public License v2.1


Languages

Language:C 92.6%Language:CMake 7.4%