Skip to content

Commit

Permalink
Merge pull request #135 from clobrano/sdl/set-tls-minversion/0
Browse files Browse the repository at this point in the history
Explicitly set MinVersion of TLS
  • Loading branch information
openshift-merge-robot authored Aug 1, 2023
2 parents 1fc3f14 + 968cd10 commit 044ff33
Show file tree
Hide file tree
Showing 2 changed files with 9 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
6 changes: 5 additions & 1 deletion pkg/controlplane/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/medik8s/self-node-remediation/pkg/certificates"
"github.com/medik8s/self-node-remediation/pkg/peers"
)

Expand Down Expand Up @@ -150,7 +151,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: certificates.TLSMinVersion,
},
}
httpClient := &http.Client{Transport: tr}

Expand Down

0 comments on commit 044ff33

Please sign in to comment.