Skip to content

Commit

Permalink
SP-1078 Fix chain certificate load issue
Browse files Browse the repository at this point in the history
  • Loading branch information
perezale committed Jul 10, 2024
1 parent c85b2dd commit 01ca4fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Upcoming changes...

## [1.4.2] - 2024-07-10
### Fixed
- Fixed issue loading TLS chained certificates.

## [1.4.1] - 2024-03-22
### Added
- Added Telemetry option to fine tune which host level metrics are produced by default
Expand Down
8 changes: 7 additions & 1 deletion pkg/protocol/rest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ func RunServer(config *myconfig.ServerConfig, version string) error {
func loadTLSConfig(config *myconfig.ServerConfig, srv *http.Server) {
pemBlocks := loadCertFile(config)
pkey := loadPrivateKey(config)
c, err := tls.X509KeyPair(pem.EncodeToMemory(pemBlocks[0]), pkey)

var combinedPem []byte
for _, pemBlock := range pemBlocks {
combinedPem = append(combinedPem, pem.EncodeToMemory(pemBlock)...)
}

c, err := tls.X509KeyPair(combinedPem, pkey)
if err != nil {
zlog.S.Panicf("Failed to load TLS key pair (%v - %v): %v", config.TLS.KeyFile, config.TLS.CertFile, err)
}
Expand Down

0 comments on commit 01ca4fd

Please sign in to comment.