2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Netskope環境下でのJetBrains IDE + github copilot

Last updated at Posted at 2023-12-11

概要

JetBrains社製のIDEでgithub copilotを使用する際に
Netskopeを使っていると証明書エラーが発生したため、その対応をまとめました。

環境

Window 10 + phpStorm(及びintelliJ) + Netskope + github copilot

症状

GithubCopilotプラグインからGithubにログインしようとすると以下のエラーが表示される。
image.png
または、ブラウザ側でログイン認証が成功したにも関わらず、その結果をIDE側で受け取れない。
image.png

原因

githubのAPIをコールする際に、Netskopeを経由することで、レスポンスの証明書が信頼できないものとなってしまったため、github copilotプラグインが証明書エラーによりログイン失敗となった。

切り分け

・VSCodeでは動作すること
・curlでapi.github.comが証明書エラーになること、--insecureで無視すれば動作すること

$ curl https://api.github.com/user
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x800
92012) - The revocation function was unable to check revocation for the certific
ate.

$ curl https://api.github.com/user --insecure
{
  "message": "Requires authentication",
  "documentation_url": "https://docs.github.com/rest/users/users#get-the-authent
icated-user"
}

・タスクマネージャからNetskopeのプロセスをkillすれば動作すること

対応

大きく分けて2通りのやり方があると思います。今回は後者の方法で対応しました。

1. NetSkopeの除外リストに追加する

以下にリストアップされているドメインを除外リストに追加すれば、同一ネットワークの全Netskopeユーザがこの問題から開放されるはずです。
今回は権限や影響範囲の都合で対応を見送りました。
https://docs.github.com/ja/copilot/troubleshooting-github-copilot/troubleshooting-firewall-settings-for-github-copilot#urls-to-add-to-an-allowlist

2. netskope経由でgithubに接続する証明書を信頼できるものとして追加する

何パターンかやり方がありますが、以下の手順で行いました。
個々のPC全てで個別に対応が必要になります。

1.ブラウザでgithub.comを開く
2.URL鍵マークから証明書を開いて、Details > ExportでSave as type: Base64-encoded ASCII, certificates chain(*.pem; *.crt)を選んで、ファイル名適当、拡張子pemで保存。
3.Windowsのsystem>advanced system settings>Environment variables...
でユーザ変数にNODE_EXTRA_CA_CERTSという名前で上のpemファイルのパスを保存する。
4.phpStorm再起動

効果がなかった対応

・phpStormのSettigs>Tools>Server CertificatesでAccept non-trusted certificates automaticallyをチェックする
・phpStormのSettigs>Tools>Server CertificatesでAccepted Certificatesに前述のpemファイルを追加

感想

せっかく使える様になったのに、この問題のために利用開始まで数日がかかってしまいました。

github copilotプラグインのソースは公開されていないと思いますので、
non-trusted certificatesであっても有効にするオプションを追加していただけるように要望出しておこうと思います。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?