Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
salt-formulas
postgresql-formula
Commits
8a927ce0
Commit
8a927ce0
authored
Nov 03, 2019
by
Julien Cigar
🤘
Browse files
add auth_query
parent
4107c3ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
postgresql/files/auth_query.sh
0 → 100644
View file @
8a927ce0
psql
${
PSQL_ARGS
}
<<
EOF
CREATE OR REPLACE FUNCTION pgbouncer.user_lookup(in i_username text, out uname text, out phash text)
RETURNS record AS
\$\$
BEGIN
SELECT usename, passwd FROM pg_catalog.pg_shadow
WHERE usename = i_username INTO uname, phash;
RETURN;
END;
\$\$
LANGUAGE plpgsql SECURITY DEFINER;
REVOKE ALL ON FUNCTION pgbouncer.user_lookup(text) FROM public, pgbouncer;
GRANT EXECUTE ON FUNCTION pgbouncer.user_lookup(text) TO pgbouncer;
EOF
postgresql/server.sls
View file @
8a927ce0
...
...
@@ -179,7 +179,7 @@ postgresql_database_{{ k }}_pgbouncer_schema:
# Use a non-admin user (pgbouncer) that calls SECURITY DEFINER function.
postgresql_database_{{ k }}_pgbouncer_lookup:
cmd.script:
- source: salt://p
gbouncer
/files/auth_query.sh
- source: salt://p
ostgresql
/files/auth_query.sh
- runas: {{ pgsql.lookup.user }}
- env:
- PSQL_ARGS: --no-psqlrc --no-align --no-readline -d {{ k }}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment