Skip to content

Commit

Permalink
chore(cmd/immudb/command): handle tls configuration errors
Browse files Browse the repository at this point in the history
Signed-off-by: Michele Meloni <[email protected]>
  • Loading branch information
mmeloni committed May 7, 2021
1 parent 38d96a1 commit 08681b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/immudb/command/tls_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ func setUpTLS(pkey, cert, ca string, mtls bool) (*tls.Config, error) {
}
}

if mtls {
if mtls && (cert == "" || pkey == "") {
return nil, errors.New("in order to enable MTLS a certificate and private key are required")
}

// if CA is not provided there is an automatic load of local CA in os
if mtls && ca != "" {
certPool := x509.NewCertPool()
// Trusted store, contain the list of trusted certificates. client has to use one of this certificate to be trusted by this server
bs, err := ioutil.ReadFile(ca)
Expand Down

0 comments on commit 08681b0

Please sign in to comment.