trellix-enterprise / mysql-audit

AUDIT Plugin for MySQL. See wiki and readme for description. If you find the plugin useful, please star us on GitHub. We love stars and it's a great way to show your feedback.
Other
239 stars 57 forks source link

Can't open shared library with MariaDB-10.1.40 and mysql-audit-1.1.7 #211

Open pnedkov opened 5 years ago

pnedkov commented 5 years ago

I am running MariaDB 10.1.40 on CentOS 7 and performed the following steps:

  1. Downloaded and extracted audit-plugin-mariadb-10.1-1.1.7-805-linux-x86_64.zip

  2. Copied the so file to mysql plugins dir cp audit-plugin-mariadb-10.1-1.1.7-805/lib/libaudit_plugin.so /usr/lib64/mysql/plugin/

  3. Added plugin-load=AUDIT=libaudit_plugin.so in [mysqld] section

  4. Restarted MariaDB

I get this in my log: 2019-07-03 14:17:30 140376335628544 [ERROR] Can't open shared library '/usr/lib64/mysql/plugin/libaudit_plugin.so' (errno: 2, undefined symbol: _Z11open_tablesP3THDRK14DDL_options_stPP10TABLE_LISTPjjP19Prelocking_strategy) 2019-07-03 14:17:30 140376335628544 [ERROR] Couldn't load plugin 'AUDIT' from 'libaudit_plugin.so'.

Any ideas?


MariaDB [(none)]> status
--------------
mysql  Ver 15.1 Distrib 10.1.40-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:          3
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.1.40-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 7 min 8 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 17  Flush tables: 1  Open tables: 11  Queries per second avg: 0.009
--------------

MariaDB [(none)]>```
kubo commented 5 years ago

edited: The change of open_tables described later was reverted.

I have not tried but I guess that mysql-audit doesn't work with following MariaDB versions.

errno: 2, undefined symbol: _Z11open_tablesP3THDRK14DDL_options_stPP10TABLE_LISTPjjP19Prelocking_strategy

The symbol corresponds to the following function.

bool open_tables(THD *thd, const DDL_options_st &options,
                 TABLE_LIST **tables, uint *counter, uint flags,
                 Prelocking_strategy *prelocking_strategy);

However it was changed in MariaDB 10.1.39, 10.2.24, 10.3.15 and 10.4.5 as follows and reverted in the 10.1.41, 10.2.25, 10.3.16 and 10.4.6.

bool open_tables(THD *thd, const DDL_options_st &options,
                 TABLE_LIST **tables, uint *counter,
                 Sroutine_hash_entry **sroutine_to_open, uint flags,
                 Prelocking_strategy *prelocking_strategy);

The open_tables function in MariaDB 5.5.64 was changed similarly and reverted in the 5.5.65.