Skip to content

Commit

Permalink
Define the failed auth views (#224)
Browse files Browse the repository at this point in the history
The aim is to give a means to `robot_zmon` to check failed logins, without allowing access to other log lines.
  • Loading branch information
avaczi authored and CyberDem0n committed May 22, 2018
1 parent a7ebb51 commit 33e7391
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion postgres-appliance/post_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ GRANT SELECT ON postgres_log TO ADMIN;"
for i in $(seq 0 7); do
echo "CREATE FOREIGN TABLE postgres_log_$i () INHERITS (postgres_log) SERVER pglog
OPTIONS (filename '../pg_log/postgresql-$i.csv', format 'csv', header 'false');
GRANT SELECT ON postgres_log_$i TO ADMIN;"
GRANT SELECT ON postgres_log_$i TO ADMIN;
CREATE OR REPLACE VIEW failed_authentication_$i WITH (security_barrier) AS
SELECT *
FROM postgres_log_$i
WHERE command_tag = 'authentication'
AND error_severity = 'FATAL';
ALTER VIEW failed_authentication_$i OWNER TO postgres;
GRANT SELECT ON TABLE failed_authentication_$i TO robot_zmon;
"
done

cat /_zmon_schema.dump
Expand Down

0 comments on commit 33e7391

Please sign in to comment.