Skip to content
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

Enable logging #150

Merged
merged 5 commits into from
Mar 20, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions recipes/_audit_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@
audit_plugin_options['server_audit_syslog_priority'] = \
node['mariadb']['audit_plugin']['server_audit_syslog_priority']

audit_plugin_options['enable'] = '#server_audit_logging = ON'
audit_plugin_options['server_audit_logging'] = 'ON'

This comment was marked as outdated.

This comment was marked as outdated.

# Install the MariaDB Audit Plugin
mysql_cmd = mysqlbin_cmd(node['mariadb']['install']['prefer_scl_package'],
node['mariadb']['install']['version'],
'mysql')
execute 'install_mariadb_audit_plugin' do
command "#{mysql_cmd} -e \"INSTALL PLUGIN server_audit "\
"SONAME 'server_audit';\""
command "#{mysql_cmd} -u root --password=" + \
node['mariadb']['server_root_password'] + \
" -e \"INSTALL PLUGIN server_audit SONAME 'server_audit';\""
notifies :run, 'execute[configure_mariadb_audit_plugin]', :immediately
sensitive true
not_if do
cmd = Mixlib::ShellOut.new("#{mysql_cmd} -u root -B -N -e \"SELECT 1 "\
'FROM information_schema.plugins '\
"WHERE PLUGIN_NAME = 'SERVER_AUDIT'"\
cmd = Mixlib::ShellOut.new("#{mysql_cmd} -u root " \
"--password=" + \
node['mariadb']['server_root_password'] + \
" -B -N -e \"SELECT 1 " \
"FROM information_schema.plugins " \
"WHERE PLUGIN_NAME = 'SERVER_AUDIT'" \
"AND PLUGIN_STATUS = 'ACTIVE';\"")
cmd.run_command
cmd.stdout.to_i == 1
Expand All @@ -44,6 +49,7 @@
node['mariadb']['audit_plugin']['server_audit_syslog_facility'] + '\';' \
'SET GLOBAL server_audit_syslog_priority=\'' + \
node['mariadb']['audit_plugin']['server_audit_syslog_priority'] + '\';"' \
'SET GLOBAL server_audit_logging=\'ON\';' \

This comment was marked as outdated.

"| #{mysql_cmd}"
action :nothing
end
Expand Down