7

SSH . SSH. .


SSH?

, SSH , , . VPN SOCKS Proxy.

: , . .

  • , . Remote Access VPN.
  • .
  • SOCKS . , . , .

SSH?

- , . , SSH , , .

. Site-to-Site VPN, .


?

, , . 65 535 , .

, . , HTTP 80 . , 80 .

, . 8080 80 . , IP 8080, 80 .

, - 2000-10000, 2000 .


. , SSH.

L. :

$ ssh -L local_port:remote_ip:remote_port user@hostname.com
$ ssh -L 8080:www.example1.com:80 example2.com

, 8080 example1.com example2.com. .


, netcat. , netcat :

$ nc -v remote_ip port_number

, "!". .

- , , SSH .


(Autossh)

, Autossh. , .

, Autossh . .

$ sudo apt-get install autossh

autossh ssh:

$ autossh -L 80:example1.com:80 example2.com
   (Autossh)

, . , . :

$ ssh -R 8080:localhost:80 geek@likegeeks.com

:

$ ssh -R remote_port:local_ip:local_port user@hostname.com

ssh -. , .

- , , SOCKS .

. , . :

$ ssh -D local_port user@hostname.com

, 1234 SSH , :

$ ssh -D 1234 geek@likegeeks.com

, , , , .


. oracale. L R .

$ ssh -L local_port_1:remote_ip:remote_port_1 -L local_port_2:remote_ip:remote_port2 user@hostname.com
$ ssh -L 8080:192.168.1.1:80 -L 4430:192.168.1.1:1521 user@hostname.com
$ ssh -R remote_port1:local_ip:local_port1 remote_port2:local_ip:local_port2 user@hostname.com

SSH lsof:

$ lsof -i | egrep '\<ssh\>'

, . IP n.

$ lsof -i -n | egrep '\<ssh\>'
 IP

, SSH . , sshd_config.

$ sudo vi /etc/ssh/sshd_config

, SSH .

PermitOpen , . IP :

PermitOpen host:port
PermitOpen IPv4_addr:port
PermitOpen [IPv6_addr]:port

AllowTCPForwarding SSH. .

AllowTCPForwarding yes #default setting
AllowTCPForwarding no #prevent all SSH port forwarding
AllowTCPForwarding local #allow only local SSH port forwarding
AllowTCPForwarding remote #allow only remote SSH port forwarding

sshd_config:

$ man sshd_config

SSH . . , SSH SOCKS , .

, SSH TCP TCP. .

VPN, - SSH , sshuttle, . Ubuntu Debian

$ sudo apt-get install sshuttle

, GitHub:

$ git clone https://github.com/sshuttle/sshuttle.git
$ cd sshuttle
$ ./setup.py install

sshuttle SSH. :

$ sudo sshuttle -r user@remote_ip -x remote_ip 0/0 vv
  SSH

Ctrl+C. sshuttle , D.

IP, :

$ curl ipinfo.io

, IP .


50% Merion Academy