Who did what, when, where and how MySQL Audit Logging. Jeremy Glick & Andrew Moore 20/10/14



Similar documents
Andrew Moore Amsterdam 2015

ACHIEVING REGULATORY COMPLIANCE WITH MYSQL AUDIT PLUGINS. Jeremy Glick. Andrew Moore. April 2014

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Dave Stokes MySQL Community Manager

Database Administration with MySQL

Log management with Logstash and Elasticsearch. Matteo Dessalvi

The MariaDB Audit Plugin

MySQL Security: Best Practices

MySQL Security for Security Audits

Percona Server features for OpenStack and Trove Ops

5 Percona Toolkit tools that could save your day. Stéphane Combaudon FOSDEM February 3rd, 2013

<Insert Picture Here> MySQL Security In A Cloudy World

Using Logstash and Elasticsearch analytics capabilities as a BI tool

Real-time Data Analytics mit Elasticsearch. Bernhard Pflugfelder inovex GmbH

Log Analysis with the ELK Stack (Elasticsearch, Logstash and Kibana) Gary Smith, Pacific Northwest National Laboratory

MySQL Enterprise Monitor

High Availability Solutions for the MariaDB and MySQL Database

High-availability with Galera Cluster for MySQL

MySQL always-up with Galera Cluster

$99.95 per user. SQL Server 2008/R2 Database Administration CourseId: 157 Skill level: Run Time: 47+ hours (272 videos)

Processing millions of logs with Logstash

Obtaining Value from Your Database Activity Monitoring (DAM) Solution

Getting to Know the SQL Server Management Studio

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

Enterprise-level EE: Uptime, Speed, and Scale

Best Approaches to Database Auditing: Strengths and Weaknesses.

Apple Client Management with JAMF. Andrew D Huston Client Infrastructure Group Informa8on Services Kent State University

Galera Replication. Synchronous Multi-Master Replication for InnoDB. ...well, why not for any other DBMS as well. Seppo Jaakola Alexey Yurchenko

Monitoring MySQL. Kristian Köhntopp

Hardening MySQL. Maciej Dobrzański maciek at

Developing an Application Tracing Utility for Mule ESB Application on EL (Elastic Search, Log stash) Stack Using AOP


MySQL Replication. openark.org

Securing and Accelerating Databases In Minutes using GreenSQL

SQL Server Auditing. By Minette Steynberg. Audit all SQL Server activities using ApexSQL Comply

Oracle Database 11g: Security Release 2. Course Topics. Introduction to Database Security. Choosing Security Solutions

Auditing Data Access Without Bringing Your Database To Its Knees

The Future of PostgreSQL High Availability Robert Hodges - Continuent, Inc. Simon Riggs - 2ndQuadrant

What s New in MySQL 5.7 Security Georgi Joro Kodinov Team Lead MySQL Server General Team

High Availability and Scalability for Online Applications with MySQL

Overview of Databases On MacOS. Karl Kuehn Automation Engineer RethinkDB

DBA Tutorial Kai Voigt Senior MySQL Instructor Sun Microsystems Santa Clara, April 12, 2010

6231A - Maintaining a Microsoft SQL Server 2008 Database

Bernd Ahlers Michael Friedrich. Log Monitoring Simplified Get the best out of Graylog2 & Icinga 2

Welcome to Virtual Developer Day MySQL!

There are numerous ways to access monitors:

National Fire Incident Reporting System (NFIRS 5.0) Configuration Tool User's Guide

McAfee SIEM Alarms. Setting up and Managing Alarms. Introduction. What does it do? What doesn t it do?

MySQL Strategy. Morten Andersen, MySQL Enterprise Sales. Copyright 2014 Oracle and/or its affiliates. All rights reserved.

Synchronous multi-master clusters with MySQL: an introduction to Galera

Information Retrieval Elasticsearch

New Features in MySQL 5.0, 5.1, and Beyond

Recovery Principles in MySQL Cluster 5.1

Getting Started with Attunity CloudBeam for Azure SQL Data Warehouse BYOL

Basic & Advanced Administration for Citrix NetScaler 9.2

Integration of IT-DB Monitoring tools into IT General Notification Infrastructure

Testing Automation for Distributed Applications By Isabel Drost-Fromm, Software Engineer, Elastic

SynapseBackup Secure backups and disaster recovery services for both physical and virtual environments. Top reasons on why SynapseBackup is the best

Using NXLog with Elasticsearch and Kibana. Using NXLog with Elasticsearch and Kibana

SQL Server Replication Guide

Analyzing large flow data sets using. visualization tools. modern open-source data search and. FloCon Max Putas

D50323GC20 Oracle Database 11g: Security Release 2

MySQL performance in a cloud. Mark Callaghan

Maintaining Non-Stop Services with Multi Layer Monitoring

<Insert Picture Here> Oracle Database Security Overview

MySQL Backup and Recovery: Tools and Techniques. Presented by: René Senior Operational DBA

