프록시를 통한 양말을 사용한 포트 전달

프록시를 통한 양말을 사용한 포트 전달

다른 도메인의 한 도메인 내부 서버에서 실행되는 위키를 탐색하려고 합니다. 위키는 LAN에서만 액세스할 수 있지만 SSH 터널로 연결하는 다른 LAN에서 찾아보아야 합니다.

내 설정과 지금까지 수행한 단계는 다음과 같습니다.

~.ssh/confingwikihost:

Host gateway
  User kisteuser
  Port 443
  Hostname gateway.companydomain.com
  ProxyCommand /home/myuser/bin/ssh-https-tunnel %h %p
  # ssh-https-tunnel:
  # http://ttcplinux.sourceforge.net/tools/stunnel
  Protocol 2
  IdentityFile ~/.ssh/key_dsa
  LocalForward 11069 localhost:11069

Host server1
  User kisteuser
  Hostname localhost
  Port 11069
  LocalForward 8022 server1:22
  LocalForward 17001 server1:7100
  LocalForward 8080 www-proxy:3128
  RemoteForward 11069 localhost:22

~에서wikihost

myuser@wikihost: ssh -XC -t gateway.companydomain.com ssh -L11069:localhost:22 server1

다른 터미널에서:

ssh gateway.companydomain.com

이제 내 회사 도메인에서 Firefox를 시작하고 wikihost. 나는 그랬다:

[email protected] ~ $ ssh gateway
Have a lot of fun...
kisteuser@gateway ~ $ ssh -D 8383 localhost
user@localhost's password: 
user@wikiserver:~> 

.ssh/config쪽은 다음과 같습니다.

host server1
    localforward 11069 localhost:11069

host localhost
    user myuser
    port 11069

host wikiserver
    forwardagent yes
    user myuser
    port 11069
    hostname localhost 

이제 이라는 서버에서 Firefox를 시작하고 gatewaySOCKSv5를 사용하도록 프록시 설정을 편집하여 프록시가 gateway포트 8383을 사용하도록 지정했습니다.

kisteuser@gateway ~ $ LANG=C firefox -P --no-remote

그리고 이제 터미널에 다음 오류가 표시됩니다 wikiserver.

myuser@wikiserver:~> channel 3: open failed: connect failed: Connection refused
channel 3: open failed: connect failed: Connection refused
channel 3: open failed: connect failed: Connection refused

혼란스러운? 저도요 ...

터널을 올바르게 구축하고 SOCKS 프로토콜을 통해 위키를 탐색하는 방법을 이해하도록 도와주세요.

업데이트:

나는 다음과 같은 변경 사항을 적용하여 wikiserver에서 wiki를 탐색할 수 있었습니다:

host wikiserver
    forwardagent yes
    user myuser
    port 11069
    hostname localhost 
    localforward 8339 localhost:8443

이제 SSH를 통해 gatewayFirefox를 실행하고 localhost:8339로 이동하면 포트 8443에서 제공되는 위키의 시작 페이지가 표시됩니다.

이제 나는 SOCKS가 정말 필요한지 스스로에게 묻습니다. 누군가 그것에 대해 자세히 설명할 수 있습니까?

답변1

원하는 방식으로 SOCKS를 설정하려면 다음 ssh -D 8383명령을 실행해야 합니다.~에브라우저를 실행하고 연결하려는 시스템에게위키에 접근할 수 있는 기계. 기본적으로 매뉴얼 페이지에 명시된 대로만 수신 localhost:8383하므로 프록시 주소로 도 사용해야 합니다 .ssh -Dlocalhost

기본적으로 로컬 포트는 GatewayPorts 설정에 따라 바인딩됩니다. 그러나 연결을 특정 주소에 바인딩하기 위해 명시적인 바인딩_주소를 사용할 수 있습니다.

따라서 gateway에 대한 액세스 권한이 있지만 wikihost에서 브라우저를 실행하려면 에서 kistefirefox를 실행하고 kiste"localhost:8383"을 SOCKS 프록시로 구성하고 ssh -D 8383 gateway에서 실행해야 합니다 kiste.

명심해야 할 몇 가지 다른 참고 사항:

를 사용하여 모든 ssh 명령을 실행해 보십시오 -v. 이렇게 하면 요청된 모든 전달이 표시되며 정확히 어떤 전달이 실패하는지 확인할 수 있습니다.

또한 상황을 덜 혼란스럽게 만들기 위해 실제로 필요하지 않은 터널을 제거하는 것이 좋습니다.

귀하가 보고 있는 오류 메시지는 무언가가 컴퓨터의 한쪽 끝에 연결을 시도할 때 발생합니다.공전-LSSH 터널( 또는 를 사용하여 생성한 터널 -R)이지만 SSH는 터널의 다른 쪽 끝에 연결할 수 없습니다.

관련 정보