Skip to content

Commit

Permalink
require a TLS client certificate by default (#453)
Browse files Browse the repository at this point in the history
This commit changes the `ClientAuth` type from
`RequestClientCert` to `RequireAnyClientCert` by default.

In general, a KES server should demand a client certificate.
Otherwise, a client (the HTTP/TLS stack) may choose to not
send a client certificate - even if one is available. For example,
the HTTP stack may try to be smart and not send a client certificate
if it determines that cannot be validated since its self-signed.

Instead, the KES server's TLS should abort the handshake if the client
does not send a certificate. However, in some cases we cannot enforce
this. In particular, when some APIs should be accessible without TLS
authentication, like `/v1/metrics`. In these cases, we have to make
it optional for clients to send a certificate. However, disabling
auth for some APIs is an advanced use case intended only for users
who are aware of the implications.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
  • Loading branch information
aead committed Mar 13, 2024
1 parent ca2ed00 commit 2f5a124
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 86 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.5
go-version: 1.21.8
check-latest: true
id: go
- name: Check out code
Expand All @@ -34,7 +34,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v3
with:
go-version: 1.21.5
go-version: 1.21.8
id: go
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.5
go-version: 1.21.8
check-latest: true
id: go
- name: Check out code
Expand All @@ -74,7 +74,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.21.5
go-version: 1.21.8
check-latest: true
- name: Get govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.5
go-version: 1.21.8
check-latest: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand Down
2 changes: 1 addition & 1 deletion cmd/kes/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func startDevServer(addr string) error {
MinVersion: tls.VersionTLS12,
NextProtos: []string{"h2", "http/1.1"},
Certificates: []tls.Certificate{srvCert},
ClientAuth: tls.RequestClientCert,
ClientAuth: tls.RequireAnyClientCert,
}

ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
Expand Down
50 changes: 24 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ go 1.21
require (
aead.dev/mem v0.2.0
aead.dev/minisign v0.2.1
cloud.google.com/go/secretmanager v1.11.4
cloud.google.com/go/secretmanager v1.11.5
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
github.com/aws/aws-sdk-go v1.49.17
github.com/charmbracelet/lipgloss v0.9.1
github.com/aws/aws-sdk-go v1.50.37
github.com/charmbracelet/lipgloss v0.10.0
github.com/fatih/color v1.16.0
github.com/hashicorp/vault/api v1.10.0
github.com/hashicorp/vault/api v1.12.0
github.com/minio/kms-go/kes v0.3.1-0.20240226133855-0dfed1a72132
github.com/minio/selfupdate v0.6.0
github.com/muesli/termenv v0.15.2
github.com/prometheus/client_golang v1.18.0
github.com/prometheus/common v0.45.0
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/common v0.50.0
github.com/spf13/pflag v1.0.5
github.com/tinylib/msgp v1.1.9
golang.org/x/crypto v0.18.0
golang.org/x/sys v0.16.0
golang.org/x/term v0.16.0
google.golang.org/api v0.155.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
golang.org/x/crypto v0.21.0
golang.org/x/sys v0.18.0
golang.org/x/term v0.18.0
google.golang.org/api v0.160.0
google.golang.org/grpc v1.61.0
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -68,29 +68,27 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
)

0 comments on commit 2f5a124

Please sign in to comment.