Commit Graph

26 Commits

Author SHA1 Message Date
Andrey Borodin 3f50c152a2
Revert "Groups implementation (#609)" (#611)
This reverts commit 5f13f83697.
2024-05-07 18:55:52 +05:00
Andrey Borodin 5f13f83697
Groups implementation (#609) 2024-05-07 15:50:38 +05:00
NikitaUnisikhin f60df91a54
Add addr pool in rule (#550) 2024-02-14 14:57:20 +03:00
NikitaUnisikhin 9a423940b9
Added config testing (odyssey --test) (#537)
* added configuration testing (odyssey --test)

* fixes

* fix names

* fix names

* apply fmt

* start create tests

* rebuild

* tests done

* --test no longer forks the process

* config without rules is no longer valid

* fix tests

* fix storage_type tests

* fix storage_tls tests

* fix config-examples/odyssey-aq.conf

* change .gitignore

* rm .DS_Store
2023-11-10 14:57:22 +05:00
reshke d0638f309b
Cache auth info for auth query for 10 sec. (#523)
* Cache auth info for auth query for 10 sec.

* Invalidate auth cache on reload
2023-08-01 15:21:47 +05:00
reshke b403369020
Auto-generate default internal pool (for `auth-query` etc) if none specified. (#519)
* Auto-generatew default internal pool if none specified.

Added auto-generation logic to create internal rule for aurh-query
when none "pool_internal" rules was specified, but auth query is in use.

* Add sample config for auth-query autogen and fix bugs

* Fix

* Fix2

* rules.c edited online with Bitbucket

---------

Co-authored-by: Kirill Reshke <reshke@yandex-team.ru>
2023-07-27 14:21:21 +05:00
reshke d9d18b2c20
Reject connection initiating in replication lag too high. (#481)
* Reject connection initiating in replication lag too high.

In replication lag polling feature, check replication lag on connection
startuy (before auth), and reject connection if replication lag is too high.

* Apply fmt
2023-07-10 13:51:14 +03:00
reshke 1cc42b1043
configure mandatory startup parameters for backend connections (#491) 2023-07-10 12:19:50 +05:00
Тимофей Шляпников bddd8b27a8
Fix configs (#467)
Co-authored-by: tim-shlyap <tim-shlyap@yandex-team.ru>
2022-10-10 12:48:32 +05:00
reshke 1710d40246
Target session attr feature for storage (#456)
* Target session attr feature for storage


Storage host section is now accepts a comma-separated
PostgreSQL hosts list, in format "host2,host2"
or "[host1]:port1,host2" etc.

Storage structure now holds pointer to host, which connection was acquired.
This is required to cancel`s queries to work fine.

Target session attrs policies added:

    read-write
    read-only
    any (default)

Target session attrs uses pg_is_in_recovery function to
check if host in primary or replica. in_hot_standby option is not checked yet.
2022-08-18 17:15:13 +05:00
Ilya Maltsev 7a769c50dd
Ldap search filter fixing (#438)
* fixing config parser

* fixing  ldapsearchfilter

implementing standard logic for ldapsearchfilter - for example:
https://github.com/postgres/pgadmin4/blob/master/web/pgadmin/authenticate/ldap.py -   def search_ldap_user

* add example for ldapsearchfilter

* fix format
2022-07-04 12:17:31 +05:00
kirill reshke 4871445fea
Fix odyssey scram compile with PG15, also fix compile-time warns (#440)
* Fix odyssey scram compile with PG15

* fmt test script

* fix rules printing, set pool size to 85 in prep stmt test
2022-06-22 14:56:07 +03:00
Тимофей Шляпников 33647f5750
Better prometheus support (#414)
* fix collector init

* Added promhttp server

* Fix memory leak

* Fix memory leak

* Minimum viable server

* Port is now set via config

* Port is now set via config

* Port is now set via config

* Better code organisation & config procession

* Fix docs

* Fix old typo in label_count

* More reliable init

* Shuffle metrics by label for more appropriate collection

* Done with shuffling

* Done, not tested

* Done, now rebase

* Format

* Fix port

Co-authored-by: tim-shlyap <tim-shlyap@yandex-team.ru>
2022-03-25 21:21:59 +05:00
kirill reshke fade74703a
Reserve prep stmt (#397)
* Add typedef to enum declaration

* preserve prepared statement basics

* murmur hash impl

* Hash set and hash map

* Hash set and hash map

* Allow relay to rewrite packets

* Fixes

* tmp

* Fmt

* Rebase fixes

* Min working version

* Fix heap buffer overflow

* Add show server_prep_smtms command to console db

* Store prep stmts by body hash

* Fix deadlock in console show prep stmts

* Better discard

* CLeanup code

* Support for multiple override msgs

* Remove rewrite logic

* Config validation

* Fixes

* Fmt

* Deploy rewrited msgs only on sync state

* Fix memoty issues allocaltion

* Smart discard

* Fix asan

* Handle fronent close prepered statement msg

* Fix memory leak

* Fixes

* Tests

* Fix tests

* fix tests

* remove bin

* fix clang compiler warns

* Reduse matrix to 1 case, because it doesnt change anything, as tests runs inside docker
2022-01-18 14:08:15 +05:00
kirill reshke 4bb40a6088
Refactor: fix memory leak in pool, rename config files, drop scram routes from sample dev conf file (#401) 2022-01-10 13:47:54 +05:00
kirill reshke 0287a17ba5
Config override client pg options (#399)
* Alter route cmd

* Read override options from cnf

* Tests and fixs

* fixes

* Fix memory leak
2022-01-10 10:31:04 +05:00
Тимофей Шляпников d6e2c61087
Add roles in console DB (#371)
* Ldapless

* Ldapless

* Console are now considering roles

* For pull from origin

* Done, but not tested

* Works, but do not drop connections to console

* Update to origin

* Added drop connections with lowered role via reload

* Format and rename

* Fix makefile & dev.conf

* Fix makefile & dev.conf

* Fix lagpolling tests

* Fix tests

* Fix tests

* Add tests & fix .conf

* Add tests & fix .conf

* Add tests & fix .conf

Co-authored-by: tim-shlyap <tim-shlyap@yandex-team.ru>
2021-12-16 04:08:42 +05:00
kirill reshke 3562245b58
Support tls mode changes while reloading config (#389) 2021-12-13 14:05:16 +05:00
kirill reshke d215160b3a
Fix compiler warnings (#386) 2021-12-09 16:34:04 +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 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 8967555f61 Fix for auth query when user password is empty 2021-12-05 15:51:00 +00:00
reshke 60179948ae Moved dev condigs to special folder 2021-11-29 16:03:32 +05:00