-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f50c15
commit 8ba1e23
Showing
18 changed files
with
815 additions
and
22 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,6 @@ listen { | |
compression yes | ||
} | ||
|
||
|
||
storage "postgres_server" { | ||
type "remote" | ||
host "localhost" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
listen { | ||
host "*" | ||
port 6432 | ||
} | ||
|
||
storage "postgres_server" { | ||
type "remote" | ||
|
||
host "localhost" | ||
port 5432 | ||
} | ||
|
||
database "group_db" { | ||
user "group_user1" { | ||
authentication "none" | ||
storage "postgres_server" | ||
pool "session" | ||
} | ||
|
||
group "group1" { | ||
authentication "md5" | ||
password "password1" | ||
|
||
storage "postgres_server" | ||
storage_db "postgres" | ||
storage_user "postgres" | ||
|
||
pool_routing "internal" | ||
pool "session" | ||
group_query "SELECT rolname FROM pg_roles WHERE pg_has_role(rolname, 'group1', 'member');" | ||
} | ||
|
||
user "group_user2" { | ||
authentication "none" | ||
storage "postgres_server" | ||
pool "session" | ||
} | ||
|
||
user "group_user3" { | ||
authentication "none" | ||
storage "postgres_server" | ||
pool "session" | ||
} | ||
|
||
group "group2" { | ||
authentication "md5" | ||
password "password2" | ||
|
||
storage "postgres_server" | ||
storage_db "postgres" | ||
storage_user "postgres" | ||
|
||
pool_routing "internal" | ||
pool "session" | ||
group_query "SELECT rolname FROM pg_roles WHERE pg_has_role(rolname, 'group2', 'member');" | ||
} | ||
|
||
user "group_user4" { | ||
authentication "none" | ||
storage "postgres_server" | ||
pool "session" | ||
} | ||
|
||
user "group_user5" { | ||
authentication "none" | ||
storage "postgres_server" | ||
pool "session" | ||
} | ||
} | ||
|
||
database default { | ||
user default { | ||
authentication "none" | ||
|
||
storage "postgres_server" | ||
pool "session" | ||
pool_size 0 | ||
|
||
pool_timeout 0 | ||
|
||
pool_ttl 1201 | ||
|
||
pool_discard no | ||
|
||
pool_cancel yes | ||
|
||
pool_rollback yes | ||
# seconds | ||
pool_client_idle_timeout 20 | ||
# seconds | ||
pool_idle_in_transaction_timeout 20 | ||
|
||
client_fwd_error yes | ||
application_name_add_host yes | ||
server_lifetime 1901 | ||
log_debug no | ||
|
||
quantiles "0.99,0.95,0.5" | ||
client_max 107 | ||
} | ||
} | ||
|
||
unix_socket_dir "/tmp" | ||
unix_socket_mode "0644" | ||
|
||
log_file "/var/log/odyssey.log" | ||
log_format "%p %t %l [%i %s] (%c) %m\n" | ||
log_debug no | ||
log_config yes | ||
log_session no | ||
log_query no | ||
log_stats yes | ||
daemonize yes | ||
|
||
locks_dir "/tmp/odyssey" | ||
graceful_die_on_errors yes | ||
enable_online_restart yes | ||
bindwith_reuseport yes | ||
|
||
stats_interval 60 | ||
|
||
pid_file "/var/run/odyssey.pid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash -x | ||
|
||
set -ex | ||
|
||
/usr/bin/odyssey /group/config.conf | ||
|
||
users=("group_user1" "group_user2" "group_user3" "group_user4" "group_user5") | ||
for user in "${users[@]}"; do | ||
psql -h localhost -p 6432 -U "$user" -c "SELECT 1" group_db >/dev/null 2>&1 || { | ||
echo "ERROR: failed backend auth with correct user auth" | ||
|
||
cat /var/log/odyssey.log | ||
echo " | ||
" | ||
cat /var/log/postgresql/postgresql-14-main.log | ||
|
||
exit 1 | ||
} | ||
done | ||
|
||
ody-stop | ||
|
||
psql -h localhost -p 5432 -U postgres -c "GRANT group1 TO group_user2;" group_db | ||
psql -h localhost -p 5432 -U postgres -c "GRANT group1 TO group_user4;" group_db | ||
psql -h localhost -p 5432 -U postgres -c "GRANT group2 TO group_user4;" group_db | ||
psql -h localhost -p 5432 -U postgres -c "GRANT group1 TO group_user1;" group_db | ||
|
||
/usr/bin/odyssey /group/config.conf | ||
|
||
sleep 1 | ||
|
||
psql -h localhost -p 6432 -U group_user1 -c "SELECT 1" group_db >/dev/null 2>&1 || { | ||
echo "ERROR: group auth apply for over user at config" | ||
|
||
cat /var/log/odyssey.log | ||
echo " | ||
" | ||
cat /var/log/postgresql/postgresql-14-main.log | ||
|
||
exit 1 | ||
} | ||
|
||
psql -h localhost -p 6432 -U group_user2 -c "SELECT 1" group_db >/dev/null 2>&1 && { | ||
echo "ERROR: group auth not apply" | ||
|
||
cat /var/log/odyssey.log | ||
echo " | ||
" | ||
cat /var/log/postgresql/postgresql-14-main.log | ||
|
||
exit 1 | ||
} | ||
|
||
PGPASSWORD=password1 psql -h localhost -p 6432 -U group_user4 -c "SELECT 1" group_db >/dev/null 2>&1 && { | ||
echo "ERROR: group auth not accepted down group" | ||
|
||
cat /var/log/odyssey.log | ||
echo " | ||
" | ||
cat /var/log/postgresql/postgresql-14-main.log | ||
|
||
exit 1 | ||
} | ||
|
||
PGPASSWORD=password2 psql -h localhost -p 6432 -U group_user4 -c "SELECT 1" group_db >/dev/null 2>&1 || { | ||
echo "ERROR: group auth not apply" | ||
|
||
cat /var/log/odyssey.log | ||
echo " | ||
" | ||
cat /var/log/postgresql/postgresql-14-main.log | ||
|
||
exit 1 | ||
} | ||
|
||
ody-stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.