Skip to content

Feature: mtls filters#4044

Merged
szuecs merged 24 commits into
masterfrom
feature/mTLS-filters
Jun 18, 2026
Merged

Feature: mtls filters#4044
szuecs merged 24 commits into
masterfrom
feature/mTLS-filters

Conversation

@szuecs

@szuecs szuecs commented Jun 1, 2026

Copy link
Copy Markdown
Member

feature: mtlsSanCIDR(), mtlsSanDNS(), mtlsSanIP(), mtlsSanURI() filters
feature: mtlsIssuerDN() filter
feature: mtlsCN() filter
feature: mtlsAuthn() filter
doc: document mtls authnz filters
doc: mTLS operations guide
test: benchmarks

ref: closing #3295

@szuecs szuecs force-pushed the feature/mTLS-filters branch from 878795b to d35f4f6 Compare June 2, 2026 11:32
@szuecs szuecs force-pushed the feature/mTLS-filters branch from e07710c to 144a2b8 Compare June 2, 2026 20:22
@szuecs szuecs added the major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs label Jun 2, 2026
@szuecs szuecs marked this pull request as ready for review June 2, 2026 20:23
@szuecs szuecs mentioned this pull request Jun 3, 2026
@vlktna vlktna self-requested a review June 3, 2026 16:28
Comment thread filters/tls/mtls.go Outdated
Comment thread filters/tls/mtls.go Outdated
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go Outdated
Comment thread docs/reference/filters.md
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go
Comment thread docs/reference/filters.md
@szuecs

szuecs commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

Given that auth should be fast, I will also provide 4 more filters for mtlsSAN to have them special, for example if you use SPIFFE/SPIRE, you do not want to check DNS or IP in SAN.

@szuecs

szuecs commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

e634e6e has the 4 new filters

@szuecs

szuecs commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

Local test without CA loaded, so empty pool it can not validate certs:

% ./bin/skipper -inline-routes='r: * -> mtlsAuthn() -> status(201) -> <shunt>' -address :9002                                                                     feature/mTLS-filters
[APP]INFO[0000] Expose metrics in format: "codahale"
[APP]INFO[0000] enable swarm: false
[APP]INFO[0000] Replacing tee filter specification
[APP]INFO[0000] Replacing teenf filter specification
[APP]INFO[0000] Replacing teeResponse filter specification
[APP]INFO[0000] route settings, reset, route: r: * -> mtlsAuthn() -> status(201) -> <shunt>
[APP]INFO[0000] route settings received, id: 1
[APP]INFO[0000] support listener on :9911
[APP]INFO[0000] route settings applied, id: 1
[APP]INFO[0000] Dataclients are updated once, first load complete
[APP]INFO[0000] Listen on :9002
[APP]INFO[0000] TLS settings not found, defaulting to HTTP
::1 - - [03/Jun/2026:22:10:26 +0200] "GET /foo HTTP/1.1" 401 0 "-" "curl/7.49.0" 0 localhost:9002 - -

client call sent with no cert:

% curl http://localhost:9002/foo -v
*   Trying ::1...
* Connected to localhost (::1) port 9002 (#0)
> GET /foo HTTP/1.1
> Host: localhost:9002
> User-Agent: curl/7.49.0
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Server: Skipper
< Www-Authenticate: localhost:9002
< Date: Wed, 03 Jun 2026 20:10:26 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact

We can see good default behaviour and no panic, so integration seems also fine

Comment thread filters/tls/mtls.go Outdated
Comment thread filters/tls/mtls.go Outdated
Comment thread filters/tls/mtls.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go Outdated
Comment thread docs/reference/filters.md Outdated
Comment thread docs/reference/filters.md Outdated
Comment thread filters/tls/mtls.go Outdated
@szuecs

szuecs commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@MustafaSaber I can't reply to your message directly so doing it here:
it's fixed

@szuecs

szuecs commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@MustafaSaber fixed your comments

szuecs added 7 commits June 15, 2026 20:56
feature: mtlsIssuerDN() filter
feature: mtlsCN() filter
feature: mtlsAuthn() filter
doc: document mtls authnz filters

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
fix: linter finding in test

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
…ntegration

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
… used to validate in coming client certificates.

Configuration is able to load system CAs first and append given PEM encoded CA files or we load only given PEM encoded CA files or if nil we load system CAs.

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
szuecs added 12 commits June 15, 2026 20:56
…, because we care about the identity of the client and not the identity of the CA

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
…sSanDNS(), mtlsSanIP(), mtlsSandURI()

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
fix: support multiple CA files in config

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
…o it

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
@szuecs szuecs force-pushed the feature/mTLS-filters branch from c8db630 to fee0a26 Compare June 15, 2026 18:56
@a4180p

a4180p commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

👍

Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go Outdated
Comment thread filters/tls/mtls.go
szuecs added 2 commits June 17, 2026 14:24
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go
Comment thread filters/tls/mtls.go Outdated
Comment thread skipper.go
szuecs added 3 commits June 17, 2026 19:05
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
…d without (dynamic loading)

goos: linux
goarch: amd64
pkg: github.com/zalando/skipper/filters/tls
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate            	    5022	    222590 ns/op	    2834 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate            	    5409	    220001 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate            	    5341	    219619 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-2          	    5449	    221375 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-2          	    5460	    199491 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-2          	    8589	    138819 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-4          	    7521	    133728 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-4          	    7918	    133322 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-4          	    7702	    134525 ns/op	    2832 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-8          	    7489	    134389 ns/op	    2833 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-8          	    7936	    134130 ns/op	    2833 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-8          	    7844	    136407 ns/op	    2833 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-16         	    9087	    133932 ns/op	    2834 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-16         	    7815	    134132 ns/op	    2834 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/with_intermediate-16         	    7556	    135460 ns/op	    2834 B/op	      58 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate         	    7386	    138940 ns/op	    3691 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate         	    8871	    133471 ns/op	    3688 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate         	    8928	    133752 ns/op	    3688 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-2       	    7479	    134304 ns/op	    3688 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-2       	    8996	    133722 ns/op	    3688 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-2       	    8937	    134236 ns/op	    3688 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-4       	    8936	    134183 ns/op	    3689 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-4       	    7634	    134876 ns/op	    3689 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-4       	    8473	    135427 ns/op	    3689 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-8       	    7560	    137636 ns/op	    3690 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-8       	    7602	    137134 ns/op	    3690 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-8       	    8935	    135769 ns/op	    3689 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-16      	    8604	    135190 ns/op	    3691 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-16      	    7954	    135384 ns/op	    3691 B/op	      68 allocs/op
BenchmarkMtlsAuthnCaIntermediateLeaf/without_intermediate-16      	    7665	    135775 ns/op	    3691 B/op	      68 allocs/op
PASS
ok  	github.com/zalando/skipper/filters/tls	33.323s

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
…uld not add this

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
@shyamz-22

Copy link
Copy Markdown
Collaborator

👍🏽

1 similar comment
@szuecs

szuecs commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation enhancement major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants