Commit Graph

617 Commits

Author SHA1 Message Date
kirill reshke 56057468c0
Add auth query basic tests & add test with restart for lag polling (#387)
* Add auth query basic tests

* Remove unused file ini.sql

* Refactor lag polling tests
2021-12-10 11:13:58 +05:00
kirill reshke d215160b3a
Fix compiler warnings (#386) 2021-12-09 16:34:04 +05:00
Andrey Borodin 36a4bbb137
Minor grammar fix (#384) 2021-12-09 15:06:39 +05:00
kirill reshke cb508c3d78
Fix scram with pg version num >= 140 000 (#383) 2021-12-09 12:26:27 +05:00
kirill reshke ee9b0e23e2
Fix config validation for auth query when there is no PAM module avai… (#382)
* Fix config validation for auth query when there is no PAM module available in system

* Fix compiler warns

Co-authored-by: Kirill Reshke <reshke@qavm-da1bb86b.qemu>
2021-12-09 12:26:20 +05:00
kirill reshke 95fad60af2
Fix flacy test & func naming (#381) 2021-12-08 18:12:14 +05:00
kirill reshke ba6513323f
Add storage watchdog with standby lag polling support (#380)
* Move auth query server querying logic to separate file

* Refactor query code to support not only "auth_query" like queries

* Move storage logic to separate file & add storage watchdog

* Force several settings on starts

* Fix simple query parsing

* Fixed bugs

* Fix config reload

* Add tests

* Move cathcup logic to separate func

* Fix tests[2]

Co-authored-by: Andrey Borodin <amborodin@acm.org>
2021-12-08 15:54:43 +05:00
reshke 70b4c6f3e6 Feature: ability to use connections separate pooling with auth query 2021-12-06 09:12:23 +00:00
reshke a9a6c07044 Refactor rule pool, add internal pooling feature 2021-12-06 08:28:02 +00:00
reshke 71d5b14a9f Fix pool setting naming 2021-12-05 19:57:05 +00:00
reshke 8073a821ab Fix scram API broken after e6bdfd9700 2021-12-05 16:00:15 +00:00
reshke 8967555f61 Fix for auth query when user password is empty 2021-12-05 15:51:00 +00:00
kirill reshke 01f3c036b7
Update tls certs in test, regenerate them with 4096 bytes length, move test to docker (#374)
* Update tls certs in test, regenerate them with 4096 bytes length

* Fix compile errors

* Fix tests
2021-12-05 20:41:01 +05:00
reshke 2b261db9d3 Use Postgresql Version number from pg_config.h 2021-12-03 17:47:09 +00:00
kirill reshke 3137c74ec0
Fix show storages to actually show storages (#370) 2021-11-30 17:45:09 +05:00
reshke 4630c5d72f Refactor tls options 2021-11-29 18:39:33 +05:00
Andrey Borodin 3af5449907
Fix error message for CVE-2021-23222 (#363) 2021-11-29 16:53:35 +05:00
reshke 68b1a9f4db apply fmt 2021-11-15 15:06:50 +05:00
reshke 88d2a9e7df SHOW LISTEN support in virtual (local) database 2021-11-15 15:06:50 +05:00
Andrey Borodin f062d4ee16
Fix some warnings (#357)
* Fix some warnings

* Some leftover hash

* Add include
2021-11-12 19:01:32 +05:00
Andrey Borodin 4e00bf797a
Reject extraneous data after SSL negatiation (#359)
* Reject extraneous data after SSL negatiation
This prevents attacks like in CVE-2021-23214 and CVE-2021-23222.

* Fix fmt issue

Co-authored-by: reshke <reshkekirill@gmail.com>
2021-11-12 17:04:27 +05:00
Andrey Borodin e91bbecfa4 Apply fortmatting 2021-09-13 06:26:23 +00:00
Firm 2dc81e7993
Update option.h
Declare od_cli_options as static to avoid compilation errors.
2021-09-12 11:24:30 +03:00
kirill reshke 85e6288539
Fix compilation without LDAP support (#345)
Co-authored-by: reshke <Kirill Reshke>
2021-08-17 18:13:44 +05:00
Yury Frolov 02f3144265
Enabled writing stats in Prometheus format. (#346)
* Early implementation

* Added description for gauges

* Added prometheus lib finding to Cmake

* Fixed FindProm comments

* Small changes

* free to prom_free

* Moved metrics to separate file

* Refactored & added new methods to prom_metrics

* Refactored cron.c to use prom_metrics.h

* Refactored CMake & odyssey.h

* Added new metrics

* Small refactoring

* Small method renaming

* Small fix in init

* Added methods for use in od_cron_stats_cb

* Small fixes

* Refactored metrics to use separate collectors

* Small fix

* Passing metrics to od_cron_stat_cb now.

* Removed unused imports

* Removed old od_log calls

* Removed TODO

* Revert "Removed old od_log calls"

This reverts commit 60000c8321.

* Uncommented od_log calls

* Added processed clients field to metrics

* Refactored metrics init

* Fixed write_stat

* Added method for worker stats

* Added method for worker stat to metrics header file

* Refactored worker stat method

* Reverted changes in odyssey.h

* Added writing metrics to od_worker

* Added new method to logger

Method provides writing big strings to log without formatting.

* Fixed prometheus log writing

* More fixes

* Fixed log writing

* Fixed log calls

* Added TODO

* Added assertion whether prom.h found

* Fixed no format logger method

Now logs follow log format

* Fixed logger

* Added log_stats_prom option to config

* Renamed od_logger_write_no_fmt to od_logger_write_plain

* Formatted

* More ifdefs

* Added memory deallocating in od_cron_stop

* Updated configuration.md

* Removed outdated TODO

* Changed label

* Formatted
2021-08-17 17:07:16 +05:00
kirill reshke 5d129fa783
Allow logging in module init cb (#344)
fix memory corruption in config reload, also fix logging & route disabling

Co-authored-by: reshke <Kirill Reshke>
2021-08-10 12:50:00 +05:00
kirill reshke d2bf7f2977
Fix reload of ldap endpoints (#343)
* Better indentation for client_max, print ldap endpoint name for ldap-auth route

* Better logging in ldap connection initialization

* Fix compiler usused arg warning

* Fix reload of ldap endpoints: make them a part of od rules struct;

Co-authored-by: reshke <Kirill Reshke>
2021-07-28 13:42:00 +05:00
reshke 44abe83764 Fix odyssey print config indentation 2021-07-28 10:03:43 +05:00
reshke d9a8bcd6f4 Comment invasive code section 2021-07-08 16:13:32 +05:00
reshke 53113fec74 do not detach replication on stmt pooling 2021-07-08 16:09:56 +05:00
reshke af703ed0a3 STATEMENT pooling 2021-07-08 15:51:42 +05:00
Онофрей Борис a351c107c8 Fix clang format error 2021-06-29 10:32:36 +03:00
Andrey Borodin b4d84db3f2 Protect escaping from overrun 2021-06-29 11:13:06 +05:00
Онофрей Борис b66b2f3b43 Fix parsing escaped quotes in config 2021-06-27 19:59:26 +03:00
kirill reshke 55528d6528
fix_session_pooling_reload: keep server connection until client disconnection, after that drop server connection in od_reset (#336)
Co-authored-by: reshke <Kirill Reshke>
2021-06-03 11:11:48 +05:00
Andrey Borodin 5a2dbb147c
Merge pull request #333 from EvgeniiAl/fix_reload_config
fix reload config
2021-06-03 10:55:15 +05:00
kirill reshke 7abbeb0b0e
Fix incorrect function used for deinitialization on error in config reader (#335)
* Fix incorrect function used for deinitialization on error in config reader

* apply formatting.

Co-authored-by: reshke <Kirill Reshke>
2021-06-03 10:41:30 +05:00
Andrey Borodin 25b7e36870
Detach only synchronized server (#338)
Currently client can issue two consequtive sync requests and we will detach
his server connection right after first ReadyForQuery. This seems incorrect.
2021-06-03 10:40:45 +05:00
Andrey Borodin bf48de6242
Log Parse messages when log_query enabled (#334) 2021-06-02 14:30:32 +05:00
Аладьин Евгений Игоревич ee4d2af1c2 fix reload config
reload client_max_set variable

resolve bug when user comment 'client_max' setting and reload config

and still get restriction on connections number
2021-05-28 22:29:58 +03:00
kirill reshke 3478c90915
Fix a couple of null pointer refernce (#331)
Co-authored-by: reshke <Kirill Reshke>
2021-05-28 13:27:58 +05:00
Andrey Borodin 21fef56e56
Merge pull request #330 from yandex/coverity_scan
Fix use-atfer-free and printf arg
2021-05-27 21:53:58 +03:00
reshke 7146ff3dee fix memory leak in config reader 2021-05-27 23:38:46 +05:00
reshke d95c47ebfb Fix use-atfer-free and printf arg 2021-05-27 23:07:45 +05:00
Andrey Borodin 41925d4585
Fix incorrect flush_status usage in frontend code. (#328)
This should prevent "unexpected error status OD_DETACH (4)" which caused abnormal server connection termination.
2021-05-24 12:01:59 +05:00
reshke 3b6914672d fix a couple of coverity issues 2021-05-21 18:46:28 +05:00
reshke 71c98b23a8 fix a couple of coverity issues 2021-05-20 18:13:05 +05:00
reshke 9216f1d2f2 fix a few compile errors && applt formatting 2021-05-20 17:52:06 +05:00
reshke b342d81fdd Fix compile error with no PAM support 2021-05-20 17:39:03 +05:00
reshke a9e9ade846 autoconfigure number of workers 2021-05-20 17:26:19 +05:00