Friday, March 15, 2019

SSH Skip port forwarding


Instant terminal sharing
https://tmate.io/


Share your UNIX terminal in seconds!
https://www.teleconsole.com/

Share local machine port to public access
https://serveo.net/
https://github.com/milio48/serveo
$wget https://raw.githubusercontent.com/milio48/serveo/master/serveo.sh 

$./serveo.sh tcp 5432 0

vs ngrok
Serveo is an excellent alternative to ngrok. Serveo was inspired by ngrok and attempts to serve many of the same purposes. The primary advantage of Serveo over ngrok is the use of your existing SSH client, so there's no client application to install.

Other slight advantages include preservation of URLs across reconnect for free (ngrok allows this only for paid accounts) and in-terminal request inspection and replay (ngrok uses a web interface).

vs OpenSSH

Using Serveo instead of OpenSSH frees you from having to configure and maintain a server. It also handles HTTPS and subdomain generation, two features that complicate a typical SSH port-forwarding setup.

Apache Guacamole is a clientless remote desktop gateway


http://guacamole.apache.org/


Manual mode (A like to connect to B)

PCA ----+----  PCB
            |
          PCX

Server Side (PCX Need root permission)

$sudo vi /etc/ssh/sshd_config

AllowTcpForwarding yes
GatewayPorts yes


$sudo firewall-cmd --add-port=7004/udp [--permanent]
$sudo firewall-cmd --add-port=7004/tcp [--permanent]

Target PCB

$ssh -f -N -R 7004:127.0.0.1:22 -l user_PCX -p port PCX(ip/domain name)
This means open port 7004 on PCX forwarding to port 22, PCX will start to listen on port 7004.

Source PCA
$ssh PCX(ip/domain name) -l user_PCB -p 7004

Enjoy!



References:
[1] https://rootsaid.com/ssh-without-port-forwarding/
[2] https://linuxhint.com/ssh-port-forwarding-linux/
[3] https://dev.to/samuyi/the-how-to-of-ssh-port-forwarding-1f4e



No comments:

Ubuntu Forware port 80

  #!/bin/bash iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8069 iptables -t nat -A PREROUTING -i eth0 -p tc...