reverse_ssh_tunneling

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
reverse_ssh_tunneling [2019/08/19 03:34] – 만듦 koovreverse_ssh_tunneling [2020/05/27 04:19] (현재) koov
줄 64: 줄 64:
 192.168.1.10에서 10.20.30.40 으로 만들어 놓은 터널을 통하여 192.168.1.10에서 10.20.30.40 으로 만들어 놓은 터널을 통하여
 거꾸로 10.20.30.40에서 192.168.1.10의 sshd 로 접속 가능합니다. 거꾸로 10.20.30.40에서 192.168.1.10의 sshd 로 접속 가능합니다.
 +
 +===== Permanent Reverse Tunneling =====
 +
 +<WRAP prewrap>
 +<code vim ssh_tunnel.sh>
 +#!/bin/bash
 +DEST_PORT=10001
 +LOCAL_PORT=22
 +
 +while true; do
 + echo `date "+%F %T"` "try to connect..."
 + ssh -nNT -o TCPKeepAlive=yes -o ServerAliveInterval=240 -R $DEST_PORT:127.0.0.1:$LOCAL_PORT support@my.server
 + echo `date "+%F %T"` "restarting in 5 seconds.."
 + sleep 5
 +done
 +
 +#EOF
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap>
 +<code bash>
 +[cilent ]# ssh-keygen
 +[cilent ]# ssh-copy-id support@my.server
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap>
 +<code vim /etc/rc.d/rc.local>
 +/root/ssh_tunnel.sh &> /var/log/ssh_tunnel.log &
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap>
 +<code bash>
 +[cilent ]# chmod +x /etc/rc.d/rc.local
 +</code>
 +</WRAP>
 +
 +
 +==== autossh ====
 +
 +자동으로 설정해주는 툴로 ''autossh''라는 명령어가 있다. EPEL패키지로 제공되며 기본 RHEL 패키지에는 없다.
  
  
  • reverse_ssh_tunneling.1566185662.txt.gz
  • 마지막으로 수정됨: 2019/08/19 03:34
  • 저자 koov