7
10

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.

社内ネットワークが自己証明書を使っていてあらゆるインストールで「SSL Certificate Error」が出る時の対処法

Last updated at Posted at 2020-04-07

つよつよエンジニアの皆さんは自己証明書を使っている会社なんかでは働いていないとは思いますが、私のようなクソザコエンジニアはこのような悲惨な環境で働いているわけであります。
さて、この度プロジェクトの環境構築でSSLエラーが頻発しまくり、四苦八苦しながらなんとか対処したのでまとめていきたいと思います。

apt

apt.confというファイルを作り、それをUbuntu/Debianの/etc/apt/apt.confと差し替えます。

apt.conf
Acquire::http::Proxy "false";

Dockerfileの例はこんな感じ

COPY ./docker/app/apt.conf /etc/apt/apt.conf

これで普通にapt installが使えるようになります。

Git

SSLチェックをやめさせます。

git config --global http.sslVerify false

Python

pipのコマンドオプションで「信用できるドメインを指定」することで対処します。

pip install --trusted-host=pypi.org --trusted-host=pypi.python.org --trusted-host=files.pythonhosted.org django

残念ながら同じようなオプションはPoetryやpipenvでは見つけることができませんでした。。。

NodeJS

これもSSLの厳格なチェックをやめさせることで対処します。

npm config set strict-ssl false
yarn config set strict-ssl false

VSCodeのプラグイン(!?)

VSCodeの中身はElectronであり、プラグインはJSのソースによって作られるため、NodeJSの環境変数にNODE_TLS_REJECT_UNAUTHORIZEDを入れたら動くだろうと目論んだらその通りに行きました。
私の場合では特にremote-containerのインストールでエラーが起きました。

  • C:\Users\ユーザーID\.vscode\extensions\ms-vscode-remote.remote-containers-0.94.0\dist\extension.jsを開く
  • 先頭に以下のコードを追加
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

ms-vscode-remote.remote-containers-0.94.0のプラグイン名やバージョン情報の部分は適時読み替えてください。

以上です。

7
10
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
7
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?