-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 startup fails when using MSSQL as storage backend with pre-created database and schema #6328
Comments
Thanks for opening this issue, @kedarkale27! Looks like the error is originating from here. Is it possible for you to simply not pre-create the schema and to let the |
@tyrannosaurus-becks We have also published a fix which solves this issue: The code expects the sql commands to be executed in the same database session as of the "USE DATABASE" command,But for Go lang some how it is not working |
Thanks! Happy to review it after the submitter agreement is signed. |
@tyrannosaurus-becks I have already signed it yesterday. |
@tyrannosaurus-becks Did you get a chance to review the code? |
Hi @tyrannosaurus-becks the test case has been added to verify the updated code. Can you please check and approve ? Thanks! |
Any new with this issue, i am experience exactly the same behavior as @kedarkale27 mention |
Please follow the linked PR, #6356. |
Problem statement:
Vault startup fails when using MSSQL as backend storage with pre-created database and schema, here vault is configured to start with database user who does not have schema creation access.
Steps to reproduce:
Execute following statements on the MSSQL database:
USE master
CREATE DATABASE [oper_db]
USE [oper_db]
CREATE LOGIN vault WITH PASSWORD = 'password'
CREATE USER vault FOR LOGIN vault
CREATE SCHEMA vault AUTHORIZATION vault
CREATE ROLE VaultUser AUTHORIZATION [vault]
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER , EXECUTE
ON SCHEMA::vault TO VaultUser
CREATE TABLE [vault].[SECRETS] (
[PATH] VARCHAR(512) NOT NULL,
[VALUE] VARBINARY(MAX) NULL
)
Start vault with the following configuration.
listener "tcp" {
address = "127.0.0.1:8200"
tls_disable = "true"
}
storage "mssql" {
server = "#ServerIP"
username = "vault"
password = "password"
database = "oper_db"
table = "SECRETS"
appname = "vault"
schema = "vault"
}
Actual output seen on the console:
Error initializing storage of type mssql: failed to create mssql schema: mssql:
CREATE SCHEMA failed due to previous errors.
Expected output:
Vault should start successfully using the pre-created database and the schema.
The text was updated successfully, but these errors were encountered: