-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin #934
Conversation
plugin/audit_null/audit_null.cc
Outdated
@@ -455,6 +501,9 @@ static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class, | |||
number_of_calls_general_result++; | |||
break; | |||
case MYSQL_AUDIT_GENERAL_STATUS: | |||
if (extended_info) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move extended_info
declaration here (inside the case
block).
@@ -175,6 +183,10 @@ static MYSQL_THDVAR_INT(event_order_check_exact, PLUGIN_VAR_RQCMDARG, | |||
"Plugin checks exact event order.", NULL, NULL, 1, 0, 1, | |||
0); | |||
|
|||
static MYSQL_THDVAR_INT(extended_log, PLUGIN_VAR_RQCMDARG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to declare this var as GLOBAL
-only (MYSQL_SYSVAR_INT
) since we are using a single global buffer for the output anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But doesn't that make thread level control useful? If it's a threadvar, you can turn it on for only one thread, and other threads won't accidentally modify the status variables, breaking tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such change is too visible for user to be discussed only here (unless FB chimes in)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be debug only since it's mainly used for testing? Are there security issues with non-privileged users getting access to see the last logged query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And is audit_null used outside MTR testing, in production? This is only present in that plugin, that's why I didn't see it as an issue. I can make it debug only, but that will also make all related tests debug only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not used in production, but if it's used as a template for other audit plugins, it might run the risk of it getting out. Let's make it debug-only and having the tests be debug-only would be fine.
plugin/audit_null/audit_null.cc
Outdated
@@ -431,6 +476,7 @@ static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class, | |||
const char *order_str = (const char *)THDVAR(thd, event_order_check); | |||
int event_order_started = (int)THDVAR(thd, event_order_started); | |||
int exact_check = (int)THDVAR(thd, event_order_check_exact); | |||
int extended_info = (int)THDVAR(thd, extended_log); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto extended_info = static_cast<int>(THDVAR(thd, extended_log));
plugin/audit_null/audit_null.cc
Outdated
#undef EVENT_PARAM | ||
#undef EVENT_PARAM_STR | ||
|
||
std::string str = event_str.str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto str = ...
plugin/audit_null/audit_null.cc
Outdated
@@ -455,6 +501,9 @@ static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class, | |||
number_of_calls_general_result++; | |||
break; | |||
case MYSQL_AUDIT_GENERAL_STATUS: | |||
if (extended_info) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (extended_info !=0)
|
||
INSERT INTO foo VALUES (1), (2); | ||
--replace_regex /.*(affected_rows:[^;]*).*/\1/ | ||
SHOW STATUS LIKE "Audit_null_generic_event_response"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise
|
||
SELECT * FROM foo; | ||
--replace_regex /.*(affected_rows:[^;]*).*/\1/ | ||
SHOW STATUS LIKE "Audit_null_generic_event_response"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise
|
||
DELETE FROM foo; | ||
--replace_regex /.*(affected_rows:[^;]*).*/\1/ | ||
SHOW STATUS LIKE "Audit_null_generic_event_response"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise
let $MYSQLD_PORT= `SELECT @@port`; | ||
--replace_result $MYSQLD_PORT MYSQLD_PORT | ||
--replace_regex /.*(port:[^;]*).*/\1/ | ||
SHOW STATUS LIKE "Audit_null_generic_event_response"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise
Audit_null_generic_event_response port:MYSQLD_PORT | ||
UNINSTALL PLUGIN null_audit; | ||
Warnings: | ||
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the test works with --repeat=2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked, it works.
Also, please, add Jira ticket references |
Updated: alsoadded FB8-55. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add full Jira tickets URLs to the commit message
https://jira.percona.com/browse/FB8-54
https://jira.percona.com/browse/FB8-55
https://jira.percona.com/browse/FB8-70
https://jira.percona.com/browse/FB8-101
@@ -0,0 +1,24 @@ | |||
--source include/have_ssl.inc | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add --source include/count_sessions.inc
as you are establishing/closing a new connection.
DROP TABLE foo; | ||
|
||
UNINSTALL PLUGIN null_audit; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--source include/wait_until_count_sessions.inc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still no --source include/wait_until_count_sessions.inc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
plugin/audit_null/audit_null.cc
Outdated
{ \ | ||
std::string tmp(event->name.str, event->name.length); \ | ||
boost::replace_all(tmp, "\n", "\\n"); \ | ||
event_str << #name ":" << std::string(event->name.str, event->name.length) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
event_str << #name ":" << tmp
?
sql/sql_class.cc
Outdated
@@ -893,6 +895,15 @@ void THD::cleanup_connection(void) { | |||
#endif | |||
} | |||
|
|||
void THD::set_connection_certificate(std::string const &cert) { | |||
DBUG_ASSERT(m_connection_certificate == ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DBUG_ASSERT(m_connection_certificate.empty());
sql/sql_class.h
Outdated
std::string m_connection_certificate; | ||
#endif | ||
|
||
std::string const &connection_certificate() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noexcept
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, the std::string copy constructor could throw a bad_alloc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, no copy constructor here, the result is returned by const reference
std::string const &
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, right, I completely missed the & aligned to the function name, fixed.
sql/sql_class.h
Outdated
@@ -3323,6 +3323,13 @@ class THD : public MDL_context_owner, | |||
Gtid_set owned_gtid_set; | |||
#endif | |||
|
|||
#ifdef HAVE_OPENSSL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should connection_certificate()
/ set_connection_certificate()
also be wrapped with #ifdef HAVE_OPENSSL
?
Because otherwise, this does not seem to compile without HAVE_OPENSSL
defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a trivial setter / getter, works without SSL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, my main concern here was that when HAVE_OPENSSL
is not defined, the class won't have m_connection_certificate
member and therefore connection_certificate() / set_connection_certificate()
will fail to compile as m_connection_certificate = cert;
/ return m_connection_certificate;
will be an invalid code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -4032,6 +4039,7 @@ class THD : public MDL_context_owner, | |||
m_persist_variables_init = is_init; | |||
} | |||
bool is_persist_variables_init() { return m_persist_variables_init; } | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was clang-format, but I'll recheck what happens if I remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was indeed clang-format.
@@ -130,6 +131,11 @@ static char *g_record_buffer; | |||
|
|||
#undef AUDIT_NULL_VAR | |||
|
|||
static const constexpr size_t event_response_buffer_len = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 1000 enough now when we have certificates also included in GENERAL STATUS event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now yes, as all other fields are short.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@@ -175,6 +183,10 @@ static MYSQL_THDVAR_INT(event_order_check_exact, PLUGIN_VAR_RQCMDARG, | |||
"Plugin checks exact event order.", NULL, NULL, 1, 0, 1, | |||
0); | |||
|
|||
static MYSQL_THDVAR_INT(extended_log, PLUGIN_VAR_RQCMDARG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be debug only since it's mainly used for testing? Are there security issues with non-privileged users getting access to see the last logged query.
@@ -863,6 +863,8 @@ void THD::cleanup_connection(void) { | |||
sp_cache_clear(&sp_proc_cache); | |||
sp_cache_clear(&sp_func_cache); | |||
|
|||
m_connection_certificate = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be wrapped in #ifdef HAVE_OPENSSL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the opposite: any existing HAVE_OPENSSL
uses should be removed from patches. E.g. Now CMakeLists.txt contains
ADD_DEFINITIONS(-DHAVE_OPENSSL) # TODO: remove #ifdef from C++ code
I guess it is assumed that WolfSSL is sufficiently similar to OpenSSL, and any code specific for it can be guarded with HAVE_WOLFSSL.
@@ -1058,6 +1071,8 @@ void THD::release_resources() { | |||
|
|||
if (current_thd == this) restore_globals(); | |||
|
|||
m_connection_certificate = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, does this need to be wrapped in #ifdef OPENSSL?
boost::replace_all(tmp, "\n", "\\n"); \ | ||
event_str << #name ":" << tmp << ";"; \ | ||
} | ||
std::stringstream event_str; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also seeing an internal error compiling this:
../../../plugin/audit_null/audit_null.cc: In function ‘void log_event(const mysql_event_general*)’:
../../../plugin/audit_null/audit_null.cc:438:21: error: aggregate ‘std::stringstream event_str’ has incomplete type and cannot be defined
std::stringstream event_str;
@dutow has updated the pull request. Re-import the pull request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@dutow has updated the pull request. Re-import the pull request |
@@ -130,6 +132,11 @@ static char *g_record_buffer; | |||
|
|||
#undef AUDIT_NULL_VAR | |||
|
|||
static const constexpr size_t event_response_buffer_len = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should event_response_buffer_len
and generic_event_response
definitions be also wrapped in #ifndef DBUG_OFF
?
@@ -144,6 +151,9 @@ static SHOW_VAR simple_status[] = { | |||
|
|||
#undef AUDIT_NULL_VAR | |||
|
|||
{"Audit_null_generic_event_response", (char *)generic_event_response, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also be wrapped in #ifndef DBUG_OFF
?
/* | ||
* Exposes a generic audit log event in a status variable | ||
*/ | ||
static void log_event(const mysql_event_general *event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this function also be wrapped in #ifndef DBUG_OFF
?
Jira issue: https://jira.percona.com/browse/FB8-54 Jira issue: https://jira.percona.com/browse/FB8-55 Jira issue: https://jira.percona.com/browse/FB8-70 Jira issue: https://jira.percona.com/browse/FB8-101 Reference Patch: 1def6b7 Reference Patch: ba03c70 Reference Patch: ce95a09 Reference Patch: be8c587 Reference Patch: 22b2508 Reference Patch: 588be34 Summary: This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Test Plan: This commit also introduces changes to the audit_null plugin, which makes the fields, and further similar changes testable. The audit_null plugin now has the "extended_log" variable, which can be turned on. When it's ON, the plugin logs the last generic event log into the Audit_null_generic_event_response system variable. This can be easily verified in MTR tests, which is done in the new audit_null.event_params and audit_null.event_params_cert testcases.
@dutow has updated the pull request. Re-import the pull request |
2 similar comments
@dutow has updated the pull request. Re-import the pull request |
@dutow has updated the pull request. Re-import the pull request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…gin (#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: 1def6b7 Reference Patch: ce95a09 Reference Patch: 588be34 Reference Patch: ba03c70 Reference Patch: be8c587 Reference Patch: 22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: #934 Reviewed By: lth Differential Revision: D13874133 Pulled By: lth fbshipit-source-id: 889398c
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (percona#934) (percona#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook/mysql-5.6@1def6b7 Reference Patch: facebook/mysql-5.6@ce95a09 Reference Patch: facebook/mysql-5.6@588be34 Reference Patch: facebook/mysql-5.6@ba03c70 Reference Patch: facebook/mysql-5.6@be8c587 Reference Patch: facebook/mysql-5.6@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook/mysql-5.6#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (percona#934) (percona#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook/mysql-5.6@1def6b7 Reference Patch: facebook/mysql-5.6@ce95a09 Reference Patch: facebook/mysql-5.6@588be34 Reference Patch: facebook/mysql-5.6@ba03c70 Reference Patch: facebook/mysql-5.6@be8c587 Reference Patch: facebook/mysql-5.6@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook/mysql-5.6#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (percona#934) (percona#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook/mysql-5.6@1def6b7 Reference Patch: facebook/mysql-5.6@ce95a09 Reference Patch: facebook/mysql-5.6@588be34 Reference Patch: facebook/mysql-5.6@ba03c70 Reference Patch: facebook/mysql-5.6@be8c587 Reference Patch: facebook/mysql-5.6@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook/mysql-5.6#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
…gin (facebook#934) (facebook#934) Summary: JIRA: https://jira.percona.com/browse/FB8-54 JIRA: https://jira.percona.com/browse/FB8-55 JIRA: https://jira.percona.com/browse/FB8-70 JIRA: https://jira.percona.com/browse/FB8-101 This commit adds the following fields to the generic event in audit log: * query_id * database * affected_rows * connection_certificate Reference Patch: facebook@1def6b7 Reference Patch: facebook@ce95a09 Reference Patch: facebook@588be34 Reference Patch: facebook@ba03c70 Reference Patch: facebook@be8c587 Reference Patch: facebook@22b2508 We need some extra info for the shadowing and security logging. This is a simple first step of info that MariaDB actually also exposes. Now we would have the `query_id` and the database name for general events. Making as few changes as possible to accomplish it, so I'm just taking the information from the TDH and exposing it through `mysql_event_general` struct and as a argument to disconnect. Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done. This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources. If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it. Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used. Pull Request resolved: facebook#934 Reviewed By: lloyd Differential Revision: D13874133 Pulled By: lth
Summary:
This commit adds the following fields to the generic event in audit log:
Reference Patch: 1def6b7
Reference Patch: ce95a09
Reference Patch: 588be34
Reference Patch: ba03c70
Reference Patch: be8c587
Reference Patch: 22b2508
We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the
query_id
and the database name for general events.Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through
mysql_event_general
struct and as a argument to disconnect.
Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.
This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.
If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.
Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Test Plan:
This commit also introduces changes to the audit_null plugin, which makes
the fields, and further similar changes testable.
The audit_null plugin now has the "extended_log" variable, which can be
turned on. When it's ON, the plugin logs the last generic event log
into the Audit_null_generic_event_response system variable.
This can be easily verified in MTR tests, which is done in the new
audit_null.event_params testcase.