Better error messages.

This commit is contained in:
Karl Gutwin 2015-06-30 08:59:38 -04:00
parent c26fca9180
commit 67993efeb0
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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