DataSunrise Achieves AWS DevOps Competency Status in AWS DevSecOps and Monitoring, Logging, Performance

Comprehensive Database Audit in Percona Server for Enhanced Security and Compliance

Comprehensive Database Audit in Percona Server for Enhanced Security and Compliance

Introduction

In this article, we’ll explore database audit for Percona Server (MySQL), focusing on data and query auditing, and how tools like DataSunrise can enhance your overall database security strategy.

Did you know that recent cybersecurity reports reveal threat actors prefer efficient data theft methods like Business Email Compromise (BEC)? This trend highlights poorly managed data as a prime target. Such alarming insights underscore the critical importance of robust database auditing.

Percona MySQL Audit Capabilities

Native Audit Plugin

Percona Server for MySQL comes with a built-in audit plugin that offers basic auditing capabilities. This plugin allows you to track various database events and user activities.

To enable the audit plugin, you can use the following command:

INSTALL PLUGIN audit_log SONAME 'audit_log.so';
Check if the plugin is active:
SELECT * FROM information_schema.PLUGINS WHERE PLUGIN_NAME LIKE '%audit%';

Once enabled, you can configure the plugin using system variables. For example:

SET GLOBAL audit_log_file = '/var/log/mysql/audit.log';
SET GLOBAL audit_log_policy = 'ALL';

First one (audit_log_file) is read only if you set up Percona Server with Docker Image. These settings define the log file location and audit policy.

You can have a look at them as follows:

SHOW GLOBAL VARIABLES LIKE 'audit_log_file';
SHOW GLOBAL VARIABLES LIKE 'audit_log_policy';
SHOW GLOBAL VARIABLES LIKE 'general_log';
SHOW GLOBAL VARIABLES LIKE 'general_log_file';

Query Logging

Percona Server also supports query logging, which can be useful for monitoring and troubleshooting database performance.

To enable query logging:

SET GLOBAL general_log = 'ON';

This will log all executed queries to the specified file.

Native Data Audit in Percona Server

Percona Server’s audit features are not as advanced as other tools. However, they still offer valuable information on user actions and monitoring database activity.

Tracking User Logins

To track user logins, you can use the following SQL query:

SELECT user, host, db, command, time
FROM information_schema.processlist
WHERE command = 'Connect';

This query shows active connections to the database. The ‘Connect’ state is very short-lived. It only appears briefly when a connection is being established. Try this command to see all states:

SELECT user, host, db, command, time

FROM information_schema.processlist;

Most active connections will be in other states like ‘Sleep’, ‘Query’, or ‘Idle’.

Monitoring Table Access

To monitor table access, you can use triggers:

