SSH Port Forwarding

:)·2024년 5월 7일
0

보안 

목록 보기
7/28

SSH Port Forwarding: 터널링(포트 우회)

  • 종류: Local Port Forwarding, Remote Port Forwarding, Dynamic Port Forwarding

  • Local Port Forwarding

    • 사용 이유 → 기존 로컬에서는 B로 가는 길이 막혀있으나(다이렉트) 터널링을 통해 우회할 경우 B로 접근할 수 있음(리다이렉트)

      • 터널 여는 방법

        • putty => ssh => ternunl

          • source port 1004
            destination 10.10.10.10:22
          • 터널을 ssh로 root에 접속시 터널이 됨.
          • 이후 [localhost] 1004로 접속 시 local로 접속이 됨 → 터널이 닫힐 시 같이 닫힘
  • Remote Port Forwarding

    • 원격 터널링

      vi /etc/ssh/sshd_config
      AllowTcpForwarding yes
      GatewayPorts yes
      PermitTunnel yes

      service sshd restart firewall-cmd --permanent --add-port=4001-4005/tcp
      firewall-cmd --reload
      firewall-cmd --list-all putty => ssh => ternunl
      • Remote (10.10.10.10 port:22) → 터널


source port 10.10.10.20:4001
destination 10.10.10.20:22

  • 10.10.10.10:4001 포트로 접속

profile
:) GITHUB: https://github.com/YJ2123412

0개의 댓글