Commit f58c633
committed
PS-9033 fix: audit_log_filter plugin, does not register remote accesses
https://perconadev.atlassian.net/browse/PS-9033
Fixed problem with 'audit_log_filter' not being able to properly identify
remote host name (in case when user specified an IP address in the
connection string).
Original implementation used to rely on user name and host name
provided by the client (the equivalent of 'USER()' MySQL function) which
did not work as expected in all cases and could lead to filtering out
legitimate events.
In particular, when 'AuditLogFilter::get_connection_user()' was not able
to identify a non-empty 'name' / 'host' part of the user account, it used
to return early with error code causing audit events to be not logged
properly.
This fix changes the logic to use authenticated user name and host name
(the equivalent of 'CURRENT_USER()' MySQL function) when applying filtering
rules.
Not only does this fix the issue with not being able to identify host names
and skipping events in case when a connection was established to an IP
address (not to a host name), but also opens possibility to support
authenticated users with wildcard host names (like 'usr'@'%').
Wildcards support will be added in the fix for
PS-9024 "audit_log_filter_set_user does not allow wildcards in hostname"
https://perconadev.atlassian.net/browse/PS-9024
Connect / disconnect logic inside 'generate_audit_events.inc' MTR include
file made more deterministic by using 'count_sessions.inc' /
'wait_until_count_sessions.inc' pair befoire and after establishing / closing
a new connection.
Re-recorded 'audit_log_filter.writer_buffer_size_overflow' MTR test case as
proper connection event tracking caused shift in '<CONNECTION_ID>' from
single digit to 2-digit numbers.1 parent f01c613 commit f58c633
File tree
3 files changed
+5
-3
lines changed- plugin/audit_log_filter
- tests/mtr
- r
- t
3 files changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
608 | | - | |
| 608 | + | |
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
| 614 | + | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
0 commit comments