MySQL Security: What s New & Best Practices. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Oracle Database 11g: Security. What you will learn:

Monitoring MySQL. Geert Vanderkelen MySQL Senior Support Engineer Sun Microsystems

Log managing at PIC. A. Bruno Rodríguez Rodríguez. Port d informació científica Campus UAB, Bellaterra Barcelona. December 3, 2013

Achieving PCI Compliance with MySQL. Ryan Lowe & Fernando Ipar 2010 O Reilly MySQL C&E

Developing Value from Oracle s Audit Vault For Auditors and IT Security Professionals

IceWarp to IceWarp Server Migration

THE FIRST UNIFIED DATABASE SECURITY SOLUTION. Product Overview Security. Auditing. Caching. Masking.

April 8th - 10th, 2014 LUG14 LUG14. Lustre Log Analyzer. Kalpak Shah. DataDirect Networks. ddn.com DataDirect Networks. All Rights Reserved.

Encrypting MySQL data at Google. Jonas Oreland and Jeremy Cole

SQL Server 2016 New Features!

MariaDB Cassandra interoperability

High Availability, Disaster Recovery and Extreme Read Scaling using Binlog Servers. Jean-François Gagné jeanfrancois DOT gagne AT booking.

Tushar Joshi Turtle Networks Ltd

Telnet, Console and AUX Port Passwords on Cisco Routers Configuration Example

Oracle Database 11g: Security Release 2

Lab Configuring Syslog and NTP (Instructor Version)

1 Changes in this release

This guide specifies the required and supported system elements for the application.

Zend Server 4.0 Beta 2 Release Announcement What s new in Zend Server 4.0 Beta 2 Updates and Improvements Resolved Issues Installation Issues

Blue Coat Cloud Data Protection Server Administration Guide

Parallel Replication for MySQL in 5 Minutes or Less

MySQL synchronous replication in practice with Galera

QA PRO; TEST, MONITOR AND VISUALISE MYSQL PERFORMANCE IN JENKINS. Ramesh Sivaraman

Tracking Network Changes Using Change Audit

BI xpress Product Overview

Firebird. A really free database used in free and commercial projects

How To Monitor Mysql With Zabbix

Understanding MySQL storage and clustering in QueueMetrics. Loway

IceWarp Server Upgrade

How To Use Elasticsearch

SCOPTEL WITH ACTIVE DIRECTORY USER DOCUMENTATION

Performance for Site Builders

SCALABLE DATA SERVICES

Transcription:

Who did what, when, where and how MySQL Audit Logging Jeremy Glick & Andrew Moore 20/10/14

Intro 2 Hello!

Intro 3 Jeremy Glick MySQL DBA Head honcho of Chicago MySQL meetup 13 years industry experience

Intro 4 Andrew Moore Senior MySQL DBA 5+ years in MySQL world T-shirt and sticker collector Organizer SW UK MySQL meetup

WTF? 5 Why Log? What to Log? How [not] to Log

Logs 6 [timestamp]: [some useful data]

Why Log? 7 Compliance and security Debug Insight

Compliance & Security 8 Who is accessing sensitive data? What actions are they performing? HIPAA SOX PCI DSS Typically the main reason for audit logging

Compliance & Security 9 No circumventing the audit logging solution Unable to disable logging Logging on by default Logging is not preventative

Regulatory Compliance Database Auditing Requirements of Regulations Audit Requirement SOX PCI DSS HIPAA Access to sensitive data (SELECT) X X Modification of sensitive data (INSERT,UPDATE,DELETE) X Schema Changes (CREATE, ALTER, DROP) X X X Security Auth (GRANT, REVOKE) X X X Security Exceptions (Failed Logins) X X X Source: Database Administration 2nd Edition, Craig Mullins

Debugging 11 Development Production troubleshooting Retrospective investigation

Insight 12 Aggregation Trending Capacity planning

What to Log 13 Access (logins) Everything Targeted

How to Log 14 Custom code MySQL plugin Off the shelf plugins MariaDB Percona McAfee Workarounds

MySQL's Pluggable Audit Interface Available as of MySQL 5.5.3 Audit interface notifies plugin of these operations: l Message written to general log Message written to error log Query results sent to client * https://dev.mysql.com/doc/refman/5.6/en/audit-plugins.html

How to Log 16 Custom code Andrew Hutchings: http://linuxjedi.co.uk/ Other refs; Oracle: http://goo.gl/9fcegp Openark: http://goo.gl/harxvu

How [not] to Log 17 Parse logs l General Slow Binary Sniff the wire/proxy Half baked l init_connect In schema Triggers

Audit Solutions 18 Open source solutions MariaDB Percona McAfee Proprietary solutions Oracle Greensql imperva

Installation 19 Plugin installation INSTALL PLUGIN plugin_name SONAME= 'shared_lib_name.so'; plugin-load=plugin_name=shared_lib_name.so mysqld --plugin-load='plugin_name'='shared_lib_name.so' plugin_name=force

