简体   繁体   English

github copilot 证书链中的自签名证书

[英]self signed certificate in certificate chain on github copilot

I installed the GitHub copilot but the extension do not work, always show the following error :我安装了 GitHub 副驾驶但扩展不起作用,总是显示以下错误

在此处输入图像描述

What could I do to solve this?我能做些什么来解决这个问题?

Copilot error: “ GitHub Copilot could not connect to server. Copilot 错误:“ GitHub Copilot 无法连接到服务器。 Extension activation failed: self-signed certificate in certificate chain ” is generally caused using CoPilot behind a Corporate network.扩展激活失败:证书链中的自签名证书”通常是在企业网络后面使用 CoPilot 引起的。

  • Most corporate networks have a 'Man-in-the-middle' appliance that dynamically breaks open all secure SSL traffic leaving home to enter the internet.大多数企业网络都有一个“中间人”设备,可以动态断开所有离开家进入互联网的安全 SSL 流量。 This ensures they can inspected any traffic leaving, including your online banking.这确保他们可以检查任何离开的流量,包括您的网上银行。 Usually automation scrubs the traffic looking for theft of company secrets or IP and raises alerts.通常,自动化会清除流量以寻找窃取公司机密或 IP 并发出警报。 It all gets logged and reviewed further if need be.如果需要,这一切都会被记录下来并进一步审查。

  • This action leaves behind a fake cert chain as a fingerprint.此操作会留下一个假证书链作为指纹。 The cert for the called site is replaced with a fake, and one signed by the company's own private CA authority.被调用站点的证书被替换为伪造的,并且由公司自己的私人 CA 机构签名。 Hence the self-signed cert in the cert chain error.因此证书链错误中的自签名证书。

  • From any company device (Phones\Laptop) the company CA is already installed as a trusted CA.从任何公司设备 (Phones\Laptop) 上,公司 CA 已安装为受信任的 CA。 So the local browsers and other desktop apps trust this faked cert chain - and so do not raise any concerns someone is snooping your secure network traffic (the company does own the network and the device).因此,本地浏览器和其他桌面应用程序信任这个伪造的证书链 - 因此不要担心有人在窥探您的安全网络流量(该公司确实拥有网络和设备)。

  • By default VSCode is not trusting the installed desktop certs, and so it noticed that the GitHub cert is no longer signed by a trusted public CA authority.默认情况下,VSCode 不信任已安装的桌面证书,因此它注意到 GitHub 证书不再由受信任的公共 CA 机构签名。

  • As Rypox states above, the VSCode extension 'Win-CA' ( must be set to 'append' mode ) solves this issue.正如Rypox上面所说,VSCode 扩展“Win-CA”(必须设置为“附加”模式)解决了这个问题。 It tells VSCode to also trust the CA's installed on the employees desktop.它告诉 VSCode 也信任安装在员工桌面上的 CA。 This makes VSCode happy again trusting the fake cert chain.这让 VSCode 再次高兴地信任了假证书链。 No ' whitelisting ' needed and not ' VPN ' related.不需要“白名单”,与“ VPN ”无关。 But certinly not that obvious either.但当然也不是那么明显。 An interesting CA trust issue.一个有趣的 CA 信任问题。

  • Confirming this does exist is easy from your browser.确认这确实存在很容易从您的浏览器。 Go to any outside site (like Amazon) and review the sites “Cert” to see who the CA's are (Certification Path).转到任何外部站点(如 Amazon)并查看站点“Cert”以查看 CA 是谁(Certification Path)。 It should 'not' contain any reference to your company.它应该“不”包含对您公司的任何引用。 Look at that same cert from outside the company network on your own personal laptop.在您自己的个人笔记本电脑上从公司网络外部查看相同的证书。

… “bit of a glitch in the Matrix”, installing Win-CA helps hides it again and all looks back to normal. ......“矩阵中的一个小故障”,安装 Win-CA 有助于再次隐藏它,一切看起来都恢复正常。

公司代理也有同样的问题,以附加模式运行的win-ca扩展解决了它。

On macOS, you can use this script to monkey patch the Copilot extension to make this work:在 macOS 上,您可以使用此脚本对 Copilot 扩展进行猴子补丁以使其工作:

_VSCODEDIR="$HOME/.vscode/extensions"
_COPILOTDIR=$(ls "${_VSCODEDIR}" | grep -E "github.copilot-[1-9].*" | sort -V | tail -n1) # For copilot
_COPILOTDEVDIR=$(ls "${_VSCODEDIR}" | grep "github.copilot-nightly-" | sort -V | tail -n1) # For copilot-nightly
_EXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDIR}/dist/extension.js"
_DEVEXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDEVDIR}/dist/extension.js"
if [[ -f "$_EXTENSIONFILEPATH" ]]; then
    echo "Found Copilot Extension, applying 'rejectUnauthorized' patches to '$_EXTENSIONFILEPATH'..."
    perl -pi -e 's/,rejectUnauthorized:[a-z]}(?!})/,rejectUnauthorized:false}/g' ${_EXTENSIONFILEPATH}
    sed -i.bak 's/d={...l,/d={...l,rejectUnauthorized:false,/g' ${_EXTENSIONFILEPATH}
else
    echo "Couldn't find the extension.js file for Copilot, please verify paths and try again or ignore if you don't have Copilot..."
