TL; DR

TL; DR

내 목표는 가능하다면 다음을 통해 연결하는 것입니다.

$ SSH 최종 호스트

종단점은 만들 수 있지만 hop-host는 만들 수 없는 mysql에 연결하려면 터널링에 SSH 연결이 필요하기 때문입니다.

TL; DR

.ssh/config사실 저는 제가 할 수 있는 방법을 찾고 있어요.

SSH 최종 호스트

무대 뒤에서라면 그럴 것이다

ssh -t 홉-호스트 SSH 끝-호스트



무대 뒤의 행동이 있을 때

Macbook -> hop-user@hop-host (id_rsa authentication) -> end-host-user@end-host (id_rsa authentication)

최종 호스트, 최종 호스트 사용자 및 최종 호스트에 대한 ID 파일은 /home/hop-user/.ssh/config홉 호스트에서 알고 정의됩니다.

맥북~/.ssh/config

Host hop-host
    User hop-user
    Hostname valid.tested.public.ip.address.to.hop.host
    IdentityFile ~/.ssh/id_rsa

Host end-host
    HostName end-point-hostname-as-defined-on-hop-host
    ProxyCommand ssh -W %h:%p hop-host

~/.ssh/config홉 사용자를 위한 홉 호스트 Cent OS

Host end-point-hostname-as-defined-on-hop-host
    HostName valid.tested.internal.ip.address.to.end.host
    User end-host-user
    IdentityFile ~/.ssh/keys/endhost

알아야 할 제한 사항: 홉/엔드 호스트의 구성을 변경할 수 없으며 해당 호스트에 설치되어 있지 않습니다 nc.

주어진 구성의 현재 문제

$ ssh end-host
채널 0: 열기 실패: 관리상 금지:
열기 실패 ssh_exchange_identification: 원격 호스트에 의해 연결이 닫혔습니다.

작동하는 것:

$ ssh -t hop-host ssh 엔드포인트-호스트 이름-정의된-on-hop-host

end-host-bash$를 올바르게 표시하고 거기에서 내가 원하는 모든 작업을 수행할 수 있도록 합니다.

작동하지 않거나 부분적으로 작동하고 시도한 것들

1) ~/.ssh/configHostName 및 User에 대한 Macbook 최종 호스트 구성 변경

Host end-host
    HostName valid.tested.internal.ip.address.to.end.host
    User end-host-user
    ProxyCommand ssh -W %h:%p hop-host

$ SSH 최종 호스트
[이메일 보호됨]님의 비밀번호:

나는 분명히 가지고 있지 않습니다. 그리고 hop-host가 .ssh/config빨간색이 아니기 때문인 것 같아요 .

2) ~/.ssh/configProxyCommand에 대한 Macbook 최종 호스트 구성 변경

Host end-host
    ProxyCommand ssh -t hop-host ssh end-point-hostname-as-defined-on-hop-host

$ ssh end-host
stdin이 터미널이 아니기 때문에 의사 터미널은 할당되지 않습니다.
stdin이 터미널이 아니기 때문에 의사 터미널은 할당되지 않습니다.
: 명령을 찾을 수 없습니다.2.0-OpenSSH_6.2
ls
^CK신호 2에 의해 채워졌습니다.

bash는 나에게 입력할 수 있는 가능성을 반환하지만 내 명령은 표시되지 않습니다.
그 이유는 뒤에서 호출이 있기 때문이라는 것을 이해 -o ProxyCommand="the command in .ssh/config in the right host"하지만 실제로 어떻게 작동하는지 이해하기가 부족할 수 있습니다.

관련 정보