vault icon indicating copy to clipboard operation
vault copied to clipboard

Vault MSSQL configuration error

Open RohanKurane opened this issue 8 years ago • 4 comments

While trying to connect to MSSQL I get the following error.

vault write database/config/my-mssql-database plugin_name=mssql-database-plugin connection_url='sqlserver://sa:yourStrong(!)Password@localhost:12357' allowed_roles="my-role" Error writing data to database/config/my-mssql-database: Error making API request.

URL: PUT http://127.0.0.1:12357/v1/database/config/my-mssql-database Code: 400. Errors:

  • error creating database object: error verifying connection: read tcp 127.0.0.1:40702->127.0.0.1:12357: i/o timeout

................................. vault status Key Value


Seal Type shamir Sealed false Total Shares 5 Threshold 3 Version 0.9.5 Cluster Name vault-cluster-1c1fc5dc Cluster ID 264a4deb-9cc7-77c5-36c6-f40db610f324 HA Enabled false

@chrishoffman in case you can help out.

RohanKurane avatar Mar 03 '18 07:03 RohanKurane

Your connection string is not pointing to a SQL Server. You are telling Vault to try to talk to a SQL Server at localhost:12357, but you've got Vault running there. So, Vault is expecting to talk to a SQL Server, but instead it's talking to itself, which is really an HTTP server, and that's why you're seeing the error message. You need to update your connection string to point to a valid SQL Server reachable from the Vault server.

joelthompson avatar Mar 03 '18 16:03 joelthompson

@joelthompson Thanks again Joel. Is there a SQL plugin I need to download for this ? Is there an example you can point me to ? What if I have my SQL server running on localhost where vault server is running as well. What would change above ?

RohanKurane avatar Mar 05 '18 01:03 RohanKurane

The MSSQL plugin is built into vault and you are referencing it correctly above. As Joel stated, you need to have SQL Server accessible from your vault instance which could include running it on localhost.

chrishoffman avatar Jul 06 '18 14:07 chrishoffman

I hit other issue by using the command: vault write database/config/my-mssql-database plugin_name=mssql-database-plugin connection_url='sqlserver://{{username}}:{{password}}@127.0.0.1:1433' allowed_roles="my-role" username="yyyyyy" password="xxxxxxxx"

error i got: "error creating database object: error verifying connection: failed to send SQL Batch: write tcp 127.0.0.1:49380->127.0.0.1:1433: wsasend: An existing connection was forcibly closed by the remote host."

it seems to be GoLang issue when running sql batch to sql server?

tatsean avatar Jul 11 '18 06:07 tatsean