Skip to content

Commit

Permalink
Explicitly set MinVersion of TLS
Browse files Browse the repository at this point in the history
Currently, the default MinVersion value for TLS configuration is used,
which is TLS1.0 and considered insecure.

Explicitly set the MinVersion to a secure version of TLS.

closes: https://issues.redhat.com/browse/ECOPROJECT-1419

Signed-off-by: Carlo Lobrano <[email protected]>
  • Loading branch information
clobrano committed Jul 19, 2023
1 parent 3c22888 commit 77c8dc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/certificates/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"google.golang.org/grpc/credentials"
)

const TLSMinVersion = tls.VersionTLS13

func GetServerCredentialsFromCerts(certReader CertStorageReader) (credentials.TransportCredentials, error) {

keyPair, pool, err := prepareCredentials(certReader)
Expand All @@ -19,6 +21,7 @@ func GetServerCredentialsFromCerts(certReader CertStorageReader) (credentials.Tr
Certificates: []tls.Certificate{*keyPair},
ClientAuth: tls.RequireAndVerifyClientCert,
ClientCAs: pool,
MinVersion: TLSMinVersion,
}), nil
}

Expand All @@ -33,6 +36,7 @@ func GetClientCredentialsFromCerts(certReader CertStorageReader) (credentials.Tr
Certificates: []tls.Certificate{*keyPair},
RootCAs: pool,
ServerName: fixedCertIP.String(),
MinVersion: TLSMinVersion,
}), nil
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/controlplane/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ func (manager *Manager) isEndpointAccessible() bool {
func (manager *Manager) isKubeletServiceRunning() bool {
url := fmt.Sprintf("https://%s:%s/pods", manager.nodeName, kubeletPort)
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
MinVersion: tls.VersionTLS13,
},
}
httpClient := &http.Client{Transport: tr}

Expand Down

0 comments on commit 77c8dc4

Please sign in to comment.