CREATE TABLE audit_log (
    id INT AUTO_INCREMENT PRIMARY KEY,
    action VARCHAR(50) NOT NULL,
    table_name VARCHAR(50) NOT NULL,
    user VARCHAR(100) NOT NULL,
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TRIGGER audit_MOCK_DATA AFTER INSERT ON MOCK_DATA
FOR EACH ROW
INSERT INTO audit_log (action, table_name, user)
VALUES ('INSERT', 'MOCK_DATA', CURRENT_USER());

INSERT INTO MOCK_DATA (id, first_name, last_name, email) VALUES 
(21, 'L1', 'R1', 'lrtthr@umich.edu');

SELECT * from MOCK_DATA md;
SELECT * FROM audit_log;

This code creates a table for the trigger to use. It then creates a trigger named ‘audit_MOCK_DATA’ that inserts data into the audit_log table. This trigger logs INSERT operations on the specified table.

Enhancing Audit Capabilities with DataSunrise

While native tools provide basic auditing, many organizations require more comprehensive solutions. This is where specialized tools like DataSunrise come in handy.

Creating a DataSunrise Instance

To set up DataSunrise for Percona MySQL auditing:

  1. Download and install DataSunrise on your server.
  2. Launch the DataSunrise console and navigate to the “Instances” section.
  3. Click “Add New Instance” and select “Percona MySQL” as the database type.
  4. Enter your Percona Server connection details and save the configuration.

In the figure below, locate the Percona MySQL Instance at the bottom of the list.

Detailed Event Descriptions for Data Audit

DataSunrise offers granular control over audit events. To access detailed event descriptions:

  1. Go to the “Audit” section in the DataSunrise console.
  2. Create a new audit rule by clicking “+ Add Rule.”
  3. Select your Percona MySQL instance.
  4. Select the events and database objects you want to monitor and configure any additional parameters. Save the rule.

The rule setup is really straightforward and simple.

DataSunrise allows you to track a wide range of events, including:

  • SELECT, INSERT, UPDATE, and DELETE operations
  • Stored procedure executions
  • User authentication attempts
  • Schema changes
  • Privilege modifications

The figure below illustrates Transactional Trails. Each event is interactive, providing valuable insights into rules and databases across your data assets. Click on any trail to explore detailed information about your entire data ecosystem.

Benefits of Advanced Database Auditing

Implementing a robust database audit solution offers numerous advantages:

  1. Improved Security: By monitoring user behavior and database activity monitoring, you can quickly detect and respond to potential security threats.
  2. Compliance: Many industries require detailed audit trails. Advanced auditing helps meet regulatory requirements like GDPR, HIPAA, and PCI DSS.
  3. Performance Optimization: Analyzing query patterns can help identify bottlenecks and optimize database performance.
  4. Forensic Analysis: In case of a security incident, detailed audit logs provide valuable information for investigation and recovery.

Best Practices for Database Auditing

To maximize the effectiveness of your database audit strategy:

  1. Define clear audit policies aligned with your organization’s security goals.
  2. Regularly review and analyze audit logs for suspicious activities.
  3. Implement real-time alerts for critical events.
  4. Ensure proper access controls for audit logs themselves.
  5. Periodically test your audit mechanisms to ensure they’re capturing all relevant data.

Conclusion

Database auditing is a critical component of a comprehensive security strategy for Percona Server environments. While native tools offer basic capabilities, specialized solutions like DataSunrise provide more robust and flexible auditing options.

By implementing thorough database auditing, you can enhance security, ensure compliance, and gain valuable insights into your database operations. Remember, effective auditing is not just about collecting data – it’s about using that data to make informed decisions and protect your valuable information assets.

DataSunrise offers user-friendly and flexible tools for database security, including comprehensive audit capabilities, data masking, and data discovery features. To explore how DataSunrise can enhance your Percona Server security, visit our website for an online demo and discover the power of advanced database protection.

Next

Enhancing Data Security and Compliance with Apache Cassandra Database Auditing

Enhancing Data Security and Compliance with Apache Cassandra Database Auditing

Learn More

Need Our Support Team Help?

Our experts will be glad to answer your questions.

Countryx
United States
United Kingdom
France
Germany
Australia
Afghanistan
Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Bouvet
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Canada
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Congo, Republic of the
Congo, The Democratic Republic of the
Cook Islands
Costa Rica
Cote D'Ivoire
Croatia
Cuba
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard Island and Mcdonald Islands
Holy See (Vatican City State)
Honduras
Hong Kong
Hungary
Iceland
India
Indonesia
Iran, Islamic Republic Of
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Japan
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Democratic People's Republic of
Korea, Republic of
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Libyan Arab Jamahiriya
Liechtenstein
Lithuania
Luxembourg
Macao
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States of
Moldova, Republic of
Monaco
Mongolia
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia, Republic of
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Palestinian Territory, Occupied
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Helena
Saint Kitts and Nevis
Saint Lucia
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
Samoa
San Marino
Sao Tome and Principe
Saudi Arabia
Senegal
Serbia and Montenegro
Seychelles
Sierra Leone
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
South Georgia and the South Sandwich Islands
Spain
Sri Lanka
Sudan
Suriname
Svalbard and Jan Mayen
Swaziland
Sweden
Switzerland
Syrian Arab Republic
Taiwan, Province of China
Tajikistan
Tanzania, United Republic of
Thailand
Timor-Leste
Togo
Tokelau
Tonga
Trinidad and Tobago
Tunisia
Turkey
Turkmenistan
Turks and Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Venezuela
Viet Nam
Virgin Islands, British
Virgin Islands, U.S.
Wallis and Futuna
Western Sahara
Yemen
Zambia
Zimbabwe
Choose a topicx
General Information
Sales
Customer Service and Technical Support
Partnership and Alliance Inquiries
General information:
info@datasunrise.com
Customer Service and Technical Support:
support.datasunrise.com
Partnership and Alliance Inquiries:
partner@datasunrise.com