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

Postgres create_statement string not saved properly during database role creation in browser CLI #7156

Closed
rlanga opened this issue Jul 22, 2019 · 0 comments · Fixed by #7206
Labels

Comments

@rlanga
Copy link

rlanga commented Jul 22, 2019

I'm trying to set up PostgreSQL in the database secrets engine through the Vault browser CLI in the UI. I've been following the instructions and steps from the documentation: https://www.vaultproject.io/docs/secrets/databases/postgresql.html

Environment:

  • Vault Version: 1.1.2
  • Operating System/Architecture: Docker image vault:1.1.2

Expected Behavior:

$ vault read database/roles/api-prod
Key                   Value       
creation_statements   ["CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \
        GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\";"]
db_name               apiprod  
default_ttl           300         
max_ttl               3600        
renew_statements      []          
revocation_statements []          
rollback_statements   []          

Actual Behavior:

$ vault read database/roles/api-prod
Key                   Value       
creation_statements   ["\"CREATE"]
db_name               apiprod  
default_ttl           300         
max_ttl               3600        
renew_statements      []          
revocation_statements []          
rollback_statements   []          

Steps to Reproduce:

$ vault write database/roles/api-prod db_name=apiprod creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\";" default_ttl=1h max_ttl=24h

I also tried replacing the double quotes on the creation statement with single quotes and got this:

Actual Behavior:

$ vault read database/roles/api-prod
Key                   Value                                                                                                                                                         
creation_statements   ["CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD {{password}} VALID UNTIL {{expiration}}; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";"]
db_name               apiprod                                                                                                                                                    
default_ttl           3600                                                                                                                                                          
max_ttl               86400                                                                                                                                                         
renew_statements      []                                                                                                                                                            
revocation_statements []                                                                                                                                                            
rollback_statements   []                                                                                                                                                            

Steps to Reproduce:

$ vault write database/roles/api-prod db_name=apiprod creation_statements='CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\";' default_ttl=1h max_ttl=24h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants