背景:
Squid是知名的代理软件,最大的特点是支持缓存和ACL控制。
Windows版本下载地址:squid.diladele.com/
使用方式:
服务端配置: 因为是开发调试,所以用了一台Windows电脑作为代理服务器,安装完之后,在系统托盘可以看到Squid的图标,通过点击图标可以查看配置项、启动、停止服务。
客户端配置:
在系统设置配置网络代理,不过这里的代理大部分只能作用于浏览器,客户端应用的开发需要自行在请求时手动添加代理。
客户端应用可以在注册表目录获取代理配置项:\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Protocol TLS 异常:
在客户端机器的应用使用代理访问部分api时,发现会报以下异常:
ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: https://www.googleapis.com/oauth2/v1/userinfo
Failed to establish a secure connection to 142.250.199.74
The system returned:
(71) Protocol error (TLS code: X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)
SSL Certficate error: certificate issuer (CA) not known: /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
This proxy and the remote host failed to negotiate a mutually acceptable security settings for handling your request. It is possible that the remote host does not support secure connections, or the proxy is not satisfied with the host security credentials.
Your cache administrator is webmaster.
Generated Tue, 07 Feb 2023 10:29:47 GMT by Moses (squid/4.14)
参考:docs.diladele.com/faq/squid/f… 发现是代理服务器缺少了 googleapis.com 的根CA证书;
- 分析错误信息,找到缺失的CA 证书名称:
- 查找缺失的证书: 可以访问www.ssllabs.com/ssltest/ind…上的在线 SSL 服务器站点检查工具。在搜索字段中输入www.googleapis.com/oauth2/v1/u… 并单击 提交 。该工具将返回这个域名的证书列表,如以下屏幕截图所示。
3. 找到
googleapis.com
对应的证书项,展开后一直往下拉;
- 通过报错的CA 证书名找到对应的证书,点击下载;
- 在代理服务器创建空文本文件,copy证书内容,保存名为
missing.pem
;
-
通过查阅squid配置项文档:www.visolve.com/solutions-s… ,发现配置CA证书的项为:
-
打开Squid配置文件,添加证书,保存之后重启服务,大功告成~