Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vault segfaults if removing auto-unseal from config #8397

Closed
thusoy opened this issue Feb 20, 2020 · 1 comment · Fixed by #8517
Closed

Vault segfaults if removing auto-unseal from config #8397

thusoy opened this issue Feb 20, 2020 · 1 comment · Fixed by #8517
Assignees
Labels
bug Used to indicate a potential bug core/seal

Comments

@thusoy
Copy link

thusoy commented Feb 20, 2020

Describe the bug
If first configuring vault with Google Cloud KMS for auto-unseal, then removing that from the config and starting up, the server will segfault.

To Reproduce
Steps to reproduce the behavior:

  1. Initialize a vault with Google Cloud KMS auto-unseal
  2. Remove the seal block from the config and restart.
  3. See error

Expected behavior
Clear error message that some config combination is invalid.

Environment:

  • Vault Server Version (retrieve with vault status): 1.3.2
  • Vault CLI Version (retrieve with vault version): 1.3.2
  • Server Operating System/Architecture: Debian 10

Vault server configuration file(s):

{
  "api_addr": "https://<private-ip>:8200",
  "cluster_name": "thusoy-test-vault",
  "listener": {
    "tcp": {
      "address": "0.0.0.0:8200",
      "tls_cert_file": "/etc/vault/cert.pem",
      "tls_cipher_suites": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
      "tls_key_file": "/etc/vault/key.pem",
      "tls_prefer_server_ciphers": "true"
    }
  },
  "seal": {
    "gcpckms": {
      "crypto_key": "vault-test-01",
      "key_ring": "vault-test",
      "project": "test-vault-<project-id>",
      "region": "us-west2"
    }
  },
  "storage": {
    "gcs": {
      "bucket": "thusoy-test-vault",
      "ha_enabled": "true"
    }
  },
  "ui": true
}

Remove the seal block to provoke the crash.

Additional context

systemd[1]: Started Vault.
vault[2276]: ==> Vault server configuration:
vault[2276]:              Api Address: https://10.168.0.4:8200
vault[2276]:                      Cgo: disabled
vault[2276]:          Cluster Address: https://10.168.0.4:8201
vault[2276]:               Listener 1: tcp (addr: "0.0.0.0:8200", cluster address: "0.0.0.0:8201", max_request_duration: "1m30s", max_request_size: "33554432", tls: "enabled")
vault[2276]:                Log Level: info
vault[2276]:                    Mlock: supported: true, enabled: true
vault[2276]:            Recovery Mode: false
vault[2276]:                  Storage: gcs (HA available)
vault[2276]:                  Version: Vault v1.3.2
vault[2276]: panic: runtime error: invalid memory address or nil pointer dereference
vault[2276]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x292e292]
vault[2276]: goroutine 1 [running]:
vault[2276]: github.com/hashicorp/vault/command.adjustCoreForSealMigration(0x3b18640, 0xc00069ff80, 0xc0008bd600, 0x3b1ea80, 0xc0005b22d0, 0x0, 0x0, 0x1, 0xc0007bd020)
vault[2276]: #011/go/src/github.com/hashicorp/vault/command/server_util.go:92 +0x282
vault[2276]: github.com/hashicorp/vault/command.(*ServerCommand).Run(0xc000645900, 0xc00004c0a0, 0x2, 0x2, 0x0)
vault[2276]: #011/go/src/github.com/hashicorp/vault/command/server.go:1437 +0x4547
vault[2276]: github.com/hashicorp/vault/vendor/github.com/mitchellh/cli.(*CLI).Run(0xc0000dda40, 0xc0000dda40, 0xc0001e7ea0, 0xc0001e7da0)
vault[2276]: #011/go/src/github.com/hashicorp/vault/vendor/github.com/mitchellh/cli/cli.go:255 +0x1f1
vault[2276]: github.com/hashicorp/vault/command.RunCustom(0xc00004c090, 0x3, 0x3, 0xc0000a7680, 0xc000090058)
vault[2276]: #011/go/src/github.com/hashicorp/vault/command/main.go:180 +0x862
vault[2276]: github.com/hashicorp/vault/command.Run(...)
vault[2276]: #011/go/src/github.com/hashicorp/vault/command/main.go:88
vault[2276]: main.main()
vault[2276]: #011/go/src/github.com/hashicorp/vault/main.go:10 +0x6c
systemd[1]: vault.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
@michelvocks michelvocks added bug Used to indicate a potential bug core/seal labels Feb 21, 2020
@michelvocks michelvocks self-assigned this Feb 21, 2020
@ApsOps
Copy link

ApsOps commented Feb 26, 2020

I encountered the same issue with AWS KMS. Vault version 1.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug core/seal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants