mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-09 00:33:28 -04:00
Better error messages.
This commit is contained in:
parent
c26fca9180
commit
67993efeb0
2 changed files with 4 additions and 2 deletions
|
|
@ -46,7 +46,7 @@ func (b *backend) pathLogin(
|
|||
|
||||
// If no trusted chain was found, client is not authenticated
|
||||
if len(trustedChains) == 0 {
|
||||
return logical.ErrorResponse("invalid certificate"), nil
|
||||
return logical.ErrorResponse("invalid certificate or no client certificate supplied"), nil
|
||||
}
|
||||
|
||||
// Match the trusted chain with the policy
|
||||
|
|
|
|||
|
|
@ -113,12 +113,14 @@ func (m *Meta) Client() (*api.Client, error) {
|
|||
RootCAs: certPool,
|
||||
}
|
||||
|
||||
if m.flagClientCert != "" {
|
||||
if m.flagClientCert != "" && m.flagClientKey != "" {
|
||||
tlsCert, err := tls.LoadX509KeyPair(m.flagClientCert, m.flagClientKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tlsConfig.Certificates = []tls.Certificate{tlsCert}
|
||||
} else if m.flagClientCert != "" || m.flagClientKey != "" {
|
||||
return nil, fmt.Errorf("Both client cert and client key must be provided")
|
||||
}
|
||||
|
||||
client := *http.DefaultClient
|
||||
|
|
|
|||
Loading…
Reference in a new issue