요새 호스트를 통한 SSH 터널

요새 호스트를 통한 SSH 터널

요새 호스트를 통해 SSH 터널을 설정하는 데 문제가 있습니다.

잠재적으로 문제를 해결할 수 있는 다양한 SE 질문을 살펴본 결과 아무것도 없습니다.

내 SSH 구성 파일(로컬)

Host www
    HostName ***
    IdentityFile ~/.ssh/key.pem
    ProxyCommand ssh root@bastion -W %h:%p

Host bastion
    HostName ***
    IdentityFile ~/.ssh/key.pem
    StrictHostKeyChecking      no
    ProxyCommand               none
    ForwardAgent               yes

요새 서버(/etc/ssh/sshd_config)에 필요한 구성 옵션을 추가했습니다.

PermitTunnel yes
AllowTCPForwarding yes
PermitOpen any
TCPKeepAlive yes

하지만 다음과 같은 오류가 발생합니다.

OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: /etc/ssh/ssh_config line 59: Applying options for www
debug1: Executing proxy command: exec ssh root@bastion -W ****:22
debug1: permanently_set_uid: 0/0
debug1: permanently_drop_suid: 0
debug1: key_load_public: No such file or directory
debug1: identity file ~/.ssh/key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file ~/.ssh/key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host

이 설정에는 대상 호스트(www)가 AWS VPC에 있고 요새에서만 주소를 지정할 수 있다는 점에서 한 가지 주의 사항이 있습니다. 내 가정은 라우팅이 요새에서 수행되기 때문에 이것이 문제가 되지 않아야 한다는 것입니다. 그러나 그것이 이 시나리오에서 문제가 되는 마지막 생각입니다.

답변1

그게 오히려 짜증나네요. AWS AMI는 Authorized_keys에서 포트 전달을 비활성화하는 것으로 나타났습니다! sshd 구성의 모든 것이 올바르게 보일 때 디버깅하기가 까다로운 작업이었습니다.

~/.ssh/authorized_keys

no-port-forwarding,no-agent-forwarding,no-X11-forwarding

관련 정보