Skip to content

Commit

Permalink
fix internal/pkg/agent/cmd.TestEnroll (elastic#5741)
Browse files Browse the repository at this point in the history
fix the mock fleet server used on internal/pkg/agent/cmd.TestEnroll was using the root certificate instead its own TLS certificate. 
As soon as elasitc-agent-libs is updated to v1.12.0+ it becomes a problem as the root certificates do not come with IPs and SANs anymore. Therefore the client cannot verify the certificate indeed belongs to the server.
  • Loading branch information
AndersonQ authored Oct 8, 2024
1 parent 0d5b335 commit ae48b95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/pkg/agent/cmd/enroll_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ func mTLSServer(t *testing.T, agentPassphrase string) (
// configure server's TLS
fleetRootCertPool := x509.NewCertPool()
fleetRootCertPool.AppendCertsFromPEM(fleetRootPair.Cert)
cert, err := tls.X509KeyPair(fleetRootPair.Cert, fleetRootPair.Key)
cert, err := tls.X509KeyPair(fleetChildPair.Cert, fleetChildPair.Key)
require.NoError(t, err, "could not create tls.Certificates from child certificate")

agentRootCertPool := x509.NewCertPool()
Expand Down

0 comments on commit ae48b95

Please sign in to comment.