nginx配置HTTP/3的注意事項

0   9301 轉為簡體

因為OpenResty近期更新到了支持HTTP/3的nginx,需要注意以下事項。

打開reuseport

在多worker配置下需要打開HTTP/3端口的reuseport選項,否則會導致兩個UDP包被不同的worker處理,從而客戶端報ERR_DRAINING錯誤。

多個Host在同一個端口監聽的話,只需在其中的任意一個listen directive中添加reuseport。

把$http_host替換成$host

由於HTTP/3不再發送 Host 頭而改用 :authority 偽頭來,$http_host 變量變為空值。因此$http_host和ngx.var.http_host都需要改為$host和ngx.var.host。

添加Alt-Svc頭

瀏覽器不會默認通過 HTTP/3 連接,但在看到 Alt-Svc 頭後才開始嘗試使用 HTTP/3 協議。

另外,隨着http3的加入,http2從listen directive中被棄用,改為單獨的http2 on/off; directive。

我將以上更改寫成一個自動化腳本,用來批量更新多個nginx conf文件。

Do not set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MiniNT when trying to enable ReFS

0   7933 轉為簡體

Lots of articles online indicates adding a AllowRefsFormatOverNonmirrorVolume DWORD key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MiniNT in reigstry.

This is wrong. The MiniNT section is to indicate the system is a WinRE or WinPE system, thus certain USBccid devices’ driver won’t load. Including SmartCard reader, Windows Hello (mostly implemented as an internal USB camera).

很多教程提到在註冊表裡添加HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MiniNT項,並添加名為AllowRefsFormatOverNonmirrorVolume的DWORD值。

其實這是錯誤的利用了WinRE啟用了ReFS作為系統盤的功能。在正常的系統中出現MiniNT項會導致系統認為這是WinRE系統,從而不加載基於USB的驅動,包括智能卡讀卡器和Windows Hello 驅動(很多 Windows Hello 攝像頭是通過USB連接的)。

Windows Server 存儲池替換物理硬盤

0   7033 轉為簡體

現有兩個存儲池,分別叫StoragePool1和StoragePool2;兩個存儲池中各有兩塊磁盤(Disk1-1, Disk1-2, Disk2-1, Disk2-2),各組成Mirror分佈的虛擬磁盤,分別叫VirtualDisk1和VirtualDisk2。

需要將 Disk2-2 退役,在StoragePool1 中加入 Disk1-3,將 Disk1-2 加入StoragePool2。

按如下操作

 

Ubuntu 22.04 / OpenSSH 8.9 使用 gpg-agent 登錄報錯 agent refused operation 的解決方法

0   10080 轉為簡體

Ubuntu 22.04 升級了 OpenSSH 到8.9,這個版本默認開啟 [email protected] 作為密鑰交換(KEX)方法。這個算法使用 512 bit 的 hash。

如果客戶端和服務端都升級到了8.9或以上,則成功協商使用這一KEX算法,這時如果使用 gpg-agent 的 SSH 功能簽名則會報 agent refused operation。

打印 gpg-agent 的日誌可看到報錯為 Provided object is too large。

解決方法是在客戶端(~/.ssh/config)或服務端(/etc/ssh/sshd_config)中禁用這個算法

同理 diffie-hellman-group16-sha512 和 diffie-hellman-group18-sha512 也應該被禁用,但它們優先級本來就很低。

如果仍然有問題,把Kex Host Key Algorithm也改一下,如改成