Commit graph

22 commits

Author SHA1 Message Date
ParadoxV5
687377633d Extract some of #3360 fixes to 10.11.x
That PR uncovered countless issues on `my_snprintf` uses.
This commit backports a squashed subset of their fixes.
(Excludes previous parts #3485 and #3493)
2024-11-18 14:04:56 +11:00
Sergei Golubchik
a6b2f820e0 Merge branch '10.6' into 10.11 2024-05-10 20:02:18 +02:00
Julius Goryavsky
8fd515e0d2 HASHICORP_KEY_MANAGEMENT: MDEV-33420 post-fix
Compilation correction after MDEV-33420.
2024-04-20 03:51:31 +02:00
Anel Husakovic
11aeef2aa2 MDEV-33420: HASHICORP_KEY_MANAGEMENT fails on Windows with libcurl installed
- When `libcurl` is installed in path out of default path, like on
Windows, `include_directories` failed to find `curl/curl.h`.
- Fix `cmake` by using modern syntax with imported target and
`find_package`
- Fix warnings treated as the errors
  - Remove `HASHICORP_HAVE_EXCEPTIONS` macro and related code
- Add package to `Server` component in Windows
- Tested with `$ ./mysql-test/mtr --suite=vault`
- Closes PR #3068
- Reviewer: <wlad@mariadb.com>
            <julius.goryavsky@mariadb.com>
2024-04-18 01:45:24 +02:00
Julius Goryavsky
6815ab86d0 HASHICORP_KEY_MANAGEMENT: code unification between MariaDB editions 2024-04-18 01:43:56 +02:00
Sergei Golubchik
25c627885a hashicorp plugin: any 404 from the vault means "no key found"
e.g. it could be

{"errors":["no handler for route \"mariadbtest/data/1\". route entry not found."]}
2023-12-18 23:05:58 +01:00
Sergei Golubchik
0b6de3d1ce avoid "'sh' is not recognized..." error in mtr on windows 2023-09-08 19:19:16 +02:00
Brad Smith
4b87d3628a Further tweaking the alloca handling in Hashicorp plugin 2022-10-26 17:21:23 +11:00
Alexander Barkov
0703c9ec1e A cleanup for MDEV-29446 Change SHOW CREATE TABLE to display default collation
Recording test results according to MDEV-29446 changes:

  plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_encode.result
2022-09-22 11:36:18 +04:00
Vladislav Vaintroub
3aabda7e18 MDEV-28819 Statically compiled encryption plugins do not work
Disable building hashicorp encryption plugin statically
2022-06-20 16:37:49 +02:00
Brad Smith
a9fe646797 Fix building the Hashicorp plugin on OpenBSD / NetBSD and DragonFlyBSD 2022-06-18 07:52:58 +03:00
Julius Goryavsky
404984980f MDEV-28500: Hashicorp: Debian packaging is broken
This commit fixes a documentation installation
issue (for debian packaging) and generally brings
the installation control files up to date (as for
the rest of the components).
2022-05-10 08:22:21 +02:00
Julius Goryavsky
2e14f2c889 MDEV-28279: Hashicorp: Cannot migrate hexadecimal keys from file key management
This commit fixes a bug in the algorithm for converting hexadecimal
strings to binary key values, which leads to incompatibility with other
plugins and reduces the effective information capacity of the keys.
The new key conversion algorithm is incompatible with tables which
alrady encrypted using a old plugin (plugin version less than or
equalt to the 1.05).
2022-05-09 07:55:41 +02:00
Julius Goryavsky
94841ba656 Hashicorp plugin: typo fixed 2022-05-09 07:55:41 +02:00
Julius Goryavsky
8ae5408cab MDEV-28442: Hashicorp: refactoring to wrap static variables into a class
This commit contains changes to refactor the the Hashicorp plugin code
which hides all variables previously declared as "static" and which are
not user-visible parameters into a special class that contains all the
plugin's dynamic data. This was done primarily to significantly simplify
the code of the initialization and deinitialization functions, which
previously contained a large number of gotos and complex branching
conditions to control memory deallocation.
2022-05-09 07:55:41 +02:00
Julius Goryavsky
e571174e80 MDEV-28291: Hashicorp: Cache variables claim to be dynamic but changes are ignored
This commit fixes an issue with no visible update in caching
option values after changing them dynamically while the server
is running. This issue was related to forgotten copy operations
of new values into dynamic variables. At the same time, internal
variables (responsible for caching) were always updated correctly.
The commit includes a test that checks that the update is now
reflected in the values of dynamic variables.
2022-05-09 07:55:41 +02:00
Julius Goryavsky
0902cfaec8 MDEV-28330: Hashicorp: Key caching doesn't appear to be working
Added test files for mtr that test failed configuration with
--loose-hashicorp-key-management-cache-version-timeout=180000
correctly set.
2022-05-09 07:55:41 +02:00
Julius Goryavsky
3d1f765066 MDEV-28276: Hashicorp: checking that kv storage is created with version 2+
For the plugin to work properly, we need support for key versioning,
and for this, the kv storage in Hashicorp Vault must be created with
version 2 or higher. This commit adds such a check performed during
plugin initialization.

Note: checking for kv storage version during plugin initialization
can be disabled via --hashicorp-key-management-check-kv-version=off
command-line option or via the corresponding option in the server
configuration files.
2022-05-09 07:55:41 +02:00
Julius Goryavsky
1c22a9d8ae MDEV-28277: Checking for mandatory "/v1/" prefix in the URL
According to the Hashicorp Vault API specifications,
the URL to access the keys must include the "/v1/" prefix
at the beginning of the path. This commit adds this parameter
check, as well as a check for the presence of at least one
letter in the hostname inside the URL and in the secret
store name (after "/v1/").
2022-05-09 07:55:41 +02:00
Julius Goryavsky
35989d9cc1 MDEV-28281: Hashicorp: Key ID is not indicated in the log record
This commit adds an indication of the ID of the not found key
(and, when appropriate, also an indication of the version number
of the key) in the log file, making it easier to find errors.
2022-05-09 07:55:41 +02:00
Julius Goryavsky
0c5d8b8730 MDEV-28275: Hashicorp: ASAN heap-use-after-free in get_version()
Passing a string as a parameter by value has been replaced by
passing by reference to avoid using memory after it has been freed.
2022-05-09 07:55:41 +02:00
Julius Goryavsky
1146b713b2 MDEV-19281: Plugin implementation for the Hashicorp Vault KMS
- Authentication is done using the Hashicorp Vault's token
  authentication method;
- If additional client authentication is required, then the
  path to the CA authentication bundle file may be passed
  as a plugin parameter;
- The creation of the keys and their management is carried
  out using the Hashicorp Vault KMS and their tools;
- Key values stored as hexadecimal strings;
- Key values caching is supported.
- Implemented a time-invalidated cache for key values and
  for key version numbers received from the Hashicorp Valult
  server;
- The plugin uses libcurl (https) as an interface to
  the HashiCorp Vault server;
- JSON parsing is performed through the JSON service
  (through the include/mysql/service_json.h);
- HashiCorp Vault 1.2.4 was used for development and testing.
2022-05-09 07:55:41 +02:00