Hello, I am learning HashiCorp Vault. I went through the docs and now I am installing the product. I am following this doc.
I have a private CA and I generated a server cert signed by my private CA for my test host where Vault will run: vault.hello.com
. I would like to use this self signed certificate behind of the HashiCorp Vault.
This is my config file that I use:
$ cat $VAULT_CONFIG_FILE
/*
* Vault configuration. See: https://www.vaultproject.io/docs/configuration
*/
storage "file" {
path = "/opt/vault/data"
}
listener "tcp" {
address = "0.0.0.0:8200"
tls_cert_file = "/tmp/vault.hello.com.pem"
tls_key_file = "/tmp/vault.hello.com.key"
tls_client_ca_file = "/tmp/ca.pem"
}
cluster_addr = "https://0.0.0.0:8201"
api_addr = "https://0.0.0.0:8200"
disable_mlock = true
ui = true
I am trying to start Vault with this command in the foreground:
$ echo $VAULT_CONFIG_FILE
/etc/vault.hcl
$ vault server -config=$VAULT_CONFIG_FILE
But I get the following error:
Error parsing listener configuration.
Error initializing listener of type tcp: error loading TLS cert: tls: failed to parse private key
2023-07-23T15:32:00.070Z [INFO] proxy environment: http_proxy="" https_proxy="" no_proxy=""
2023-07-23T15:32:00.070Z [INFO] core: Initializing version history cache for core
This is how the ca.pem looks like:
Andthis is the server cert:
The private key is this one:
cat /tmp/vault.hello.com.key
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIBEzBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIyVQQPFDGOhoCAggA
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECAmDutQj7UwIBIHAz8eCEQvX3NQg
ctMvK0Gq5tV9wfQXK4rWOsG/0NVdsO3Dkic9y8gjCubVCxoywBO0mgOB6REarWXk
cB12PPLpkA0/8JUliYqgeBNh6XD+T5Jf0uEmpt7+95KpQt7bdC1W21lYMHqQCtW/
ZDeAXORnYlAEQ/Y7uFxLJ/tgaG1U27O3Pd0JGkHvCMH2xzEWoGfjiClCt73MY+Rg
RE0z89bKKj6PSNxN2qWUhE3/UJbegy3DSPLBT8PHAS4cDeatGkyy
-----END ENCRYPTED PRIVATE KEY-----
I also tried to start Vault this way, but I got the same error:
echo "changeit" | vault server -config=$VAULT_CONFIG_FILE
Error parsing listener configuration.
Error initializing listener of type tcp: error loading TLS cert: tls: failed to parse private key
2023-07-23T15:47:33.983Z [INFO] proxy environment: http_proxy="" https_proxy="" no_proxy=""
2023-07-23T15:47:33.990Z [INFO] core: Initializing version history cache for core
Could you please guide me to the right direction and help me to configure Vault properly in order to I can use my existing certificate? Thanks in advance.