Skip to content

Commit 4f3839b

Browse files
upgrade to latest dependencies
bumping knative.dev/pkg 9c8140b...80c8bc4: > 80c8bc4 Add TLSMaxVersion, TLSCipherSuites, and TLSCurvePreferences to webhook.Options for enhanced TLS control (# 3300) Signed-off-by: Knative Automation <[email protected]>
1 parent 37e1c70 commit 4f3839b

File tree

5 files changed

+166
-5
lines changed

5 files changed

+166
-5
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
1515
knative.dev/hack v0.0.0-20251126013634-1484a9e9b641
1616
knative.dev/networking v0.0.0-20251217020127-11890a5dabea
17-
knative.dev/pkg v0.0.0-20251216153728-9c8140b780d1
17+
knative.dev/pkg v0.0.0-20251217214024-80c8bc434670
1818
sigs.k8s.io/gateway-api v1.4.0
1919
sigs.k8s.io/yaml v1.6.0
2020
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ knative.dev/hack v0.0.0-20251126013634-1484a9e9b641 h1:N9Xqx3YLUNFN1WIc3UXTanK4j
259259
knative.dev/hack v0.0.0-20251126013634-1484a9e9b641/go.mod h1:L5RzHgbvam0u8QFHfzCX6MKxu/a/gIGEdaRBqNiVbl0=
260260
knative.dev/networking v0.0.0-20251217020127-11890a5dabea h1:CsVi1M+NbPIfvBPWI9DQOwlzBG6+w+mAfhUDqw1jeXM=
261261
knative.dev/networking v0.0.0-20251217020127-11890a5dabea/go.mod h1:gPzztUiSYDSB3yHx85xr4j2ZccEdiZDWlLsYHr7fQtg=
262-
knative.dev/pkg v0.0.0-20251216153728-9c8140b780d1 h1:pSZ4sRKm/Kq1ec+7Yhow6jUH0FKZjzrUHpPsy6Lu8pE=
263-
knative.dev/pkg v0.0.0-20251216153728-9c8140b780d1/go.mod h1:jU9OxeX3zL4W6aHpdMjMA/B7kgkm5JQv6PGMod2Qu/M=
262+
knative.dev/pkg v0.0.0-20251217214024-80c8bc434670 h1:MKgHnTvNprMn+Tr73CRB088PqR22q4KuVFIBTLFltwA=
263+
knative.dev/pkg v0.0.0-20251217214024-80c8bc434670/go.mod h1:jU9OxeX3zL4W6aHpdMjMA/B7kgkm5JQv6PGMod2Qu/M=
264264
sigs.k8s.io/gateway-api v1.4.0 h1:ZwlNM6zOHq0h3WUX2gfByPs2yAEsy/EenYJB78jpQfQ=
265265
sigs.k8s.io/gateway-api v1.4.0/go.mod h1:AR5RSqciWP98OPckEjOjh2XJhAe2Na4LHyXD2FUY7Qk=
266266
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=

vendor/knative.dev/pkg/webhook/README.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,149 @@ func main() {
7878
There is also a config map validation admission controller built in under
7979
`knative.dev/pkg/webhook/configmaps`.
8080

81+
## TLS Configuration
82+
83+
The webhook server supports configuring TLS parameters through the `webhook.Options` struct. This allows you to control the TLS version, cipher suites, and elliptic curve preferences for enhanced security.
84+
85+
### Available TLS Options
86+
87+
```go
88+
type Options struct {
89+
// ... other fields ...
90+
91+
// TLSMinVersion contains the minimum TLS version that is acceptable.
92+
// Default is TLS 1.3 if not specified.
93+
// Supported values: tls.VersionTLS12, tls.VersionTLS13
94+
TLSMinVersion uint16
95+
96+
// TLSMaxVersion contains the maximum TLS version that is acceptable.
97+
// If not set (0), the maximum version supported by the implementation will be used.
98+
// Useful for enforcing Modern profile (TLS 1.3 only) by setting both
99+
// TLSMinVersion and TLSMaxVersion to tls.VersionTLS13.
100+
TLSMaxVersion uint16
101+
102+
// TLSCipherSuites specifies the list of enabled cipher suites.
103+
// If empty, a default list of secure cipher suites will be used.
104+
// Note: Cipher suites are not configurable in TLS 1.3; they are
105+
// determined by the implementation.
106+
TLSCipherSuites []uint16
107+
108+
// TLSCurvePreferences specifies the elliptic curves that will be used
109+
// in an ECDHE handshake. If empty, the default curves will be used.
110+
TLSCurvePreferences []tls.CurveID
111+
}
112+
```
113+
114+
### Environment Variable Configuration
115+
116+
You can also configure the minimum TLS version via the `WEBHOOK_TLS_MIN_VERSION` environment variable:
117+
118+
```yaml
119+
env:
120+
- name: WEBHOOK_TLS_MIN_VERSION
121+
value: "1.3" # or "1.2"
122+
```
123+
124+
### Usage Examples
125+
126+
#### Example 1: Default Configuration (Recommended)
127+
128+
By default, the webhook uses TLS 1.3 as the minimum version with secure defaults:
129+
130+
```go
131+
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
132+
ServiceName: "webhook",
133+
Port: 8443,
134+
SecretName: "webhook-certs",
135+
// TLS defaults: MinVersion=1.3, secure cipher suites and curves
136+
})
137+
```
138+
139+
#### Example 2: Modern Profile (TLS 1.3 Only)
140+
141+
To enforce TLS 1.3 only (highest security profile):
142+
143+
```go
144+
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
145+
ServiceName: "webhook",
146+
Port: 8443,
147+
SecretName: "webhook-certs",
148+
TLSMinVersion: tls.VersionTLS13,
149+
TLSMaxVersion: tls.VersionTLS13, // Enforce TLS 1.3 only
150+
})
151+
```
152+
153+
#### Example 3: Intermediate Profile (TLS 1.2+)
154+
155+
For broader compatibility while maintaining security:
156+
157+
```go
158+
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
159+
ServiceName: "webhook",
160+
Port: 8443,
161+
SecretName: "webhook-certs",
162+
TLSMinVersion: tls.VersionTLS12,
163+
})
164+
```
165+
166+
#### Example 4: Custom Cipher Suites
167+
168+
To specify custom cipher suites (for TLS 1.2):
169+
170+
```go
171+
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
172+
ServiceName: "webhook",
173+
Port: 8443,
174+
SecretName: "webhook-certs",
175+
TLSMinVersion: tls.VersionTLS12,
176+
TLSCipherSuites: []uint16{
177+
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
178+
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
179+
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
180+
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
181+
},
182+
})
183+
```
184+
185+
#### Example 5: Custom Elliptic Curves
186+
187+
To specify elliptic curve preferences:
188+
189+
```go
190+
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
191+
ServiceName: "webhook",
192+
Port: 8443,
193+
SecretName: "webhook-certs",
194+
TLSCurvePreferences: []tls.CurveID{
195+
tls.X25519, // Preferred
196+
tls.CurveP256,
197+
tls.CurveP384,
198+
},
199+
})
200+
```
201+
202+
#### Example 6: Complete Custom Configuration
203+
204+
For full control over TLS parameters:
205+
206+
```go
207+
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
208+
ServiceName: "webhook",
209+
Port: 8443,
210+
SecretName: "webhook-certs",
211+
TLSMinVersion: tls.VersionTLS12,
212+
TLSMaxVersion: tls.VersionTLS13,
213+
TLSCipherSuites: []uint16{
214+
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
215+
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
216+
},
217+
TLSCurvePreferences: []tls.CurveID{
218+
tls.X25519,
219+
tls.CurveP256,
220+
},
221+
})
222+
```
223+
81224
## Writing new Admission Controllers
82225

83226
To implement your own admission controller akin to the resource defaulting and

vendor/knative.dev/pkg/webhook/webhook.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ type Options struct {
5252
// TLS 1.3 is the minimum version if not specified otherwise.
5353
TLSMinVersion uint16
5454

55+
// TLSMaxVersion contains the maximum TLS version that is acceptable.
56+
// If not set (0), the maximum version supported by the implementation will be used.
57+
// This is useful for enforcing Modern profile (TLS 1.3 only) by setting both
58+
// TLSMinVersion and TLSMaxVersion to tls.VersionTLS13.
59+
TLSMaxVersion uint16
60+
61+
// TLSCipherSuites specifies the list of enabled cipher suites.
62+
// If empty, a default list of secure cipher suites will be used.
63+
// Note: Cipher suites are not configurable in TLS 1.3; they are determined by the implementation.
64+
TLSCipherSuites []uint16
65+
66+
// TLSCurvePreferences specifies the elliptic curves that will be used in an ECDHE handshake.
67+
// If empty, the default curves will be used.
68+
TLSCurvePreferences []tls.CurveID
69+
5570
// ServiceName is the service name of the webhook.
5671
ServiceName string
5772

@@ -191,7 +206,10 @@ func New(
191206

192207
//nolint:gosec // operator configures TLS min version (default is 1.3)
193208
webhook.tlsConfig = &tls.Config{
194-
MinVersion: opts.TLSMinVersion,
209+
MinVersion: opts.TLSMinVersion,
210+
MaxVersion: opts.TLSMaxVersion,
211+
CipherSuites: opts.TLSCipherSuites,
212+
CurvePreferences: opts.TLSCurvePreferences,
195213

196214
// If we return (nil, error) the client sees - 'tls: internal error"
197215
// If we return (nil, nil) the client sees - 'tls: no certificates configured'

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ knative.dev/networking/test/test_images/runtime/handlers
10751075
knative.dev/networking/test/test_images/timeout
10761076
knative.dev/networking/test/test_images/wsserver
10771077
knative.dev/networking/test/types
1078-
# knative.dev/pkg v0.0.0-20251216153728-9c8140b780d1
1078+
# knative.dev/pkg v0.0.0-20251217214024-80c8bc434670
10791079
## explicit; go 1.24.0
10801080
knative.dev/pkg/apis
10811081
knative.dev/pkg/apis/duck

0 commit comments

Comments
 (0)