2
5

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 5 years have passed since last update.

リモートワークのために社内のWebサーバなどに接続する環境設定を用意した

2
Last updated at Posted at 2020-02-28

追記2020.3.27
わざわざ Proxyサーバ起動する必要なかった

以下の記事にあるような、踏み台にダイナミックポートフォワードで接続することで、そのポートを経由してアクセスすることで、自前でProxyを立てるのと同様のことができた。


急遽、自宅から社内の各種事務手続き用のサーバ及び担当している案件で使っているクラウドサービス等にアクセスする必要に迫られたので環境を設定した。

リモートワーク用設定(2).png

①ssh設定(踏み台経由の Office PC への接続)

以下のような ~/.ssh/config を用意

# 踏み台(a)
Host gate
  Hostname {踏み台のIPアドレス}

# Office PC (b)
Host officepc
  Hostname {Office PC のIPアドレス}
  ProxyCommand ssh -CW %h:%p gate  
  LocalForward 8888 {Office PC のIPアドレス}:8888

上記設定の後、Office PC (b) に ssh 接続

$ ssh officepc

②Office PC で proxy サーバを起動

docker コマンドだけで起動する proxy サーバ に書いたとおり、proxy サーバを起動する(※ Dockerホストのポート番号 8888 は ssh の LocalForward の設定と合わせること)

$ docker run --rm -p 8888:3128 node npx proxy 

起動が完了すると以下のように表示される(下記以外は特にアクセスログ等は出てこない)

npx: installed 17 in 4.217s
HTTP(s) proxy server listening on port 3128

③OS/ブラウザのProxy設定

Windows 10 の場合、設定>ネットワークとインターネット>プロキシで「手動プロキシ セットアップ」で以下のようにアドレス/ポートを設定

image.png

2
5
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
2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?