개발/linux & tools

ssh proxy, ssh local fowarding

조앙'ㅁ' 2018. 3. 20. 23:43
임의로 98765 포트에 proxy용 ssh server을 띄운다.

/etc/ssh/sshd_config 
Port 22
Port 98765
GatewayPorts yes
PermitTunnel yes
AllowTcpForwarding yes

재시작
sudo service sshd restart

local machine:~/.ssh/config
Host ssh-proxy-server
  User {username}
  GSSAPIAuthentication yes
  StrictHostKeyChecking no
Host !ssh-proxy-server *
  User {username}
  StrictHostKeyChecking no
  GSSAPIAuthentication yes
  ForwardAgent yes
  ProxyCommand ssh -W %h:%p ssh-proxy-server -p 98765 %h -p %p

ssh local fowarding

ssh -L {local port}:{remote server}:{remote port} {ssh-proxy-server}
ex: ssh -L 18032:remote-server:80 ssh-proxy-server