I am having problems getting Vault working with Consul using TLS.
The error I am getting is:
[ERR] core: failed to read seal configuration: Get https://0.0.0.0:8501/v1/kv/newvault/core/seal-config: remote error: bad certificateI am generating my certs using the following commands:
openssl req -x509 -newkey rsa:2048 -days 3650 -nodes -out ca.cert
openssl req -newkey rsa:2048 -nodes -out consul.csr -keyout consul.key
openssl ca -batch -config vault_openssl.cnf -notext -in consul.csr -out consul.cert
My consul config looks like this:
{
"bootstrap_expect": 2,
"ca_file": "/etc/consul/ssl/CA/ca.crt",
"cert_file": "/etc/consul/ssl/certs/consul.crt",
"client_addr": "0.0.0.0",
"data_dir": "/var/lib/consul",
"key_file": "/etc/consul/ssl/private/consul.key",
"ports": {
"dns": 8600,
"http": 8500,
"rpc": 8400,
"serf_lan": 8301,
"serf_wan": 8302,
"server": 8300,
"https": 8501
},
"server": true,
"ui": true,
"ui_dir": "/srv/consul-ui/current",
"verify_incoming": true,
"verify_outgoing": true
}And my vault config looks like this:
{
"disable_mlock": false,
"backend": {
"consul": {
"address": "0.0.0.0:8501",
"path": "vault",
"advertise_addr": "https://my.dns.here.com:8501",
"scheme": "https"
}
},
"listener": {
"tcp": {
"address": "0.0.0.0:8200",
"tls_cert_file": "/etc/vault/ssl/certs/vault.crt",
"tls_key_file": "/etc/vault/ssl/private/vault.key"
}
}
}
I am using Ubuntu 14.04 following these directions.
I have tried many different configurations without luck and would appreciate any suggestions. If more information is needed I will happily provide it. Am I not adding the certs to server correctly?
[ ca ]
default_ca = myca
[ myca ]
unique_subject = no
new_certs_dir = .
certificate = ca.cert
database = certindex
private_key = privkey.pem
serial = serial
default_days = 3650
default_md = sha1
policy = myca_policy
x509_extensions = myca_extensions
[ myca_policy ]
commonName = supplied
stateOrProvinceName = supplied
countryName = supplied
emailAddress = optional
organizationName = supplied
organizationalUnitName = optional
[ myca_extensions ]
basicConstraints = CA:false
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always
keyUsage = digitalSignature,keyEncipherment
extendedKeyUsage = serverAuth,clientAuthopenssl s_client -connect 127.0.0.1:8200 -CAfile /etc/ssl/certs/ca-certificates.crt$ curl -v -X POST "https://127.0.0.1:8200/v1/sys/seal-status"
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8200 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Request CERT (13):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
* subject: CN=Vault
* start date: 2016-03-04 21:22:11 GMT
* expire date: 2018-03-04 21:22:11 GMT
* subjectAltName: 127.0.0.1 matched
* issuer: CN=VaultCA
* SSL certificate verify ok.
> POST /v1/sys/seal-status HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8200
> Accept: */*
>
< HTTP/1.1 405 Method Not Allowed
< Content-Type: application/json
< Date: Fri, 04 Mar 2016 22:28:31 GMT
< Content-Length: 14
<
{"errors":[]}
* Connection #0 to host 127.0.0.1 left intact
$ curl -v -X POST "https://127.0.0.1:8200/v1/auth"
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8200 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Request CERT (13):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
* subject: CN=Vault
* start date: 2016-03-04 21:22:11 GMT
* expire date: 2018-03-04 21:22:11 GMT
* subjectAltName: 127.0.0.1 matched
* issuer: CN=VaultCA
* SSL certificate verify ok.
> POST /v1/auth HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8200
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable
< Content-Type: application/json
< Date: Fri, 04 Mar 2016 22:28:43 GMT
< Content-Length: 31
<
{"errors":["Vault is sealed"]}
* Connection #0 to host 127.0.0.1 left intact
$ curl -v -X GET "https://127.0.0.1:8200/v1/sys/seal-status"
> GET /v1/sys/seal-status HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8200
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Date: Fri, 04 Mar 2016 22:37:47 GMT
< Content-Length: 136
<
{"errors":["failed to check seal configuration: Get https://0.0.0.0:8501/v1/kv/vault/core/seal-config: remote error: bad certificate"]}
* Connection #0 to host 127.0.0.1 left intact
Huh...was it the same exact cert as Consul was using? If they were separate certs it shouldn't have helped, you would need the CA instead. But, glad it's working!
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/vault/issues
IRC: #vault-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Vault" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/3087fe48-30ff-46c7-9373-ecf025d61d03%40googlegroups.com.
undefined method `bag_item' for VaultCookbook::Resource::VaultConfig
================================================================================ Error executing action `create` on resource 'ssl_certificate[consul]' ================================================================================ RuntimeError ------------ Cannot read SSL key from chef-vault: secrets.consul[private_key]