WSL證書同步windows主機(jī)

首先呢是需要安裝WSL。不懂的同學(xué)可以去WSL安裝官網(wǎng)鏈接 https://docs.microsoft.com/zh-cn/windows/wsl/install

然后我們直接進(jìn)行一個網(wǎng)的連
wget https://mail.qq.com
如果出現(xiàn)

Resolving mail.qq.com (mail.qq.com)... 
Connecting to mail.qq.com (mail.qq.com)
HTTP request sent, awaiting response... 200 OK
Length: 15275 (15K) [text/html]
Saving to: ‘index.html.2’

index.html.2                  100%[=================================================>]  14.92K  --.-KB/s    in 0.003s

2022-05-10 15:47:17 (5.26 MB/s) - ‘index.html.2’ saved [15275/15275]

恭喜你, 不需要考慮這個證書影響帶來的問題。

剩下的教程留給需要安裝證書的冤種同學(xué)。。。
好了,進(jìn)入正文。

首先我們需要整理windows用到的所有證書文件。
這里可以使用powershell 腳本實(shí)現(xiàn)。需要的腳本放在這個git倉庫了。https://github.com/dreamHeroK/windows-certs-2-wsl

win+r執(zhí)行powershell 命令
Set-ExecutionPolicy Unrestricted

正常結(jié)果是

執(zhí)行策略更改
執(zhí)行策略可幫助你防止執(zhí)行不信任的腳本。更改執(zhí)行策略可能會產(chǎn)生安全風(fēng)險(xiǎn),如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 幫助主題所述。是否要更改執(zhí)行策略?
[Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 暫停(S)  [?] 幫助 (默認(rèn)值為“N”): Y

記得填Y
然后在powershell 執(zhí)行g(shù)it倉庫中的PS腳本文件,直接拖入命令行 回車就行。

 E:\get-all-certs.ps1

打開WSL
執(zhí)行以下命令

  sudo mv /etc/ssl/certs /etc/ssl/certs.orig
   sudo ln -s /mnt/c/user/admin/all-certificates /etc/ssl/certs
  update-ca-certificates

sudo ln -s /mnt/<腳本整理正式文件的目錄 一般是 C:\Users\admin\all-certificates> /etc/ssl/certs

執(zhí)行完成后再 進(jìn)行一個網(wǎng)的連
wget https://mail.qq.com

出現(xiàn)

Resolving mail.qq.com (mail.qq.com)... 
Connecting to mail.qq.com (mail.qq.com)|
HTTP request sent, awaiting response... 200 OK
Length: 15275 (15K) [text/html]
Saving to: ‘index.html.2’

index.html.2                  100%[=================================================>]  14.92K  --.-KB/s    in 0.003s

2022-05-10 15:47:17 (5.26 MB/s) - ‘index.html.2’ saved [15275/15275]

就表示你成功了。。。
至于失敗,我還沒失敗。失敗了再說吧。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容