Hi all,
For learning purposes (I’m one in charge of bringing Vault into my company), I’m setting Vault Docker environments by hand, with increasing completeness, following the official Hashicorp tutorials and docs. The last successful step was a cluster with manual join and unseal, and without TLS, adapting the procedure in the Vault with Integrated Storage Deployment Guide.
Now I need help for the next step: use TLS, with the auto-signed certificate provided by Vault installer. I got stuck at making Vault accept that certificate.
I’m clueless about managing certificate authorities, so I’m looking (at this time) for a way to make Vault use the certificate, and be OK with it being auto-signed.
No-TLS working cluster config file:
disable_mlock = true
api_addr = "http://vault_X:8200"
cluster_addr = "https://vault_X:8201"
storage "raft" {
path = "/opt/vault/data"
node_id = "vault_X"
}
# HTTP listener
listener "tcp" {
address = "0.0.0.0:8200"
tls_disable = "true"
}
Environment variable:
VAULT_ADDR="http://vault_ad_X:8200"
After initialization, join, unseal and login, I got all members present with vault operator members
, and confirmed the cluster is working by managing a key in all nodes:
# Standby node 2
vault secrets enable -path=spam kv
vault kv put spam/ham knights=ni
# Standby node 3
vault kv get spam/ham
===== Data =====
Key Value
--- -----
knights ni
# Active node 1
vault secrets disable spam
# Standby node 3
vault kv get spam/ham
Code: 403. Errors:
* preflight capability check returned 403, please ensure client's policies grant access to path "spam/ham/"
To start in TLS, I changed the schema in api_addr
to https and added the provided files in the listener directives of the config file, but disabling client authentication (not sure if that makes sense):
disable_mlock = true
api_addr = "https://vault_X:8200"
cluster_addr = "https://vault_X:8201"
storage "raft" {
path = "/opt/vault/data"
node_id = "vault_X"
}
# HTTPS listener
listener "tcp" {
address = "0.0.0.0:8200"
tls_cert_file = "/opt/vault/tls/tls.crt"
tls_key_file = "/opt/vault/tls/tls.key"
tls_disable_client_certs = "true"
}
Then set properties and permissions of provided files as instructed in the same guide:
chown root:root /opt/vault/tls/tls.crt
chown root:vault /opt/vault/tls/tls.key
chmod 0644 /opt/vault/tls/tls.crt
chmod 0640 /opt/vault/tls/tls.key
Environment variable:
VAULT_ADDR="https://vault_ad_X:8200"
Then, I got stuck at initializing the active server:
vault operator init &
[INFO] http: TLS handshake error from <Node IP>:36584: remote error: tls: bad certificate
Error initializing: Put "https://vault_1:8200/v1/sys/init": x509: certificate is not valid for any names, but wanted to match vault_1
Is there a way to make Vault skip that name match and be happy with the certificate? Or to add names to this certificate?
Thanks a lot,
Emerson