fi
if [[ -f "$_DEVEXTENSIONFILEPATH" ]]; then
    echo "Found Copilot-Nightly Extension, applying 'rejectUnauthorized' patches to '$_DEVEXTENSIONFILEPATH'..."
    perl -pi -e 's/,rejectUnauthorized:[a-z]}(?!})/,rejectUnauthorized:false}/g' ${_DEVEXTENSIONFILEPATH}
    sed -i.bak 's/d={...l,/d={...l,rejectUnauthorized:false,/g' ${_DEVEXTENSIONFILEPATH}
else
    echo "Couldn't find the extension.js file for Copilot-Nightly, please verify paths and try again or ignore if you don't have Copilot-Nightly..."
fi

Save as something like monkey-patch-copilot.sh , then chmod +x monkey-patch-copilot.sh .另存为monkey-patch-copilot.sh类的文件,然后chmod +x monkey-patch-copilot.sh You should then be able to run: ./monkey-patch-copilot.sh to apply the patch.然后你应该能够运行: ./monkey-patch-copilot.sh来应用补丁。

Note: I am not the original author.注:本人不是原作者。 This was found on the Copilot feedback forum.这是在 Copilot 反馈论坛上找到的。

For any MacOS users, the VSCode extension linhmtran168.mac-ca-vscode can help as well with this.对于任何 MacOS 用户,VSCode 扩展 linhmtran168.mac-ca-vscode 也可以提供帮助。 It is similar to the previously mentioned win-ca.它类似于前面提到的win-ca。

https://marketplace.visualstudio.com/items?itemName=linhmtran168.mac-ca-vscode https://marketplace.visualstudio.com/items?itemName=linhmtran168.mac-ca-vscode

This looks like a similar error to what I am getting.这看起来与我得到的错误相似。 I believe that the source of this in our corporate network is a ssl inspection process such that when the https traffic is opened and inspected that it breaks the certificate chain and this error shows up.我相信我们公司网络中这种情况的根源是 ssl 检查过程,因此当打开并检查 https 流量时,它会破坏证书链并显示此错误。 A fix would be to add the GitHub Copilot servers to the ssl inspection whitelist so that that traffic is not inspected.解决方法是将 GitHub Copilot 服务器添加到 ssl 检查白名单,以便不检查流量。

Corporate VPN was the problem (same as @mark-derry's).企业 VPN 是问题所在(与 @mark-derry 的相同)。

Jetbrain's PyCharm / DataSpell allows to accept self signed certificates. Jetbrain 的 PyCharm / DataSpell 允许接受自签名证书。

VSCode doesn't seem to have this option yet. VSCode 似乎还没有这个选项。

Easy: Method 1. just excute this code.简单:方法1。只需执行此代码。

git config --global http.sslVerify false git 配置 --global http.sslVerify false

Method 2: FOllow this guide?方法 2:遵循本指南? and Thank me later because I have saved you a time of husel: .) .稍后谢谢我,因为我为您节省了时间:。)。 you're welcome!别客气!

https://mattferderer.com/fix-git-self-signed-certificate-in-certificate-chain-on-windows https://mattferderer.com/fix-git-self-signed-certificate-in-certificate-chain-on-windows

I found a solution for this which works for me in case of Intellij.我找到了一个适用于 Intellij 的解决方案。 I have blogged about it at https://sidd.io/2023/01/github-copilot-self-signed-cert-issue/我已经在https://sidd.io/2023/01/github-copilot-self-signed-cert-issue/上写了关于它的博客

At a high level I think the architecture of the plugin might be same:在高层次上,我认为插件的架构可能是相同的:

IDE Native CoPilot Plugin ---making RPC call---> NodeJS based CoPilot Agent IDE Native CoPilot Plugin --- 进行 RPC 调用 ---> 基于 NodeJS NodeJS based CoPilot Agent

And this NodeJS based CoPilot Agent agent has issues with the Self Signed Certs (at least in my case).而这个NodeJS based CoPilot Agent代理在自签名证书方面存在问题(至少在我的情况下)。

Fix is as follows:修复如下:

  1. Export the self-signed certificate in discussion导出讨论中的自签名证书
  2. Convert it into .pem format if not already将其转换为.pem格式(如果尚未转换)
  3. Export the path of this .pem cert to NODE_EXTRA_CA_CERTS variable将此.pem证书的路径导出到NODE_EXTRA_CA_CERTS变量
  4. Restart your IDE and it should work重启你的 IDE 它应该可以工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GitHub证书链中的自签名证书 - Self signed certificate in certificate chain with GitHub SSL 证书问题:证书链中的自签名证书 - SSL certificate problem: self signed certificate in certificate chain Git - “SSL证书问题:证书链中的自签名证书” - Git - “SSL certificate issue: self signed certificate in certificate chain” 如何解决 [curl: (60) SSL 证书问题:证书链中的自签名证书] - How to solve [curl: (60) SSL certificate problem: self signed certificate in certificate chain] 如何解决SSL证书:从github克隆repo时自签名证书? - How to solve SSL certificate: self signed certificate when cloning repo from github? 我越来越无法克隆 git 致命存储库:'https://dev.azure.com SSL 证书问题:证书链中的自签名证书 - I am getting unable to clone git repository fatal: 'https://dev.azure.com SSL certificate problem: self signed certificate in certificate chain curl: (60) SSL 证书问题:自签名证书 - curl: (60) SSL certificate problem: self signed certificate x509:由未知机构签署的证书 - 使用 docker 和 github - x509: certificate signed by unknown authority - both with docker and with github 添加自签名SSL证书而不禁用授权签名证书 - Adding self-signed SSL certificate without disabling authority-signed ones Github证书发行 - Github certificate issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM