TsgcWebSocketLoadBalancerServer › Properties › SSLOptions
保存负载均衡器 TLS 侦听器的证书路径、TLS 版本选择和 OpenSSL 调优参数。
property SSLOptions: TsgcWSSSL_Options read FSSLOptions write SetSSLOptions;
Version=tlsUndefined,VerifyCertificate=False
在激活负载均衡器且 SSL 为 True 之前提供证书材料:RootCertFile、CertFile 和 KeyFile 指向 PEM 文件(当文件包含完整证书链时,三者使用相同路径),仅当私钥已加密时才需要 Password。将 VerifyCertificate 设为 True 可请求并验证客户端证书(子选项 FailIfNoCertificate 和 VerifyClientOnce 细化检查方式),VerifyDepth 控制证书链长度;当注册的后端必须提供客户端证书以进行双向 TLS 认证时,此功能非常有用。Version 选择特定的 TLS 版本(tls1_0、tls1_1、tls1_2、tls1_3)或保持协商开放(tlsUndefined)。OpenSSL_Options 公开底层旋钮:APIVersion(oslAPI_1_0/oslAPI_1_1/oslAPI_3_0)、LibPath/LibPathCustom、UnixSymLinks、ECDHE、CipherList、CurveList、MinVersion 和 X509Checks。
oServer := TsgcWebSocketLoadBalancerServer.Create(nil);
oServer.SSL := true;
oServer.SSLOptions.CertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.KeyFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.RootCertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.Version := tls1_3;
oServer.SSLOptions.OpenSSL_Options.MinVersion := tls1_2;
oServer.SSLOptions.Port := 443;
oServer.Active := true;