forked from Mxmilu666/frp
feat(client): verify server certificates against the system root store (#5546)
transport.tls.trustedCaFile is installed as RootCAs, and omitting it sets InsecureSkipVerify, so system-root verification cannot be selected directly. Add an opt-in transport.tls.useSystemRoots that enables certificate verification with RootCAs nil when no trusted CA file is set, allowing Go to use system roots and native verification on macOS and Windows. Defaults are unchanged.
This commit is contained in:
@@ -163,6 +163,10 @@ func validateTransportConfig(c *v1.ClientTransportConfig) (Warning, error) {
|
||||
warnings = AppendError(warnings, checkTLSConfig("transport.tls.certFile", c.TLS.CertFile))
|
||||
warnings = AppendError(warnings, checkTLSConfig("transport.tls.keyFile", c.TLS.KeyFile))
|
||||
warnings = AppendError(warnings, checkTLSConfig("transport.tls.trustedCaFile", c.TLS.TrustedCaFile))
|
||||
// wss keeps TLS on regardless of transport.tls.enable.
|
||||
if c.TLS.UseSystemRoots && c.Protocol != "wss" {
|
||||
warnings = AppendError(warnings, fmt.Errorf("transport.tls.useSystemRoots is ignored when transport.tls.enable is false"))
|
||||
}
|
||||
}
|
||||
|
||||
if !slices.Contains(SupportedTransportProtocols, c.Protocol) {
|
||||
|
||||
Reference in New Issue
Block a user