2025-01-15 16:28:19 +01:00
|
|
|
//go:build devcert
|
|
|
|
|
|
|
|
package tls
|
|
|
|
|
2025-02-04 16:17:59 +01:00
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
"crypto/x509"
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
|
|
|
|
"github.com/netbirdio/netbird/util/embeddedroots"
|
|
|
|
)
|
2025-01-15 16:28:19 +01:00
|
|
|
|
|
|
|
func ClientQUICTLSConfig() *tls.Config {
|
2025-02-04 16:17:59 +01:00
|
|
|
certPool, err := x509.SystemCertPool()
|
|
|
|
if err != nil || certPool == nil {
|
|
|
|
log.Debugf("System cert pool not available; falling back to embedded cert, error: %v", err)
|
|
|
|
certPool = embeddedroots.Get()
|
|
|
|
}
|
|
|
|
|
2025-01-15 16:28:19 +01:00
|
|
|
return &tls.Config{
|
|
|
|
InsecureSkipVerify: true, // Debug mode allows insecure connections
|
|
|
|
NextProtos: []string{nbalpn}, // Ensure this matches the server's ALPN
|
2025-02-04 16:17:59 +01:00
|
|
|
RootCAs: certPool,
|
2025-01-15 16:28:19 +01:00
|
|
|
}
|
|
|
|
}
|