diff --git a/.gitignore b/.gitignore index f3bf54271..ed973942f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ docker/bin/odyssey-asan odyssey.conf.example odyssey.init odyssey.logrotate +.DS_Store diff --git a/config-examples/odyssey-aq.conf b/config-examples/odyssey-aq.conf index a6dd559c7..6e1171718 100644 --- a/config-examples/odyssey-aq.conf +++ b/config-examples/odyssey-aq.conf @@ -158,4 +158,4 @@ locks_dir "/tmp/odyssey" graceful_die_on_errors yes enable_online_restart no -bindwith_reuseport yes +bindwith_reuseport yes \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index c366a31c8..67820d5cf 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,16 +2,20 @@ FROM golang:latest as base RUN mkdir -p /ody-integration-test RUN mkdir -p /prep_stmts +RUN mkdir -p /config-validation COPY ./docker/ody-integration-test /ody-integration-test COPY ./docker/prep_stmts /prep_stmts +COPY ./docker/config-validation /config-validation WORKDIR /ody-integration-test - RUN go mod download && cd pkg && go build -o ody-integration-test WORKDIR /prep_stmts RUN go mod download && cd pkg && go build -o pstmts-test +WORKDIR /config-validation +RUN go mod download && cd pkg && go build -o config-validation + FROM ubuntu:focal ENV DEBIAN_FRONTEND=noninteractive @@ -58,9 +62,11 @@ RUN mkdir /tmp/odyssey COPY ./docker/odyssey.conf /etc/odyssey/odyssey.conf COPY ./docker/lagpolling/lag-conf.conf /etc/odyssey/lag-conf.conf COPY ./docker/prep_stmts/pstmts.conf /etc/odyssey/pstmts.conf +COPY ./docker/config-validation/configs /etc/odyssey/configs COPY --from=base /ody-integration-test/pkg/ody-integration-test /ody-integration-test COPY --from=base /prep_stmts/pkg/pstmts-test /pstmts-test +COPY --from=base /config-validation/pkg/config-validation /config-validation COPY ./docker/scram /scram COPY ./docker/hba /hba COPY ./docker/auth_query /auth_query diff --git a/docker/config-validation/configs/auth_query/invalid/odyssey-test1.conf b/docker/config-validation/configs/auth_query/invalid/odyssey-test1.conf new file mode 100644 index 000000000..4fa3ba03a --- /dev/null +++ b/docker/config-validation/configs/auth_query/invalid/odyssey-test1.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + auth_query "auth_query" + auth_query_db "db" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/auth_query/invalid/odyssey-test2.conf b/docker/config-validation/configs/auth_query/invalid/odyssey-test2.conf new file mode 100644 index 000000000..e7443323b --- /dev/null +++ b/docker/config-validation/configs/auth_query/invalid/odyssey-test2.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + auth_query "auth_query" + auth_query_user "user" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/auth_query/invalid/odyssey-test3.conf b/docker/config-validation/configs/auth_query/invalid/odyssey-test3.conf new file mode 100644 index 000000000..210159d66 --- /dev/null +++ b/docker/config-validation/configs/auth_query/invalid/odyssey-test3.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + auth_query "auth_query" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/auth_query/valid/odyssey-test1.conf b/docker/config-validation/configs/auth_query/valid/odyssey-test1.conf new file mode 100644 index 000000000..0fa605f5f --- /dev/null +++ b/docker/config-validation/configs/auth_query/valid/odyssey-test1.conf @@ -0,0 +1,23 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + auth_query "auth_query" + auth_query_user "user" + auth_query_db "db" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/invalid/odyssey-test1.conf b/docker/config-validation/configs/authentication/invalid/odyssey-test1.conf new file mode 100644 index 000000000..13ebfcb73 --- /dev/null +++ b/docker/config-validation/configs/authentication/invalid/odyssey-test1.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "md5" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/invalid/odyssey-test2.conf b/docker/config-validation/configs/authentication/invalid/odyssey-test2.conf new file mode 100644 index 000000000..37f2351dc --- /dev/null +++ b/docker/config-validation/configs/authentication/invalid/odyssey-test2.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "scram-sha-256" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/invalid/odyssey-test3.conf b/docker/config-validation/configs/authentication/invalid/odyssey-test3.conf new file mode 100644 index 000000000..afb201129 --- /dev/null +++ b/docker/config-validation/configs/authentication/invalid/odyssey-test3.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "kek" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test1.conf b/docker/config-validation/configs/authentication/valid/odyssey-test1.conf new file mode 100644 index 000000000..928dadf5f --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test10.conf b/docker/config-validation/configs/authentication/valid/odyssey-test10.conf new file mode 100644 index 000000000..520c9b758 --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test10.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "cert" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test2.conf b/docker/config-validation/configs/authentication/valid/odyssey-test2.conf new file mode 100644 index 000000000..c312d396e --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test2.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "block" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test3.conf b/docker/config-validation/configs/authentication/valid/odyssey-test3.conf new file mode 100644 index 000000000..5347afade --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test3.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "clear_text" + password "password" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test4.conf b/docker/config-validation/configs/authentication/valid/odyssey-test4.conf new file mode 100644 index 000000000..df64b672f --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test4.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "md5" + password "password" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test5.conf b/docker/config-validation/configs/authentication/valid/odyssey-test5.conf new file mode 100644 index 000000000..2ce8883f6 --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test5.conf @@ -0,0 +1,23 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "md5" + auth_query "auth_query" + auth_query_user "user" + auth_query_db "db" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test6.conf b/docker/config-validation/configs/authentication/valid/odyssey-test6.conf new file mode 100644 index 000000000..06b7fb5f3 --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test6.conf @@ -0,0 +1,23 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "scram-sha-256" + auth_query "auth_query" + auth_query_user "user" + auth_query_db "db" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test7.conf b/docker/config-validation/configs/authentication/valid/odyssey-test7.conf new file mode 100644 index 000000000..6f0cfc334 --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test7.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "scram-sha-256" + password "password" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test8.conf b/docker/config-validation/configs/authentication/valid/odyssey-test8.conf new file mode 100644 index 000000000..9c4b3d996 --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test8.conf @@ -0,0 +1,24 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "md5" + auth_query "auth_query" + password "password" + auth_query_user "user" + auth_query_db "db" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/authentication/valid/odyssey-test9.conf b/docker/config-validation/configs/authentication/valid/odyssey-test9.conf new file mode 100644 index 000000000..472827bbc --- /dev/null +++ b/docker/config-validation/configs/authentication/valid/odyssey-test9.conf @@ -0,0 +1,24 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "scram-sha-256" + auth_query "auth_query" + password "password" + auth_query_user "user" + auth_query_db "db" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test1.conf b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test1.conf new file mode 100644 index 000000000..0ce141425 --- /dev/null +++ b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test1.conf @@ -0,0 +1,7 @@ +coroutine_stack_size 3 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test2.conf b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test2.conf new file mode 100644 index 000000000..726444b70 --- /dev/null +++ b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test2.conf @@ -0,0 +1,7 @@ +coroutine_stack_size 0 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test3.conf b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test3.conf new file mode 100644 index 000000000..b1d43a206 --- /dev/null +++ b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test3.conf @@ -0,0 +1,7 @@ +coroutine_stack_size -1 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test4.conf b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test4.conf new file mode 100644 index 000000000..2a05022d8 --- /dev/null +++ b/docker/config-validation/configs/coroutine_stack_size/invalid/odyssey-test4.conf @@ -0,0 +1,7 @@ +coroutine_stack_size "123" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/coroutine_stack_size/valid/odyssey-test1.conf b/docker/config-validation/configs/coroutine_stack_size/valid/odyssey-test1.conf new file mode 100644 index 000000000..1b36bfbcb --- /dev/null +++ b/docker/config-validation/configs/coroutine_stack_size/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +coroutine_stack_size 4 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/coroutine_stack_size/valid/odyssey-test2.conf b/docker/config-validation/configs/coroutine_stack_size/valid/odyssey-test2.conf new file mode 100644 index 000000000..4d61c4316 --- /dev/null +++ b/docker/config-validation/configs/coroutine_stack_size/valid/odyssey-test2.conf @@ -0,0 +1,20 @@ +coroutine_stack_size 10 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/listen_empty/invalid/odyssey-test1.conf b/docker/config-validation/configs/listen_empty/invalid/odyssey-test1.conf new file mode 100644 index 000000000..3294a0927 --- /dev/null +++ b/docker/config-validation/configs/listen_empty/invalid/odyssey-test1.conf @@ -0,0 +1,3 @@ +workers 0 + +log_format "%p %t %l [%i %s] (%c) %m\n" diff --git a/docker/config-validation/configs/listen_empty/valid/odyssey-test1.conf b/docker/config-validation/configs/listen_empty/valid/odyssey-test1.conf new file mode 100644 index 000000000..065ebb7dd --- /dev/null +++ b/docker/config-validation/configs/listen_empty/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +workers 1 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/listen_tls/invalid/odyssey-test1.conf b/docker/config-validation/configs/listen_tls/invalid/odyssey-test1.conf new file mode 100644 index 000000000..0c71042c1 --- /dev/null +++ b/docker/config-validation/configs/listen_tls/invalid/odyssey-test1.conf @@ -0,0 +1,6 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "" +} diff --git a/docker/config-validation/configs/listen_tls/invalid/odyssey-test2.conf b/docker/config-validation/configs/listen_tls/invalid/odyssey-test2.conf new file mode 100644 index 000000000..062b00302 --- /dev/null +++ b/docker/config-validation/configs/listen_tls/invalid/odyssey-test2.conf @@ -0,0 +1,6 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "123" +} diff --git a/docker/config-validation/configs/listen_tls/invalid/odyssey-test3.conf b/docker/config-validation/configs/listen_tls/invalid/odyssey-test3.conf new file mode 100644 index 000000000..b6f2c3921 --- /dev/null +++ b/docker/config-validation/configs/listen_tls/invalid/odyssey-test3.conf @@ -0,0 +1,6 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "disabl" +} diff --git a/docker/config-validation/configs/listen_tls/invalid/odyssey-test4.conf b/docker/config-validation/configs/listen_tls/invalid/odyssey-test4.conf new file mode 100644 index 000000000..ecf6c71c4 --- /dev/null +++ b/docker/config-validation/configs/listen_tls/invalid/odyssey-test4.conf @@ -0,0 +1,6 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls disable +} diff --git a/docker/config-validation/configs/listen_tls/valid/odyssey-test1.conf b/docker/config-validation/configs/listen_tls/valid/odyssey-test1.conf new file mode 100644 index 000000000..1c8aca236 --- /dev/null +++ b/docker/config-validation/configs/listen_tls/valid/odyssey-test1.conf @@ -0,0 +1,19 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "disable" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/listen_tls/valid/odyssey-test2.conf b/docker/config-validation/configs/listen_tls/valid/odyssey-test2.conf new file mode 100644 index 000000000..d2037a0ca --- /dev/null +++ b/docker/config-validation/configs/listen_tls/valid/odyssey-test2.conf @@ -0,0 +1,19 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "allow" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/listen_tls/valid/odyssey-test3.conf b/docker/config-validation/configs/listen_tls/valid/odyssey-test3.conf new file mode 100644 index 000000000..eb49e5d3b --- /dev/null +++ b/docker/config-validation/configs/listen_tls/valid/odyssey-test3.conf @@ -0,0 +1,19 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "require" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/listen_tls/valid/odyssey-test4.conf b/docker/config-validation/configs/listen_tls/valid/odyssey-test4.conf new file mode 100644 index 000000000..d1cf5e5a7 --- /dev/null +++ b/docker/config-validation/configs/listen_tls/valid/odyssey-test4.conf @@ -0,0 +1,19 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "verify_ca" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/listen_tls/valid/odyssey-test5.conf b/docker/config-validation/configs/listen_tls/valid/odyssey-test5.conf new file mode 100644 index 000000000..08a20c0ab --- /dev/null +++ b/docker/config-validation/configs/listen_tls/valid/odyssey-test5.conf @@ -0,0 +1,19 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" + tls "verify_full" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/log_format/invalid/odyssey-test1.conf b/docker/config-validation/configs/log_format/invalid/odyssey-test1.conf new file mode 100644 index 000000000..25bae1901 --- /dev/null +++ b/docker/config-validation/configs/log_format/invalid/odyssey-test1.conf @@ -0,0 +1,3 @@ +listen { + host "*" +} diff --git a/docker/config-validation/configs/log_format/valid/odyssey-test1.conf b/docker/config-validation/configs/log_format/valid/odyssey-test1.conf new file mode 100644 index 000000000..a755885d4 --- /dev/null +++ b/docker/config-validation/configs/log_format/valid/odyssey-test1.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test1.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test1.conf new file mode 100644 index 000000000..5d7807f0c --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test1.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + pool_reserve_prepared_statement yes + pool_discard yes + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test2.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test2.conf new file mode 100644 index 000000000..d465da4e9 --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test2.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_reserve_prepared_statement yes + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test3.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test3.conf new file mode 100644 index 000000000..3a1c4b555 --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test3.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + pool_reserve_prepared_statement no + pool_smart_discard yes + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test4.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test4.conf new file mode 100644 index 000000000..81744036c --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/invalid/odyssey-test4.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + pool_reserve_prepared_statement yes + pool_discard_query yes + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test1.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test1.conf new file mode 100644 index 000000000..fd1a28e6e --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test1.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + pool_reserve_prepared_statement yes + pool_discard no + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test2.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test2.conf new file mode 100644 index 000000000..952e72c87 --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test2.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + pool_reserve_prepared_statement no + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test3.conf b/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test3.conf new file mode 100644 index 000000000..f340b68de --- /dev/null +++ b/docker/config-validation/configs/pool_reserve_prepared_statement/valid/odyssey-test3.conf @@ -0,0 +1,23 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + pool_reserve_prepared_statement yes + pool_discard_query "no" + pool_discard no + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_routing/invalid/odyssey-test1.conf b/docker/config-validation/configs/pool_routing/invalid/odyssey-test1.conf new file mode 100644 index 000000000..723bd1607 --- /dev/null +++ b/docker/config-validation/configs/pool_routing/invalid/odyssey-test1.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "kek" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_routing/valid/odyssey-test1.conf b/docker/config-validation/configs/pool_routing/valid/odyssey-test1.conf new file mode 100644 index 000000000..b4b9caa82 --- /dev/null +++ b/docker/config-validation/configs/pool_routing/valid/odyssey-test1.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "internal" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_routing/valid/odyssey-test2.conf b/docker/config-validation/configs/pool_routing/valid/odyssey-test2.conf new file mode 100644 index 000000000..accc99d62 --- /dev/null +++ b/docker/config-validation/configs/pool_routing/valid/odyssey-test2.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "client_visible" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_type/invalid/odyssey-test1.conf b/docker/config-validation/configs/pool_type/invalid/odyssey-test1.conf new file mode 100644 index 000000000..ddf542fa0 --- /dev/null +++ b/docker/config-validation/configs/pool_type/invalid/odyssey-test1.conf @@ -0,0 +1,19 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_type/invalid/odyssey-test2.conf b/docker/config-validation/configs/pool_type/invalid/odyssey-test2.conf new file mode 100644 index 000000000..a52527c4b --- /dev/null +++ b/docker/config-validation/configs/pool_type/invalid/odyssey-test2.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "kek" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_type/valid/odyssey-test1.conf b/docker/config-validation/configs/pool_type/valid/odyssey-test1.conf new file mode 100644 index 000000000..928dadf5f --- /dev/null +++ b/docker/config-validation/configs/pool_type/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_type/valid/odyssey-test2.conf b/docker/config-validation/configs/pool_type/valid/odyssey-test2.conf new file mode 100644 index 000000000..e02e3163e --- /dev/null +++ b/docker/config-validation/configs/pool_type/valid/odyssey-test2.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "transaction" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/pool_type/valid/odyssey-test3.conf b/docker/config-validation/configs/pool_type/valid/odyssey-test3.conf new file mode 100644 index 000000000..745baf17f --- /dev/null +++ b/docker/config-validation/configs/pool_type/valid/odyssey-test3.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "statement" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/resolvers/invalid/odyssey-test1.conf b/docker/config-validation/configs/resolvers/invalid/odyssey-test1.conf new file mode 100644 index 000000000..e5b1d7722 --- /dev/null +++ b/docker/config-validation/configs/resolvers/invalid/odyssey-test1.conf @@ -0,0 +1,7 @@ +resolvers 0 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/resolvers/invalid/odyssey-test2.conf b/docker/config-validation/configs/resolvers/invalid/odyssey-test2.conf new file mode 100644 index 000000000..49ee9c35e --- /dev/null +++ b/docker/config-validation/configs/resolvers/invalid/odyssey-test2.conf @@ -0,0 +1,7 @@ +resolvers -10 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/resolvers/invalid/odyssey-test3.conf b/docker/config-validation/configs/resolvers/invalid/odyssey-test3.conf new file mode 100644 index 000000000..61bfd41a7 --- /dev/null +++ b/docker/config-validation/configs/resolvers/invalid/odyssey-test3.conf @@ -0,0 +1,7 @@ +resolvers "10" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/resolvers/valid/odyssey-test1.conf b/docker/config-validation/configs/resolvers/valid/odyssey-test1.conf new file mode 100644 index 000000000..6f9987082 --- /dev/null +++ b/docker/config-validation/configs/resolvers/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +resolvers 1 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} diff --git a/docker/config-validation/configs/resolvers/valid/odyssey-test2.conf b/docker/config-validation/configs/resolvers/valid/odyssey-test2.conf new file mode 100644 index 000000000..64c730aa1 --- /dev/null +++ b/docker/config-validation/configs/resolvers/valid/odyssey-test2.conf @@ -0,0 +1,20 @@ +resolvers 10 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/rules_empty/invalid/odyssey-test1.conf b/docker/config-validation/configs/rules_empty/invalid/odyssey-test1.conf new file mode 100644 index 000000000..bdbcdb7fd --- /dev/null +++ b/docker/config-validation/configs/rules_empty/invalid/odyssey-test1.conf @@ -0,0 +1,15 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +database "db" { + user "user" { + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/rules_empty/invalid/odyssey-test2.conf b/docker/config-validation/configs/rules_empty/invalid/odyssey-test2.conf new file mode 100644 index 000000000..15ea1e76f --- /dev/null +++ b/docker/config-validation/configs/rules_empty/invalid/odyssey-test2.conf @@ -0,0 +1,12 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} diff --git a/docker/config-validation/configs/rules_empty/valid/odyssey-test1.conf b/docker/config-validation/configs/rules_empty/valid/odyssey-test1.conf new file mode 100644 index 000000000..928dadf5f --- /dev/null +++ b/docker/config-validation/configs/rules_empty/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_name/invalid/odyssey-test1.conf b/docker/config-validation/configs/storage_name/invalid/odyssey-test1.conf new file mode 100644 index 000000000..d27a63595 --- /dev/null +++ b/docker/config-validation/configs/storage_name/invalid/odyssey-test1.conf @@ -0,0 +1,19 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_name/invalid/odyssey-test2.conf b/docker/config-validation/configs/storage_name/invalid/odyssey-test2.conf new file mode 100644 index 000000000..5f4983add --- /dev/null +++ b/docker/config-validation/configs/storage_name/invalid/odyssey-test2.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_name/valid/odyssey-test1.conf b/docker/config-validation/configs/storage_name/valid/odyssey-test1.conf new file mode 100644 index 000000000..928dadf5f --- /dev/null +++ b/docker/config-validation/configs/storage_name/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_tls/invalid/odyssey-test1.conf b/docker/config-validation/configs/storage_tls/invalid/odyssey-test1.conf new file mode 100644 index 000000000..22856f9d8 --- /dev/null +++ b/docker/config-validation/configs/storage_tls/invalid/odyssey-test1.conf @@ -0,0 +1,10 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "123" +} diff --git a/docker/config-validation/configs/storage_tls/invalid/odyssey-test2.conf b/docker/config-validation/configs/storage_tls/invalid/odyssey-test2.conf new file mode 100644 index 000000000..17c86197a --- /dev/null +++ b/docker/config-validation/configs/storage_tls/invalid/odyssey-test2.conf @@ -0,0 +1,10 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "disabl" +} diff --git a/docker/config-validation/configs/storage_tls/invalid/odyssey-test3.conf b/docker/config-validation/configs/storage_tls/invalid/odyssey-test3.conf new file mode 100644 index 000000000..8886aa4ff --- /dev/null +++ b/docker/config-validation/configs/storage_tls/invalid/odyssey-test3.conf @@ -0,0 +1,10 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls disable +} diff --git a/docker/config-validation/configs/storage_tls/valid/odyssey-test1.conf b/docker/config-validation/configs/storage_tls/valid/odyssey-test1.conf new file mode 100644 index 000000000..01c5bbc7e --- /dev/null +++ b/docker/config-validation/configs/storage_tls/valid/odyssey-test1.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "disable" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_tls/valid/odyssey-test2.conf b/docker/config-validation/configs/storage_tls/valid/odyssey-test2.conf new file mode 100644 index 000000000..95d65ee0b --- /dev/null +++ b/docker/config-validation/configs/storage_tls/valid/odyssey-test2.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "allow" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_tls/valid/odyssey-test3.conf b/docker/config-validation/configs/storage_tls/valid/odyssey-test3.conf new file mode 100644 index 000000000..63c6a2800 --- /dev/null +++ b/docker/config-validation/configs/storage_tls/valid/odyssey-test3.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "require" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_tls/valid/odyssey-test4.conf b/docker/config-validation/configs/storage_tls/valid/odyssey-test4.conf new file mode 100644 index 000000000..1f6bcac28 --- /dev/null +++ b/docker/config-validation/configs/storage_tls/valid/odyssey-test4.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "verify_ca" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_tls/valid/odyssey-test5.conf b/docker/config-validation/configs/storage_tls/valid/odyssey-test5.conf new file mode 100644 index 000000000..567101b8f --- /dev/null +++ b/docker/config-validation/configs/storage_tls/valid/odyssey-test5.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" + tls "verify_full" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test1.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test1.conf new file mode 100644 index 000000000..3f06e8928 --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test1.conf @@ -0,0 +1,4 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { +} diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test2.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test2.conf new file mode 100644 index 000000000..6a3000be4 --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test2.conf @@ -0,0 +1,9 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test3.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test3.conf new file mode 100644 index 000000000..a9c98945b --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test3.conf @@ -0,0 +1,8 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { +} diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test4.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test4.conf new file mode 100644 index 000000000..11910e49c --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test4.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "internal" + role "admin" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test5.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test5.conf new file mode 100644 index 000000000..26a330aea --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test5.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "internal" + role "stat" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test6.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test6.conf new file mode 100644 index 000000000..7706ad4ed --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test6.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "internal" + role "notallow" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/invalid/odyssey-test7.conf b/docker/config-validation/configs/storage_type/invalid/odyssey-test7.conf new file mode 100644 index 000000000..8f5f3cfd2 --- /dev/null +++ b/docker/config-validation/configs/storage_type/invalid/odyssey-test7.conf @@ -0,0 +1,22 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + pool_routing "internal" + role "undef" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/valid/odyssey-test1.conf b/docker/config-validation/configs/storage_type/valid/odyssey-test1.conf new file mode 100644 index 000000000..5ed674749 --- /dev/null +++ b/docker/config-validation/configs/storage_type/valid/odyssey-test1.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + host "*" + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/valid/odyssey-test2.conf b/docker/config-validation/configs/storage_type/valid/odyssey-test2.conf new file mode 100644 index 000000000..928dadf5f --- /dev/null +++ b/docker/config-validation/configs/storage_type/valid/odyssey-test2.conf @@ -0,0 +1,20 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/storage_type/valid/odyssey-test3.conf b/docker/config-validation/configs/storage_type/valid/odyssey-test3.conf new file mode 100644 index 000000000..10c93e228 --- /dev/null +++ b/docker/config-validation/configs/storage_type/valid/odyssey-test3.conf @@ -0,0 +1,17 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "local" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/unix_socket_mode/invalid/odyssey-test1.conf b/docker/config-validation/configs/unix_socket_mode/invalid/odyssey-test1.conf new file mode 100644 index 000000000..dd8ec4a09 --- /dev/null +++ b/docker/config-validation/configs/unix_socket_mode/invalid/odyssey-test1.conf @@ -0,0 +1,7 @@ +unix_socket_dir "/tmp" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} diff --git a/docker/config-validation/configs/unix_socket_mode/valid/odyssey-test1.conf b/docker/config-validation/configs/unix_socket_mode/valid/odyssey-test1.conf new file mode 100644 index 000000000..188d48ab0 --- /dev/null +++ b/docker/config-validation/configs/unix_socket_mode/valid/odyssey-test1.conf @@ -0,0 +1,21 @@ +unix_socket_dir "/tmp" +unix_socket_mode "0644" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/unix_socket_mode/valid/odyssey-test2.conf b/docker/config-validation/configs/unix_socket_mode/valid/odyssey-test2.conf new file mode 100644 index 000000000..5b7e91799 --- /dev/null +++ b/docker/config-validation/configs/unix_socket_mode/valid/odyssey-test2.conf @@ -0,0 +1,18 @@ +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/workers/invalid/odyssey-test1.conf b/docker/config-validation/configs/workers/invalid/odyssey-test1.conf new file mode 100644 index 000000000..fc6b3b892 --- /dev/null +++ b/docker/config-validation/configs/workers/invalid/odyssey-test1.conf @@ -0,0 +1,20 @@ +workers 0 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} diff --git a/docker/config-validation/configs/workers/invalid/odyssey-test2.conf b/docker/config-validation/configs/workers/invalid/odyssey-test2.conf new file mode 100644 index 000000000..2fe84cd83 --- /dev/null +++ b/docker/config-validation/configs/workers/invalid/odyssey-test2.conf @@ -0,0 +1,20 @@ +workers -10 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} diff --git a/docker/config-validation/configs/workers/invalid/odyssey-test3.conf b/docker/config-validation/configs/workers/invalid/odyssey-test3.conf new file mode 100644 index 000000000..3efafaf6b --- /dev/null +++ b/docker/config-validation/configs/workers/invalid/odyssey-test3.conf @@ -0,0 +1,20 @@ +workers "123" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} diff --git a/docker/config-validation/configs/workers/valid/odyssey-test1.conf b/docker/config-validation/configs/workers/valid/odyssey-test1.conf new file mode 100644 index 000000000..bd19ca91c --- /dev/null +++ b/docker/config-validation/configs/workers/valid/odyssey-test1.conf @@ -0,0 +1,20 @@ +workers 1 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} diff --git a/docker/config-validation/configs/workers/valid/odyssey-test2.conf b/docker/config-validation/configs/workers/valid/odyssey-test2.conf new file mode 100644 index 000000000..60c854148 --- /dev/null +++ b/docker/config-validation/configs/workers/valid/odyssey-test2.conf @@ -0,0 +1,20 @@ +workers 10 + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/configs/workers/valid/odyssey-test3.conf b/docker/config-validation/configs/workers/valid/odyssey-test3.conf new file mode 100644 index 000000000..72c504e0e --- /dev/null +++ b/docker/config-validation/configs/workers/valid/odyssey-test3.conf @@ -0,0 +1,20 @@ +workers "auto" + +log_format "%p %t %l [%i %s] (%c) %m\n" + +listen { + host "*" +} + +storage "postgres_server" { + type "remote" + host "*" +} + +database "db" { + user "user" { + storage "postgres_server" + pool "session" + authentication "none" + } +} \ No newline at end of file diff --git a/docker/config-validation/go.mod b/docker/config-validation/go.mod new file mode 100644 index 000000000..1cc956a03 --- /dev/null +++ b/docker/config-validation/go.mod @@ -0,0 +1,5 @@ +module config-validation + +go 1.14 + +require github.com/jmoiron/sqlx v1.3.5 diff --git a/docker/config-validation/go.sum b/docker/config-validation/go.sum new file mode 100644 index 000000000..fdd42959e --- /dev/null +++ b/docker/config-validation/go.sum @@ -0,0 +1,8 @@ +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= diff --git a/docker/config-validation/pkg/main.go b/docker/config-validation/pkg/main.go new file mode 100644 index 000000000..2d34e2c4f --- /dev/null +++ b/docker/config-validation/pkg/main.go @@ -0,0 +1,83 @@ +package main + +import ( + "context" + "errors" + "fmt" + "io/ioutil" + "os/exec" + "strings" +) + +const pathPrefix = "/etc/odyssey/configs" + +const configIsValid = "config is valid" +const configWithInvalidValuePass = "config with invalid value pass" + +func makeTest(pathToConfig string, isValidConfig bool) error { + ctx := context.TODO() + + out, _ := exec.CommandContext(ctx, "/usr/bin/odyssey", pathToConfig, "--test").Output() + strOut := string(out) + + if isValidConfig && !strings.Contains(strOut, configIsValid) { + return errors.New(strOut) + } + + if !isValidConfig && strings.Contains(strOut, configIsValid) { + return errors.New(configWithInvalidValuePass) + } + + return nil +} + +func makeTests(field string, isValid bool) { + var group string + if isValid { + group = "valid" + } else { + group = "invalid" + } + + pathToDir := pathPrefix + "/" + field + "/" + group + configs, _ := ioutil.ReadDir(pathToDir) + + for ind, config := range configs { + pathToConfig := pathToDir + "/" + config.Name() + if err := makeTest(pathToConfig, isValid); err != nil { + fmt.Printf("%s_test_%s_%d (ERROR): %s\n", field, group, ind, err) + } else { + fmt.Printf("%s_test_%s_%d: Ok\n", field, group, ind) + } + } +} + +func runTests() { + tests := []string{ + "workers", + "resolvers", + "coroutine_stack_size", + "log_format", + "unix_socket_mode", + "listen_empty", + "listen_tls", + "storage_type", + "storage_tls", + "storage_name", + "pool_type", + "pool_reserve_prepared_statement", + "pool_routing", + "authentication", + "auth_query", + "rules_empty", + } + + for _, test := range tests { + makeTests(test, true) + makeTests(test, false) + } +} + +func main() { + runTests() +} diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 86b066853..339ba617f 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -13,6 +13,10 @@ then exit 1 fi +ody-start +/config-validation +ody-stop + #ldap /ldap/test_ldap.sh if [ $? -eq 1 ] diff --git a/sources/instance.c b/sources/instance.c index be02d7c1c..02c3355bc 100644 --- a/sources/instance.c +++ b/sources/instance.c @@ -50,6 +50,49 @@ void od_usage(od_instance_t *instance, char *path) path); } +void od_config_testing(od_instance_t *instance) +{ + od_error_t error; + od_router_t router; + od_hba_t hba; + od_global_t global; + od_extention_t extentions; + + od_error_init(&error); + od_router_init(&router, &global); + od_hba_init(&hba); + od_extentions_init(&extentions); + + int rc; + rc = od_config_reader_import(&instance->config, &router.rules, &error, + &extentions, &global, &hba.rules, + instance->config_file); + if (rc == -1) { + od_error(&instance->logger, "config", NULL, NULL, "%s", + error.error); + goto error; + } + + /* validate configuration */ + rc = od_config_validate(&instance->config, &instance->logger); + if (rc == -1) { + goto error; + } + + /* validate rules */ + rc = od_rules_validate(&router.rules, &instance->config, + &instance->logger); + if (rc == -1) { + goto error; + } + + od_log(&instance->logger, "config", NULL, NULL, "config is valid"); + +error: + od_router_free(&router); + return NOT_OK_RESPONSE; +} + static inline void od_bind_version() { od_asprintf((char **__restrict) & argp_program_version, @@ -63,6 +106,7 @@ static inline od_retcode_t od_args_init(od_arguments_t *args, args->silent = 0; args->verbose = 0; args->console = 0; + args->test = 0; args->instance = instance; return OK_RESPONSE; } diff --git a/sources/option.h b/sources/option.h index 89be764e8..df4b21943 100644 --- a/sources/option.h +++ b/sources/option.h @@ -5,6 +5,7 @@ #include extern void od_usage(od_instance_t *instance, char *path); +extern void od_config_testing(od_instance_t *instance); typedef struct { od_instance_t *instance; @@ -12,6 +13,7 @@ typedef struct { int verbose; int console; int log_stdout; + int test; } od_arguments_t; typedef enum { @@ -19,6 +21,7 @@ typedef enum { OD_OPT_SILENT, OD_OPT_VERBOSE, OD_OPT_LOG_STDOUT, + OD_OPT_TEST, } od_cli_options; static struct argp_option options[] = { @@ -30,6 +33,8 @@ static struct argp_option options[] = { "Do not fork on startup", 0 }, { "log_to_stdout", OD_OPT_LOG_STDOUT, 0, OPTION_ARG_OPTIONAL, "Log to stdout", 0 }, + { "test", OD_OPT_TEST, 0, OPTION_ARG_OPTIONAL, "Configuration testing", + 0 }, { 0 } }; @@ -59,6 +64,9 @@ static inline error_t parse_opt(int key, char *arg, struct argp_state *state) case OD_OPT_LOG_STDOUT: { arguments->log_stdout = 1; } break; + case OD_OPT_TEST: { + arguments->test = 1; + } break; case ARGP_KEY_ARG: { if (state->arg_num >= 1) { /* Too many arguments. */ @@ -74,6 +82,12 @@ static inline error_t parse_opt(int key, char *arg, struct argp_state *state) od_usage(instance, instance->exec_path); return ARGP_KEY_ERROR; } + + if (arguments->test == 1) { + od_config_testing(instance); + exit(0); + } + break; default: diff --git a/sources/rules.c b/sources/rules.c index 7bd106590..1a55fc013 100644 --- a/sources/rules.c +++ b/sources/rules.c @@ -901,6 +901,12 @@ int od_rules_validate(od_rules_t *rules, od_config_t *config, od_logger_t *logger) { /* storages */ + if (od_list_empty(&rules->storages)) { + od_error(logger, "rules", NULL, NULL, + "no storage defined"); + return -1; + } + od_list_t *i; od_list_foreach(&rules->storages, i) { @@ -973,6 +979,12 @@ int od_rules_validate(od_rules_t *rules, od_config_t *config, } /* rules */ + if (od_list_empty(&rules->rules)) { + od_error(logger, "rules", NULL, NULL, + "no rules defined"); + return -1; + } + od_list_foreach(&rules->rules, i) { od_rule_t *rule; diff --git a/sources/scram.c b/sources/scram.c index 757ba22ff..7bdd0f315 100644 --- a/sources/scram.c +++ b/sources/scram.c @@ -885,4 +885,4 @@ od_scram_create_server_final_message(od_scram_state_t *scram_state) free(result); return NULL; -} +} \ No newline at end of file diff --git a/sources/scram.h b/sources/scram.h index 6bd3b00d0..e5bf61e63 100644 --- a/sources/scram.h +++ b/sources/scram.h @@ -191,4 +191,4 @@ int od_scram_read_client_final_message(machine_io_t *io, size_t *final_nonce_size_ptr, char **proof_ptr); -#endif /* ODYSSEY_SCRAM_H */ +#endif /* ODYSSEY_SCRAM_H */ \ No newline at end of file