오프너 및 프록시를 통한 SSH의 "ssh_exchange_identification" 오류

오프너 및 프록시를 통한 SSH의 "ssh_exchange_identification" 오류

며칠 전까지만 해도 다음 구성으로 회사 프록시를 통해 연결을 터널링하기 위해 코르크나사를 사용하여 원격 SSH 서버에 연결할 수 있었습니다.

ssh -v [email protected] -p 443 -o "ProxyCommand corkscrew corp-proxy 8080 xxx.xxx.xxx.xxx 443"

회사 프록시 제한으로 인해 SSH 서버 포트를 443으로 설정했습니다. 이제 에이전트 측에서 변경된 사항이 있어 다음 오류가 발생합니다.

OpenSSH_6.2p2 Ubuntu-6ubuntu0.4, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Executing proxy command: exec corkscrew corp-proxy 8080 xxx.xxx.xxx.xxx 443 
debug1: identity file /home/pe/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.4
debug1: permanently_drop_suid: 1000
ssh_exchange_identification: Connection closed by remote host

또한 어떻게든 블랙리스트에 오른 것으로 의심되어 새 데비안 VM을 설치해 보았습니다(내 IP는 고정되어 있으며 PC 호스트 이름을 통해 dhcp에서 할당되었습니다).

새 VM에서는 내 IP가 dhcp에 의해 무작위로 할당되며 연결을 시도하면 다른 응답을 받습니다.

OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Executing proxy command: exec corkscrew corp-proxy 8080 xxx.xxx.xxx.xxx 443
debug1: permanently_drop_suid: 1000
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4
debug1: match: OpenSSH_6.0p1 Debian-4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
debug2: fd 5 setting O_NONBLOCK
debug2: fd 4 setting O_NONBLOCK
debug3: put_host_port: [xxx.xxx.xxx.xxx]:443
debug1: SSH2_MSG_KEXINIT sent
Connection closed by UNKNOWN

auth.log 파일에서 볼 수 있듯이 이 연결은 ssh 서버에 도달하지만 응답은 다음과 같습니다.

Did not receive identification string from xxx.xxx.xxx.xxx

새로운 프록시 설정이 나를 차단할 수 있습니까? SSH를 다시 ​​작동시키는 방법에 대한 제안이 있으십니까?

편집: openvpn, apache 리디렉션 등 여러 가지 방법을 시도했지만 아무것도 작동하지 않았습니다. Apache 리디렉션에서도 동일한 오류가 발생합니다.

    telnet corp-proxy 8080
Trying xxx.xxx.xxx.xxx...
Connected to corp-proxy.
Escape character is '^]'.
CONNECT myserver:443 HTTP/1.0

HTTP/1.0 200 Connection Established
Date: Wed, 29 Oct 2014 16:12:06 GMT
Via: 1.1 corp-proxy

CONNECT myserver:1443 HTTP/1.0
Connection closed by foreign host.

이 경우 myserver에는 포트 443에 Apache가 있고 Apache가 포트 1443의 연결을 SSH 서버로 리디렉션하면 해당 포트가 프록시에서 허용됩니다. 나는 쫓겨났습니다.

답변1

해결책과 가능한 원인을 찾았습니다.

프록시 측에는 포트 443에서 일종의 심층 패킷 검사(DPI)가 활성화되어 있는 것으로 의심됩니다. 따라서 프록시는 "실제" https 요청만 수락할 수 있고 다른 모든 요청은 연결을 재설정합니다.

해결책은 다음과 같은 함수를 사용하는 것입니다.터널SSL 컨테이너에서 https 요청을 래핑하는 기능으로 프록시 측이 일반 https 요청(예: https 사이트 검색)과 다르지 않습니다.

Stunnel은 서버측과 클라이언트측 모두에 설치해야 하며 프록시 서버를 사용하여 요청하도록 구성할 수 있습니다.

설치 및 구성 방법에 대한 많은 자습서가 인터넷에 있습니다.

관련 정보