8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mac OSXでHTTP Proxy経由でSSH

Last updated at Posted at 2019-07-08

##はじめに
Mac OSXだとHTTP Proxyを経由してインターネット上のサーバにSSHする際にハマるポイントがあるため備忘録を残す。インターネット上のサーバとしてはVPSやEC2のようなパブリッククラウドサービスを想定している。

参考)
Macで HTTP Proxy 経由のSSH

##うまくいくやり方
xx.xx.xx.xxがProxyのIP。FQDNでも可のはず。

$ brew install nmap
$ ssh -o ProxyCommand='ncat --proxy-type http --proxy xx.xx.xx.xx:3128 %h %p' -i ~/.ssh/id_rsa ubuntu@vm1

##普通のやり方
Linuxだとこれでうまく行くはず。

$ ssh ProxyCommand='nc -X connect -x xx.xx.xx.xx:3128 %h %p' -i ~/.ssh/id_rsa ubuntu@vm1

なぜかエラー (OSXでうまくいかない)

nc: Proxy error: "HTTP/1.1 200 Connection established" 
ssh_exchange_identification: Connection closed by remote host

蛇足

以下のnetcatでもダメだった。こちらは-vvvでデバッグした限りProxyオプションがない?

$ brew install netcat
$ ssh ProxyCommand='nc -X connect -x xx.xx.xx.xx:3128 %h %p' -i ~/.ssh/id_rsa ubuntu@vm1
8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?