Hello, I’ve been getting the same error when running a simple command like vault status
no matter how I generated my TLS certs:
Error checking seal status: Get "https://127.0.0.1:8200/v1/sys/seal-status": x509: certificate signed by unknown authority
From the Vault logs themselves, it’s simply saying:
2021-06-19T17:45:18.097-0700 [INFO] http: TLS handshake error from 127.0.0.1:45904: remote error: tls: bad certificate
My vault.hcl
is:
listener "tcp" {
tls_cert_file = "/etc/certs/cert.pem"
tls_key_file = "/etc/certs/cert-key.pem"
tls_client_ca_file = "/etc/certs/ca.pem"
}
storage "consul" {
# Assumes consul is running on the same node
address = "127.0.0.1:8500"
path = "vault/"
token = "<REDACTED>"
}
Here’s how I’ve been generating my certs locally on my workstation.
# Generate CA
openssl req -x509 -newkey rsa:4096 -days 365 -nodes -keyout ca-key.pem -out ca.pem
# Generate cert
openssl req -newkey rsa:4096 -nodes -keyout cert-key.pem -out cert-req.pem
# Sign cert
openssl x509 -req -in cert-req.pem -days 60 -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -extfile ext.cnf
Note that ext.cnf
is just
subjectAltName=IP:127.0.0.1
What am I doing wrong here? I’ve also pasted the actual certs I’ve generated below for further reference. Thanks, any help is much appreciated!
# ca.pem
-----BEGIN CERTIFICATE-----
MIIFGDCCAwACCQDBPG2uhOfA9jANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJV
UzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAkxBMQswCQYDVQQKDAJMQTELMAkGA1UE
CwwCTGExCzAJBgNVBAMMAkxBMB4XDTIxMDYyMDAxMDUxOVoXDTIyMDYyMDAxMDUx
OVowTjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJMQTELMAkG
A1UECgwCTEExCzAJBgNVBAsMAkxhMQswCQYDVQQDDAJMQTCCAiIwDQYJKoZIhvcN
AQEBBQADggIPADCCAgoCggIBANi4cy0nhzMkBUf9soL/J3pq1VrbtXMaRyQY7EF5
POGcAx5kDyu/6aGA1+ds8Y6M6d9T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