Skip to content

Commit e06554f

Browse files
authored
[log] Add debug logging to LoadGatewayTLS (#5971)
## Summary Enhances `internal/server/gateway_tls.go` with additional debug logging calls in `LoadGatewayTLS` to improve observability during TLS configuration setup. ## Changes File modified: `internal/server/gateway_tls.go` Log calls added/improved: 1. (improved) Log leaf certificate count after key pair loaded 2. (new) Log CA certificate pool built successfully (mTLS path) 3. (new) Log one-way TLS configured (no client certs required) 4. (new) Log final TLS configuration ready with mtls status ## Validation - `go build ./...` passes - `go vet ./...` passes ## Logger Reuses existing `var logGatewayTLS = logger.New("server:tls")` — no new logger declaration needed. > Generated by [Go Logger Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/26066891283/agentic_workflow) · ● 9.9M · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot, version: 1.0.40, model: claude-sonnet-4.6, id: 26066891283, workflow_id: go-logger, run: https://github.com/github/gh-aw-mcpg/actions/runs/26066891283 --> <!-- gh-aw-workflow-id: go-logger -->
2 parents f330f17 + 6d0dcd0 commit e06554f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

internal/server/gateway_tls.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func LoadGatewayTLS(certPath, keyPath, caPath string) (*tls.Config, error) {
3131
if err != nil {
3232
return nil, fmt.Errorf("failed to load server TLS certificate/key: %w", err)
3333
}
34-
logGatewayTLS.Print("server TLS key pair loaded")
34+
logGatewayTLS.Printf("server TLS key pair loaded: certChainLen=%d", len(serverCert.Certificate))
3535

3636
cfg := &tls.Config{
3737
Certificates: []tls.Certificate{serverCert},
@@ -48,12 +48,16 @@ func LoadGatewayTLS(certPath, keyPath, caPath string) (*tls.Config, error) {
4848
if !caPool.AppendCertsFromPEM(caPEM) {
4949
return nil, fmt.Errorf("failed to parse CA certificate from %s", caPath)
5050
}
51+
logGatewayTLS.Printf("CA certificate pool built: ca=%s", caPath)
5152

5253
// Require and verify client certificates signed by the provided CA.
5354
cfg.ClientCAs = caPool
5455
cfg.ClientAuth = tls.RequireAndVerifyClientCert
5556
logGatewayTLS.Printf("mTLS enabled: client certificates required, CA=%s", caPath)
57+
} else {
58+
logGatewayTLS.Print("one-way TLS configured: client certificates not required")
5659
}
5760

61+
logGatewayTLS.Printf("gateway TLS configuration ready: minVersion=%s, mtls=%v", tls.VersionName(cfg.MinVersion), caPath != "")
5862
return cfg, nil
5963
}

0 commit comments

Comments
 (0)