WINC-1988: TLS profile adherence - #4340
Conversation
|
Skipping CI for Draft Pull Request. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mansikulkarni96 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@mansikulkarni96: This pull request references WINC-1988 which is a valid jira issue. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@code-rabbit review |
|
@code-rabbit full review |
|
/test aws-e2e-operator |
|
/test lint |
|
@mansikulkarni96: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
jrvaldes
left a comment
There was a problem hiding this comment.
@mansikulkarni96 thanks for working on this, mostly LGTM.
PTAL at the comments.
| // get cluster configuration | ||
| ctx := ctrl.SetupSignalHandler() | ||
|
|
||
| // Fetch TLS configuration from APIServer for PQC readiness (OpenShift 4.22 requirement) |
There was a problem hiding this comment.
(OpenShift 4.22 requirement)
does this mean the feature must be backported?
There was a problem hiding this comment.
no this requirement is moved to 5.0, updated.
| ctx := ctrl.SetupSignalHandler() | ||
|
|
||
| // Fetch TLS configuration from APIServer for PQC readiness (OpenShift 4.22 requirement) | ||
| setupLog.Info("fetching TLS configuration from cluster APIServer") |
There was a problem hiding this comment.
consider debug log for this entry
|
|
||
| // Convert TLS profile to config function | ||
| tlsConfigFn, unsupportedCiphers := tlspkg.NewTLSConfigFromProfile(tlsProfile) | ||
| if len(unsupportedCiphers) > 0 { |
There was a problem hiding this comment.
should this log a WARN instead?
| } | ||
|
|
||
| setupLog.Info("TLS configuration loaded", | ||
| "minVersion", tlsProfile.MinTLSVersion, |
There was a problem hiding this comment.
windows-exporter may need min_version and cipher_suites on it TLS configuration
as it serve metrics over HTTPS
There was a problem hiding this comment.
not a blocker, consider a separate PR/jira for this.
| // cache type. | ||
| mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ | ||
| Scheme: scheme, | ||
| Metrics: metricsserver.Options{ |
There was a problem hiding this comment.
the proposal only sets MinVersion and CipherSuites. It does not set NextProtos. Without this, the metrics server falls back to Go's default
ALPN behavior (which is implementation-defined per Go version).
The doc reference explicitly states:
▎ Set NextProtos / ALPN yourself — the cluster profile does not set it.
There was a problem hiding this comment.
controller-runtime's metrics server already sets NextProtos: []string{"h2"} in server.go:279 before calling our TLSOpts function. Since NewTLSConfigFromProfile only sets MinVersion and CipherSuites, the
existing NextProtos is preserved. No additional setting needed on our side.
| setupLog.Info("TLS security profile changed, pod will restart", | ||
| "oldMinVersion", oldProfile.MinTLSVersion, | ||
| "newMinVersion", newProfile.MinTLSVersion) | ||
| os.Exit(0) // Graceful exit - Kubernetes will restart pod |
There was a problem hiding this comment.
os.Exit does not run deferred functions. All ongoing node configuration, FTP transfers, Windows service management is abandoned
without cleanup. This can leave Windows nodes partially configured.
consider using context cancellation, which allows mgr.Start(ctx) to return cleanly, running all deferred cleanup registered with the manager.
| SecureServing: true, | ||
| FilterProvider: filters.WithAuthenticationAndAuthorization, | ||
| TLSOpts: []func(*tls.Config){tlsConfigFn}, // Apply cluster TLS profile | ||
| }, |
There was a problem hiding this comment.
curve preferences PR merged, consider setting CurvePreferences to include X25519MLKEM768 for post-quantum key exchange
There was a problem hiding this comment.
only the enhancement merged, implementation is pending https://github.com/openshift/controller-runtime-common/pull/22/changes
| // Watches for TLS profile or adherence policy changes and restarts pod to reload config | ||
| setupLog.Info("setting up TLS security profile watcher") | ||
| tlsWatcher := &tlspkg.SecurityProfileWatcher{ | ||
| Client: mgr.GetClient(), |
There was a problem hiding this comment.
The PR creates cl, err := client.New(cfg, client.Options{}) exclusively for the initial TLS fetch, then discards it. The manager creates its own
internal client. The early client uses no cache (direct API server calls) which is correct for the pre-start fetch, but the two clients represent different connection pools.
Consider passing the pre-fetched values as parameters rather than creating a second client
dc4efd2 to
41196ff
Compare
Fetch TLS configuration from cluster APIServer and apply to metrics server. Watch for TLS profile changes and restart pod to reload config. Uses SecurityProfileWatcher from controller-runtime-common following the pattern from machine-api-operator. Satisfies OpenShift 5.0 TLS Strict Obedience requirement for centralized TLS management.
41196ff to
41253d6
Compare
Add TLS strict obedience for PQC readiness
Fetch TLS configuration from cluster APIServer and apply to metrics server.
Watch for TLS profile changes and restart pod to reload config.
Uses SecurityProfileWatcher from controller-runtime-common following the pattern from machine-api-operator. Satisfies OpenShift 5.0 TLS.
Strict Obedience requirement for centralized TLS management.