hcl icon indicating copy to clipboard operation
hcl copied to clipboard

Unable to unseal vault when started with hcl or config file

Open jumbo007 opened this issue 8 years ago • 2 comments

Hi

I am following below steps to start and unseal vault for secret storage.

  1. Started zookeeper on my local windows setup on 2181 port

  2. Created one path "vault" in zookeeper

[zk: localhost:2181(CONNECTED) 0] ls / [zookeeper, vault] [zk: localhost:2181(CONNECTED) 1]

Created one file vault.hcl as:

backend "zookeeper" { address = "127.0.0.1:2181" redirect_addr = "http://127.0.0.1:8200" path = "vault/" }

listener "tcp" { address = "127.0.0.1:8200" tls_disable = true }

Started vault using above configuration file and got below response as: D:\WORK\KMS>vault server -config=etc\vault.hcl ==> WARNING: mlock not supported on this system!

An mlockall(2)-like syscall to prevent memory from being swapped to disk is not supported on this system. Running Vault on an mlockall(2) enabled system is much more secure.

==> Vault server configuration: 2018/02/12 12:49:26 Connected to 127.0.0.1:2181

             Cgo: disabled
 Cluster Address: https://127.0.0.1:8201
      Listener 1: tcp (addr: "127.0.0.1:8200", cluster address: "127.0.0.1:8201", tls: "disabled")
       Log Level: info
           Mlock: supported: false, enabled: false
Redirect Address: http://127.0.0.1:8200
         Storage: zookeeper (HA available)
         Version: Vault v0.9.0
     Version Sha: bdac1854478538052ba5b7ec9a9ec688d35a3335

==> Vault server started! Log data will stream in below:

2018/02/12 12:49:26 Authenticated: id=99511096385601541, timeout=4000 2018/02/12 12:49:26 Re-submitting 0 credentials after reconnect 2018/02/12 12:49:39.216306 [ERROR] core: failed to read seal configuration: error=zk: invalid path

Tried to unseal vault using CLI but got below error: D:\WORK\KMS>vault unseal --Error checking seal status: Get https://127.0.0.1:8200/v1/sys/seal-status: http: server gave HTTP response to HTTPS client

--On Postman, sending a GET request on "http://127.0.0.1:8200/v1/sys/seal-status" gives below response:

{ "errors": [ "failed to check seal configuration: zk: invalid path" ] }

--On postman sending a GET request on "http://127.0.0.1:8200/v1/sys/unseal" gives below response:

{ "errors": [] }

No error posted on console in this case.

What is the correct way to start and unseal vault with zookeeper as storage?

jumbo007 avatar Feb 12 '18 11:02 jumbo007

Attempt2:-

1.hcl file content:

backend "zookeeper" { address = "127.0.0.1:2181" redirect_addr = "http://127.0.0.1:8200" path = "vault/" }

2. O/P of vault server -config=etc\vault.hcl D:\WORK\KMS>vault server -config=etc\vault.hcl ==> WARNING: mlock not supported on this system!

An mlockall(2)-like syscall to prevent memory from being swapped to disk is not supported on this system. Running Vault on an mlockall(2) enabled system is much more secure.

==> Vault server configuration:

             Cgo: disabled
 Cluster Address: https://127.0.0.1:8201
       Log Level: info
           Mlock: supported: false, enabled: false
Redirect Address: http://127.0.0.1:8200
         Storage: zookeeper (HA available)
         Version: Vault v0.9.0

2018/02/12 17:29:07 Connected to 127.0.0.1:2181 Version Sha: bdac185

==> Vault server started! Log data will stream in below:

2018/02/12 17:29:07 Authenticated: id=99512262965067777, timeout=4000 2018/02/12 17:29:07 Re-submitting 0 credentials after reconnect

3. o/p of:- vault init Error initializing Vault: Put https://127.0.0.1:8200/v1/sys/init: dial tcp 127.0.0.1:8200: connectex: No connection could be made because the target machine actively refused it.

Where am I missing the step and how to initialise and unseal vault?

Thanks

jumbo007 avatar Feb 12 '18 12:02 jumbo007

Hi @jumbo007! I'm sorry this isn't working as expected.

This seems like a Vault question rather than an HCL question. You're more likely to get a good answer to your question via one of Vault's community forums, since the Vault team and community don't tend to monitor this repository.

Since this isn't a feature request or bug report for HCL, I'm going to close this.

apparentlymart avatar Feb 16 '18 05:02 apparentlymart