1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +02:00

fix(tls): centralize the TLS configuration to ensure FIPS compliance BE-11979 (#960)

This commit is contained in:
andres-portainer 2025-08-01 22:23:59 -03:00 committed by GitHub
parent 3eab294908
commit 163aa57e5c
25 changed files with 454 additions and 112 deletions

View file

@ -1,7 +1,7 @@
package networking
import (
"crypto/tls"
"crypto/fips140"
"fmt"
"net"
"net/http"
@ -9,6 +9,8 @@ import (
"strings"
"time"
"github.com/portainer/portainer/api/crypto"
"github.com/segmentio/encoding/json"
)
@ -71,13 +73,14 @@ func ProbeTelnetConnection(url string) string {
func DetectProxy(url string) string {
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
TLSClientConfig: crypto.CreateTLSConfiguration(),
},
Timeout: 10 * time.Second,
}
// TODO: use fips.CanTLSSkipVerify() instead
client.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = !fips140.Enabled()
result := map[string]string{
"operation": "proxy detection",
"local_address": "unknown",