Skip to content

Commit

Permalink
fix for min tls version to v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kangsheng89 committed Nov 16, 2022
1 parent 7e17a73 commit a6c2c47
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/cmd/start/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package start

import (
"context"
"crypto/tls"
"flag"
"fmt"
"os"
Expand Down Expand Up @@ -52,6 +53,10 @@ import (
esv1 "github.com/openshift/elasticsearch-operator/apis/logging/v1"
)

// We should avoid that users unknowingly use a vulnerable TLS version.
// The defaults should be a safe configuration.
const defaultMinTLSVersion = tls.VersionTLS12

var (
scheme = k8sruntime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
Expand Down Expand Up @@ -320,10 +325,16 @@ func createManager(ctx context.Context, cfg *rest.Config) manager.Manager {
leaseDuration := time.Second * 137
renewDeadline := time.Second * 107
retryPeriod := time.Second * 26

optionsTlSOptsFuncs := []func(*tls.Config){
func(config *tls.Config) { minTlsDefault(config) },
}

options := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: webhookPort,
TLSOpts: optionsTlSOptsFuncs,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "31e04290.jaegertracing.io",
Expand Down Expand Up @@ -434,3 +445,7 @@ func getNamespace(ctx context.Context) string {

return podNamespace
}

func minTlsDefault(cfg *tls.Config) {
cfg.MinVersion = defaultMinTLSVersion
}

0 comments on commit a6c2c47

Please sign in to comment.