Installing An Audit Plugin Troubleshooting installation Check the mysql error log for evidence of issues starting the plugin. In some cases, you may have to make changes to SELinux or AppArmor so MySQL can write to the audit file. chcon Audit2allow Setsebool

MariaDB Audit Plugin 21 Pros Compatible with MariaDB, MySQL and Percona Server Open Source & built on the audit api Supported by MariaDB team Status variables exposed User filtering possible Cons Logs passwords in plain text No object filtering

MariaDB Audit Plugin 22 Events 20141101 13:33:26,5a11919fea9a,rdba,172.17.0.97,5,14,QUERY,,'show databases',0 20141101 13:34:15,5a11919fea9a,rdba,172.17.0.97,5,15,QUERY,,'CREATE DATABASE audit_test',0 20141101 13:34:36,5a11919fea9a,rdba,172.17.0.97,5,16,QUERY,,'create table t1(id int, c1 varchar(10)) engine innodb',1046 20141101 13:34:44,5a11919fea9a,rdba,172.17.0.97,5,0,DISCONNECT,,,0 $ perror 1046 MySQL error code 1046 (ER_NO_DB_ERROR): No database selected

MariaDB Audit Plugin 23 mysql> GRANT ALL ON *.* TO 'mdb'@'172.%' IDENTIFIED BY 'facepalm'; 20141031 23:32:24,5a11919fea9a,rdba, \ 172.17.0.88,3,7,QUERY,mysql, \ 'GRANT ALL ON *.* TO \'mdb\'@\'172.%\' IDENTIFIED BY \'facepalm\'',0

MariaDB Audit Plugin 24 Status variables mysql> show global status like '%audit%'; +----------------------------+----------------------------------+ Variable_name Value +----------------------------+----------------------------------+ Server_audit_active ON Server_audit_current_log /var/log/mysql/mariadb-audit.log Server_audit_last_error Server_audit_writes_failed 0 +----------------------------+----------------------------------+ 4 rows in set (0.00 sec)

Percona Audit Plugin 25 Pros Ships with Percona Server (no additional download) Multiple output formats (XML,JSON,CSV,syslog) Does not write passwords in plain text! Open Source supported by Percona Various performance modes Cons XML only on early version No object filtering No user filtering Only officially supported in PS

Percona Audit Plugin 26 Events mysql> select reverse(user) from mysql.user where user!= '' order by rand(); {"audit_record": {"name":"query", "record":"105834191_2014-10-29t12:06:50", "timestamp":"2014-10-31t23:43:42 UTC", "command_class":"select", "connection_id":"85", "status":0, "sqltext":"select reverse(user) from mysql.user where user!= '' order by rand()", "user":"rdba[rdba] @ [172.17.0.91]", "host":"", "os_user":"", "ip":"172.17.0.91"} }

Percona Audit Plugin audit_log_strategy (read only variable) ASYNCHRONOUS = async logging, uses buffer PERFORMANCE = ascync, (drops requests if buffer is full) SEMISYNCHRONOUS = sync logging, uses OS caching SYNCHRONOUS = sync() each request

McAfee Audit Plugin 28 Pros Compatible with MySQL and Percona Server Widest version support, 5.1+ Flexible filtering Great community support Compatible with `DAM` Cons MariaDB 10 compatibility issues Binary hooking access pattern Installation hoops

McAfee Audit Plugin 29 Events mysql> select * from audit_test; {"msg-type":"activity", "date":"1414851690462", "thread-id":"3", "query-id":"29", "user":"rdba", "priv_user":"rdba", "ip":"172.17.0.104", "cmd":"select", "objects":[{"db":"pluk","name":"audit_test","obj_type":"table"}],"query":"select * from audit_test"} }

McAfee Audit Install 30 Demo

Replication 31 Mcafee Slaves log replicated transactions by default Whitelist blank user "{}" to prevent logging of replicated transactions Percona Not logged MariaDB Not logged

Log File Storage Secure storage (hardware encryption, FS encryption) Sign logs to ensure they have not been altered Set permissions correctly at OS level Store offsite (encrypted of course) Store on read only media

Summary General best practices Utilize the log rotation facilities/logrotate script Sequential logging lives away from random access. Use FS with journalling to be crash safe(r) Synchronizing writes to the disk hurts a lot.

Log Aggregation 34

ELK+ (Elasticsearch, Logstash, Kibana) 35 Elasticsearch (search and analytics engine) Logstash (collect, parse and store log events) Kibana (easily visualize and search indexed data) + (Nagios,Ganglia,hipchat,irc,statsd...)

Standard ELK pipeline 36

ELK config 37 /etc/logstash/logstash.conf input { file { path => "/var/log/mysql/audit.log" type => "mysql-audit" } filter { do_something } output { elasticsearch { cluster => "logstash" host => elasticsearch1 } }

Kibana Visuals 38

Thank you 39 Q&A