kTLS 就是 TLS in Kernel
就是在 Kernel space 層中進行 SSL 加密的處理,大大提高安全性,及降低對系統的負載
而 Kernel 4.13 裡就已內建了
確認可不可用
modprobe tls
lsmod | grep tls
tls 102400 0
可以拿 nginx-1.21.4 測試
編譯加上 ↓
--with-openssl=../openssl-3.0.0 --with-openssl-opt=enable-ktls
在 nginx.conf 裡設置 ↓
error_log /var/log/nginx/error.log debug;
http {
server {
listen 443 ssl;
ssl_certificate ssl/server.crt;
ssl_certificate_key ssl/server.key;
ssl_conf_command Options KTLS;
ssl_protocols TLSv1.3;
}
}
在 debug 過程中看到 error.log 裡有 ↓ 就是成功了
BIO_get_ktls_send() SSL_sendfile
PS: 不過,我沒試出來
參考 Improving NGINX Performance with Kernel TLS and SSL_sendfile( )
留言