结合没有公网的cvm通过IE访问同地域cos https链接一直转圈和另一个没有公网的cvm通过内网访问同地域cos的报错tls handshake timeout的case来看,https证书问题在windows里还是挺重要的。
我写了一段代码来更新根证书(先清空、再通过certutil -generateSSTFromWU联网更新拉取400多个根证书)
#查看根证书
dir cert:\\CurrentUser\
dir cert:\\LocalMachine\
Get-ChildItem -Path Cert:\CurrentUser\
Get-ChildItem -Path Cert:\LocalMachine\
(dir cert:\\CurrentUser\Root).Count
(dir cert:\\LocalMachine\Root).Count
(Get-ChildItem -Path Cert:\CurrentUser\Root).Count
(Get-ChildItem -Path Cert:\LocalMachine\Root).Count
$Certs = get-childitem Cert:\LocalMachine\Root
$Certs | %{Remove-Item -path $_.PSPath -recurse -Force} #适用≥2012R2
#$Certs | Remove-Item
#适用2008R2
#Get-ChildItem Cert:\LocalMachine\Root | ForEach-Object {
# $store = Get-Item $_.PSParentPath
# $store.Open('ReadWrite')
# $store.Remove($_)
# $store.Close()
#}
while( (Test-Path C:\WURoots.sst) -eq $false ){
certutil -generateSSTFromWU C:\WURoots.sst 2>$null 1>$null
}
wget http://windowscq-1251783334.cos.ap-chongqing.myqcloud.com/updroots.exe -outfile c:\windows\updroots.exe
#certutil -urlcache -split -f http://windowscq-1251783334.cos.ap-chongqing.myqcloud.com/updroots.exe (这句适用2008R2和2012R2,上句适用win8~win11、2012R2~2022)
c:\windows\updroots.exe
updroots.exe c:\WURoots.sst
certmgr.msc
del C:\WURoots.sst 2>$null
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。