Vault: transport connection broken: malformed HTTP response when TLS enabled.

Created on 23 Oct 2018  路  2Comments  路  Source: hashicorp/vault

Enabling TLS is resulting in following error:

$vault status                                                
Error checking seal status: Get http://127.0.0.1:8200/v1/sys/seal-status: net/ht
tp: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\
x00\x02\x02"      


$ vault operator init                                         
Error initializing: Put http://127.0.0.1:8200/v1/sys/init: net/http: HTTP/1.x tr
ansport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"

Environment:

  • Vault Server Version : 0.9.6
  • Vault CLI Version : Vault v0.9.6
  • Server Operating System/Architecture: Alpine

Vault server configuration file(s):

```$ cat config.hcl
disable_mlock = true

storage "postgresql" {
connection_url = "postgres://vault:vault@postgresql:5432/postgres?sslmode=disa
ble"
}

listener "tcp" {
address = "0.0.0.0:8200"
tls_disable = 0
tls_cert_file = "/etc/certs/vault-server.crt"
tls_key_file = "/etc/certs/vault-server.key"
}

max_lease_ttl = "7200h"
default_lease_ttl = "7200h"

Everything works fine when tls is disabled, tls_disable set to 1. 

Vault logs:

==> Vault server configuration:
聽 | 聽
聽 | Cgo: disabled
聽 | Listener 1: tcp (addr: "0.0.0.0:8200", cluster address: "0.0.0.0:8201", tls: "enabled")
聽 | Log Level: info
聽 | Mlock: supported: true, enabled: false
聽 | Storage: postgresql
聽 | Version: Vault v0.9.6
聽 | Version Sha: 7e1fbde40afee241f81ef08700e7987d86fc7242
聽 | 聽
聽 | ==> Vault server started! Log data will stream in below:

```

Most helpful comment

It appears you have not updated your environment variable for using HTTPS. You are still connecting to http://... so setting the VAULT_ADDR environment variable should fix your issue.

All 2 comments

It appears you have not updated your environment variable for using HTTPS. You are still connecting to http://... so setting the VAULT_ADDR environment variable should fix your issue.

This means the HTTP response is encrypted while you are expecting a plain text one bec you set the VAULT_ADDR enviroment var. in HTTP. @chrishoffman thanks

Was this page helpful?
0 / 5 - 0 ratings