SlideShare una empresa de Scribd logo
1 de 40
Descargar para leer sin conexión
#PerconaLive @bytebot @RonaldBradford
Securing your
MySQL/MariaDB Data
Ronald Bradford, Colin Charles
Percona Live Europe Amsterdam 2016
#PerconaLive @bytebot @RonaldBradford
About: Colin Charles
● Chief Evangelist (in the CTO office), Percona Inc
● Founding team of MariaDB Server (2009-2016), previously at Monty Program
Ab, merged with SkySQL Ab, now MariaDB Corporation
● Formerly MySQL AB (exit: Sun Microsystems)
● Past lives include Fedora Project (FESCO), OpenOffice.org
● MySQL Community Contributor of the Year Award winner 2014
● http://bytebot.net/blog/
#PerconaLive @bytebot @RonaldBradford
About: Ronald Bradford
● Experienced MySQL database guy
● Author/Blogger/Speaker
● Looking for my next great opportunity
● http://ronaldbradford.com/presentations/
● http://effectivemysql.com
#PerconaLive @bytebot @RonaldBradford
Agenda
● Observed insecure practices
● Securing communications
● Securing connections
● Securing data
● Securing user accounts
● Securing server access
#PerconaLive @bytebot @RonaldBradford
Signs of Poor Security
● old_passwords
● Users without passwords
● Anonymous users
● GRANT privilege users
● ALL privilege users
● '%' host user accounts
● 'root' MySQL user without password
● 'root' MySQL user
● Generic OS DBA user e.g. 'dba'
● Disabled OS
Firewall/SELinux/Apparmor
● Open data directory privileges
● Default test database
Found in
any version
#PerconaLive @bytebot @RonaldBradford
Easy Fixes
$ mysql_secure_installation
#PerconaLive @bytebot @RonaldBradford
Current Insecure Practices
● Using password on command line
○ Command history
○ MySQL shell history
● Using simple passwords
○ It's just a test environment
● Using excessive permissions
○ GRANT, ALL, *.*, %
Very easy to
fix practices
#PerconaLive @bytebot @RonaldBradford
Why being SUPER is bad (GRANT ALL ON *.*)
● Bypasses read_only
● Bypasses init_connect
● Can disable binary logging
● Can change dynamic configuration
● Takes the reserved connection
http://ronaldbradford.com/blog/why-grant-all-is-bad-2010-08-06/
http://effectivemysql.com/presentation/mysql-idiosyncrasies-that-bite/
#PerconaLive @bytebot @RonaldBradford
Secure Communications
● SSL for replication
● SSL for client connections
● SSL for admin connections
● Encryption on the wire
https://dev.mysql.com/doc/refman/5.6/en/secure-connections.html
https://dev.mysql.com/doc/refman/5.7/en/secure-connections.html
#PerconaLive @bytebot @RonaldBradford
Secure Communications
[mysqld]
ssl-ca=ca.pem
ssl-cert=server-cert.pem
ssl-key=server-key.pem
#PerconaLive @bytebot @RonaldBradford
SSL Protocols and Ciphers
mysql> SHOW SESSION STATUS LIKE 'Ssl_version';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Ssl_version | TLSv1 |
+---------------+-------+
mysql> SHOW SESSION STATUS LIKE 'Ssl_cipher';
+---------------+---------------------------+
| Variable_name | Value |
+---------------+---------------------------+
| Ssl_cipher | DHE-RSA-AES128-GCM-SHA256 |
+---------------+---------------------------+
#PerconaLive @bytebot @RonaldBradford
SSL Client Connections
Https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html
import mysql.connector
from mysql.connector.constants import ClientFlag
config = {
'user': 'ssluser',
'password': 'asecret',
'host': '127.0.0.1',
'client_flags': [ClientFlag.SSL],
'ssl_ca': '/opt/mysql/ssl/ca.pem',
'ssl_cert': '/opt/mysql/ssl/client-cert.pem',
'ssl_key': '/opt/mysql/ssl/client-key.pem',
}
https://dev.mysql.com/doc/connectors/en/connector-net-tutorials-ssl.html
#PerconaLive @bytebot @RonaldBradford
Secure Connections
● mysql_ssl_rsa_setup in MySQL 5.7
○ This program creates the SSL certificate and key files and RSA key-pair
files required to support secure connections using SSL and secure
password exchange using RSA over unencrypted connections, if those
files are missing.
● uses the openssl command
#PerconaLive @bytebot @RonaldBradford
Secure Storage
● Encryption of data at rest
○ Data (table vs tablespace)
○ Binary Logs
○ Other Logs
● Key management
#PerconaLive @bytebot @RonaldBradford
Encryption in MariaDB Server
● Encryption: tablespace OR table level encryption with support for rolling keys
using the AES algorithm
○ table encryption — PAGE_ENCRYPTION=1
○ tablespace encryption — encrypts everything including log files
● file_key_management_filename, file_key_management_filekey,
file_key_management_encryption_algorithm
● Well documented —
https://mariadb.com/kb/en/mariadb/data-at-rest-encryption/
● Tablespace/logs scrubbing: background process that regularly scans through
the tables and upgrades the encryption keys
● --encrypt-tmp-files & --encrypt-binlog
#PerconaLive @bytebot @RonaldBradford
Encryption in MariaDB Server II
[mysqld]
plugin-load-add=file_key_management.so
file-key-management
file-key-management-filename = /home/mdb/keys.enc
innodb-encrypt-tables
innodb-encrypt-log
innodb-encryption-threads=4
aria-encrypt-tables=1 # PAGE row format
encrypt-tmp-disk-tables=1 # this is for Aria
CREATE TABLE customer (
customer_id bigint not null primary key,
customer_name varchar(80),
customer_creditcard varchar(20))
ENGINE=InnoDB
page_encryption=1
page_encryption_key=1;
#PerconaLive @bytebot @RonaldBradford
Encryption in MariaDB Server III
● Use the preset! - /etc/my.cnf.d/enable_encryption.preset
● MariaDB Enterprise has a plugin for Amazon Key Management Server (KMS)
○ The reality is you can just compile this for MariaDB Server
● mysqlbinlog has no way to read (i.e. decrypt) an encrypted binlog
● This does not work with MariaDB Galera Cluster yet (gcache is not encrypted
yet), and also xtrabackup needs additional work (i.e. if you encrypt the redo
log)
#PerconaLive @bytebot @RonaldBradford
Encryption in MySQL
● MySQL 5.7.11 introduces InnoDB tablespace encryption
● early-plugin-load=keyring_file.so in my.cnf
● Must use innodb_file_per_table
● Convert via ALTER TABLE table ENCRYPTION=‘Y’
● Data is not encrypted in the redo/undo/binary logs
● Has external key management (Oracle Key Vault)
#PerconaLive @bytebot @RonaldBradford
Secure Accounts
● Privileges
● Passwords
● Password filesystem storage
#PerconaLive @bytebot @RonaldBradford
MySQL 5.6 improvements
● Password expiry - ALTER USER 'foo'@'localhost' PASSWORD EXPIRE;
● Password validation plugin - VALIDATE_PASSWORD_STRENGTH()
● mysql_config_editor - store authentication credentials in an encrypted login
path file named .mylogin.cnf
○ http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html
● Random ‘root’ password on install
○ mysql_install_db —random-passwords stored in $HOME/.mysql_secret
#PerconaLive @bytebot @RonaldBradford
MySQL 5.7 improvements
● Improved password expiry — automatic password expiration available, so set
default_password_lifetime in my.cnf
● You can also require password to be changed every n-days
○ ALTER USER ‘foo'@'localhost' PASSWORD EXPIRE INTERVAL n DAY;
● There is also account locking/unlocking now
○ ACCOUNT LOCK/ACCOUNT UNLOCK
#PerconaLive @bytebot @RonaldBradford
MariaDB Server passwords
● Password validation plugin (finally) exists now
○ https://mariadb.com/kb/en/mariadb/development/mariadb-internals-documentation/password-v
alidation/
● simple_password_check password validation plugin
○ can enforce a minimum password length and guarantee that a password contains at least a
specified number of uppercase and lowercase letters, digits, and punctuation characters.
● cracklib_password_check password validation plugin
○ Allows passwords that are strong enough to pass CrackLib test. This is the same test that
pam_cracklib.so does
#PerconaLive @bytebot @RonaldBradford
Authentication in MySQL / MariaDB Server
● Auth_socket - Authenticates against the Unix socket file, using so_peercred
● Sha256_password - default-authentication-plugin=sha256_password,
passwords never exposed as cleartext when connecting; SSL or RSA auth
● Kerberos/GSSAPI/SSPI - User principals: <username>@<KERBEROS
REALM>
● Active Directory (Enterprise only)
● Mysql_no_login ( MySQL 5.7 ) - prevents all client connections to an account
that uses it
#PerconaLive @bytebot @RonaldBradford
PAM authentication
Percona Server
INSTALL PLUGIN auth_pam SONAME ‘auth_pam.so';
CREATE USER byte IDENTIFIED WITH auth_pam;
In /etc/pam.d/mysqld:
auth required pam_warn.so
auth required pam_unix.so audit
account required pam_unix.so audit
MariaDB Server
INSTALL SONAME ‘auth_pam’;
CREATE USER byte IDENTIFIED via pam USING
‘mariadb’;
Edit /etc/pam.d/mariadb:
auth required pam_unix.so
account required pam_unix.so
Just use —pam-use-cleartext-plugin for MySQL to use
mysql_cleartext_password instead of dialog plugin
#PerconaLive @bytebot @RonaldBradford
SQL standard Roles
● Bundles users together, with similar privileges - follows the SQL standard
● MariaDB Server 10.0 (10.1 adds that each user can have a DEFAULT ROLE)
● MySQL 8.0 DMR
CREATE ROLE audit_bean_counters;
GRANT SELECT ON accounts.* to audit_bean_counters;
GRANT audit_bean_counters to ceo;
#PerconaLive @bytebot @RonaldBradford
Auditing
MySQL
- Logging account access
- Logging SQL statements
- Logging uncommon SQL patterns
OS
Logging account logins
Logging sudo commands
#PerconaLive @bytebot @RonaldBradford
Auditing Implementation
● MariaDB Server
○ User filtering as an additional feature via audit API extensions
○ Query cache enabled? No table records
● Percona
○ Multiple output formats: OLD, NEW, JSON, CSV
○ Filter by user, SQL command type, database,
○ Auditing can be expensive, so asynchronous/performance/semisynchronous/synchronous
modes for logging - e.g. log using memory buffers, drop messages if buffers are full, or log
directly to file, flush and sync at events, etc.
● McAfee Audit plugin
○ Uses offsets
● MySQL Enterprise Audit Plugin (utility: mysqlauditgrep)
#PerconaLive @bytebot @RonaldBradford
Firewall Implementation
MySQL - MySQL Enterprise Firewall
MariaDB - MariaDB MaxScale dbfirewallfilter
Percona - use MariaDB MaxScale / ProxySQL
#PerconaLive @bytebot @RonaldBradford
SQL Injection
● Always using bind variables
● Escape input content
● Restricted "least" privileges
○ Do not have GRANT ALL
#PerconaLive @bytebot @RonaldBradford
Database Server Access
● Restricting user access to your database server (login accounts)
○ Every physical person has a dedicated login
○ Separate OS & Database accounts
○ sudo restrictions (e.g. sudo su -)
■ Setup sudo group
■ Grant only specific commands to execute
○ Never share account details
● MFA
#PerconaLive @bytebot @RonaldBradford
Database Server Access
● Restricting traffic to your database server (open ports)
● Run a software firewall
○ iptables, ufw
● You should use OS software meant to benefit security
○ SELinux / Apparmor
#PerconaLive @bytebot @RonaldBradford
Database Server Access
● If you can login, and stop MySQL, you can bypass security
○ --skip-grant-tables
● If you can edit /etc/my.cnf you can set
○ --init-file=/path/to/my.sql
● If you use --init-file, can you modify content of file
#PerconaLive @bytebot @RonaldBradford
Database Server Access
● Restrict access to datadir
● Restrict access to view mysql.user table on filesystem
● Check out the examples of how to Hack MySQL
http://effectivemysql.com/downloads/MySQLSecurityEssentialsPerconaLive2015.pdf
#PerconaLive @bytebot @RonaldBradford
Installation
● Using your Linux distribution… mostly gets you MariaDB when you ask for
mysql-server
○ Except on Debian/Ubuntu
■ However, when you get mariadb-server, you get an authentication plugin — auth_socket
for “automatic logins”
○ You are asked by debhelper to enter a password
● You can use the APT/YUM repositories from Oracle MySQL, Percona or
MariaDB
● Don’t disable SELinux: system_u:system_r:mysqld_t:s0
#PerconaLive @bytebot @RonaldBradford
Update cadence
A security patch is so named because it improves security and generally
addresses a means of attack of your system
● OS
● Database
● Application Stack
Why are you still running MySQL 5.5 or older?
#PerconaLive @bytebot @RonaldBradford
Deployment Security
Who has control over running deployments?
i.e. deploying code that manipulates your data or structure
An application user SHOULD NOT have CREATE, ALTER, DROP privileges
● User to write data
● User to read data
● DBA to administer data (restricted to localhost)
#PerconaLive @bytebot @RonaldBradford
Use of Docker Containers
Docker shows a disregard for security with 'root' OS logins by default
● MySQL server installation approach via exposed passwords
○ See Giuseppe's MySQL Docker operations tutorial
● Configuration is contained with container
○ Can you access the container via SSH
○ Can you copy and use container
#PerconaLive @bytebot @RonaldBradford
Reference Material
https://www.mysql.com/why-mysql/presentations/mysql-security-best-practices/
● MySQL Authentication and Password Policies
● MySQL Authorization and Privilege Management
● MySQL Encryption to secure sensitive data
● MySQL Enterprise Firewall to block database attacks such as an SQL
Injection
● MySQL Enterprise Audit to implement policy
#PerconaLive @bytebot @RonaldBradford
MySQL Manual Security Practices
http://dev.mysql.com/doc/refman/5.5/en/security.html
http://dev.mysql.com/doc/refman/5.6/en/security.html
http://dev.mysql.com/doc/refman/5.7/en/security.html
#PerconaLive @bytebot @RonaldBradford
Rate us! Thanks/Q&A
● Don’t forget to rate us in the app!
● Ronald Bradford: @RonaldBradford /
http://effectivemysql.com
● Colin Charles: @bytebot /
http://www.bytebot.net/blog/

Más contenido relacionado

La actualidad más candente

Meet MariaDB 10.1 at the Bulgaria Web Summit
Meet MariaDB 10.1 at the Bulgaria Web SummitMeet MariaDB 10.1 at the Bulgaria Web Summit
Meet MariaDB 10.1 at the Bulgaria Web SummitColin Charles
 
Distributions from the view a package
Distributions from the view a packageDistributions from the view a package
Distributions from the view a packageColin Charles
 
The Complete MariaDB Server tutorial
The Complete MariaDB Server tutorialThe Complete MariaDB Server tutorial
The Complete MariaDB Server tutorialColin Charles
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Colin Charles
 
MariaDB Server Compatibility with MySQL
MariaDB Server Compatibility with MySQLMariaDB Server Compatibility with MySQL
MariaDB Server Compatibility with MySQLColin Charles
 
Best practices for MySQL/MariaDB Server/Percona Server High Availability
Best practices for MySQL/MariaDB Server/Percona Server High AvailabilityBest practices for MySQL/MariaDB Server/Percona Server High Availability
Best practices for MySQL/MariaDB Server/Percona Server High AvailabilityColin Charles
 
Lessons from database failures
Lessons from database failures Lessons from database failures
Lessons from database failures Colin Charles
 
My first moments with MongoDB
My first moments with MongoDBMy first moments with MongoDB
My first moments with MongoDBColin Charles
 
MySQL features missing in MariaDB Server
MySQL features missing in MariaDB ServerMySQL features missing in MariaDB Server
MySQL features missing in MariaDB ServerColin Charles
 
Databases in the hosted cloud
Databases in the hosted cloudDatabases in the hosted cloud
Databases in the hosted cloudColin Charles
 
Better encryption & security with MariaDB 10.1 & MySQL 5.7
Better encryption & security with MariaDB 10.1 & MySQL 5.7Better encryption & security with MariaDB 10.1 & MySQL 5.7
Better encryption & security with MariaDB 10.1 & MySQL 5.7Colin Charles
 
Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Colin Charles
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialColin Charles
 
Cool MariaDB Plugins
Cool MariaDB Plugins Cool MariaDB Plugins
Cool MariaDB Plugins Colin Charles
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialColin Charles
 
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonMariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonIvan Zoratti
 
The MySQL ecosystem - understanding it, not running away from it!
The MySQL ecosystem - understanding it, not running away from it! The MySQL ecosystem - understanding it, not running away from it!
The MySQL ecosystem - understanding it, not running away from it! Colin Charles
 
MariaDB 10 and what's new with the project
MariaDB 10 and what's new with the projectMariaDB 10 and what's new with the project
MariaDB 10 and what's new with the projectColin Charles
 
Forking Successfully - or is a branch better?
Forking Successfully - or is a branch better?Forking Successfully - or is a branch better?
Forking Successfully - or is a branch better?Colin Charles
 

La actualidad más candente (20)

Meet MariaDB 10.1 at the Bulgaria Web Summit
Meet MariaDB 10.1 at the Bulgaria Web SummitMeet MariaDB 10.1 at the Bulgaria Web Summit
Meet MariaDB 10.1 at the Bulgaria Web Summit
 
Distributions from the view a package
Distributions from the view a packageDistributions from the view a package
Distributions from the view a package
 
The Complete MariaDB Server tutorial
The Complete MariaDB Server tutorialThe Complete MariaDB Server tutorial
The Complete MariaDB Server tutorial
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016
 
MariaDB Server Compatibility with MySQL
MariaDB Server Compatibility with MySQLMariaDB Server Compatibility with MySQL
MariaDB Server Compatibility with MySQL
 
Best practices for MySQL/MariaDB Server/Percona Server High Availability
Best practices for MySQL/MariaDB Server/Percona Server High AvailabilityBest practices for MySQL/MariaDB Server/Percona Server High Availability
Best practices for MySQL/MariaDB Server/Percona Server High Availability
 
Lessons from database failures
Lessons from database failures Lessons from database failures
Lessons from database failures
 
My first moments with MongoDB
My first moments with MongoDBMy first moments with MongoDB
My first moments with MongoDB
 
MySQL features missing in MariaDB Server
MySQL features missing in MariaDB ServerMySQL features missing in MariaDB Server
MySQL features missing in MariaDB Server
 
Databases in the hosted cloud
Databases in the hosted cloudDatabases in the hosted cloud
Databases in the hosted cloud
 
Better encryption & security with MariaDB 10.1 & MySQL 5.7
Better encryption & security with MariaDB 10.1 & MySQL 5.7Better encryption & security with MariaDB 10.1 & MySQL 5.7
Better encryption & security with MariaDB 10.1 & MySQL 5.7
 
Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability Tutorial
 
Cool MariaDB Plugins
Cool MariaDB Plugins Cool MariaDB Plugins
Cool MariaDB Plugins
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete Tutorial
 
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonMariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
 
Why MariaDB?
Why MariaDB?Why MariaDB?
Why MariaDB?
 
The MySQL ecosystem - understanding it, not running away from it!
The MySQL ecosystem - understanding it, not running away from it! The MySQL ecosystem - understanding it, not running away from it!
The MySQL ecosystem - understanding it, not running away from it!
 
MariaDB 10 and what's new with the project
MariaDB 10 and what's new with the projectMariaDB 10 and what's new with the project
MariaDB 10 and what's new with the project
 
Forking Successfully - or is a branch better?
Forking Successfully - or is a branch better?Forking Successfully - or is a branch better?
Forking Successfully - or is a branch better?
 

Destacado

The MySQL Server Ecosystem in 2016
The MySQL Server Ecosystem in 2016The MySQL Server Ecosystem in 2016
The MySQL Server Ecosystem in 2016Colin Charles
 
Lessons from {distributed,remote,virtual} communities and companies
Lessons from {distributed,remote,virtual} communities and companiesLessons from {distributed,remote,virtual} communities and companies
Lessons from {distributed,remote,virtual} communities and companiesColin Charles
 
A Simple Multi-player Video Game Framework for Experimenting and Teaching C...
A Simple Multi-player Video Game  Framework for Experimenting  and Teaching C...A Simple Multi-player Video Game  Framework for Experimenting  and Teaching C...
A Simple Multi-player Video Game Framework for Experimenting and Teaching C...Mindtrek
 
The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016sys army
 
Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...
Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...
Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...Mindtrek
 
Could the Next Steve Jobs be Asian
Could the Next Steve Jobs be AsianCould the Next Steve Jobs be Asian
Could the Next Steve Jobs be AsianBenjamin Joffe
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary logFrederic Descamps
 
MySQL Server Backup, Restoration, And Disaster Recovery Planning Presentation
MySQL Server Backup, Restoration, And Disaster Recovery Planning PresentationMySQL Server Backup, Restoration, And Disaster Recovery Planning Presentation
MySQL Server Backup, Restoration, And Disaster Recovery Planning PresentationColin Charles
 
Hoppala at O'Reilly Where 2.0 Conference
Hoppala at O'Reilly Where 2.0 ConferenceHoppala at O'Reilly Where 2.0 Conference
Hoppala at O'Reilly Where 2.0 ConferenceMarc René Gardeya
 
ProxySQL - High Performance and HA Proxy for MySQL
ProxySQL - High Performance and HA Proxy for MySQLProxySQL - High Performance and HA Proxy for MySQL
ProxySQL - High Performance and HA Proxy for MySQLRené Cannaò
 

Destacado (11)

The MySQL Server Ecosystem in 2016
The MySQL Server Ecosystem in 2016The MySQL Server Ecosystem in 2016
The MySQL Server Ecosystem in 2016
 
Lessons from {distributed,remote,virtual} communities and companies
Lessons from {distributed,remote,virtual} communities and companiesLessons from {distributed,remote,virtual} communities and companies
Lessons from {distributed,remote,virtual} communities and companies
 
A Simple Multi-player Video Game Framework for Experimenting and Teaching C...
A Simple Multi-player Video Game  Framework for Experimenting  and Teaching C...A Simple Multi-player Video Game  Framework for Experimenting  and Teaching C...
A Simple Multi-player Video Game Framework for Experimenting and Teaching C...
 
The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016
 
Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...
Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...
Otto Kekäläinen - Forking in Open Source: Case Study of MySQL/MariaDB - Mindt...
 
Could the Next Steve Jobs be Asian
Could the Next Steve Jobs be AsianCould the Next Steve Jobs be Asian
Could the Next Steve Jobs be Asian
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary log
 
MySQL Server Backup, Restoration, And Disaster Recovery Planning Presentation
MySQL Server Backup, Restoration, And Disaster Recovery Planning PresentationMySQL Server Backup, Restoration, And Disaster Recovery Planning Presentation
MySQL Server Backup, Restoration, And Disaster Recovery Planning Presentation
 
Hoppala at O'Reilly Where 2.0 Conference
Hoppala at O'Reilly Where 2.0 ConferenceHoppala at O'Reilly Where 2.0 Conference
Hoppala at O'Reilly Where 2.0 Conference
 
Automated master failover
Automated master failoverAutomated master failover
Automated master failover
 
ProxySQL - High Performance and HA Proxy for MySQL
ProxySQL - High Performance and HA Proxy for MySQLProxySQL - High Performance and HA Proxy for MySQL
ProxySQL - High Performance and HA Proxy for MySQL
 

Similar a Securing your MySQL / MariaDB Server data

MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015Dave Stokes
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsDerek Downey
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQLMydbops
 
Securing oracle e-business suite 12.1 and 12.2 technology infrastructure
Securing oracle e-business suite 12.1 and 12.2 technology infrastructureSecuring oracle e-business suite 12.1 and 12.2 technology infrastructure
Securing oracle e-business suite 12.1 and 12.2 technology infrastructurevasuballa
 
DB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLDB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLMarcelo Altmann
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityVinicius M Grippa
 
MySQL Security and Standardization at PayPal - Percona Live 2019
MySQL Security and Standardization at PayPal - Percona Live 2019MySQL Security and Standardization at PayPal - Percona Live 2019
MySQL Security and Standardization at PayPal - Percona Live 2019Yashada Jadhav
 
Integrating best of breed open source tools to vitess orchestrator pleu21
Integrating best of breed open source tools to vitess  orchestrator   pleu21Integrating best of breed open source tools to vitess  orchestrator   pleu21
Integrating best of breed open source tools to vitess orchestrator pleu21Alkin Tezuysal
 
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019Alkin Tezuysal
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with PuppetKris Buytaert
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
Webinar: MariaDB Provides the Solution to Ease Multi-Source Replication
Webinar: MariaDB Provides the Solution to Ease Multi-Source ReplicationWebinar: MariaDB Provides the Solution to Ease Multi-Source Replication
Webinar: MariaDB Provides the Solution to Ease Multi-Source ReplicationWagner Bianchi
 
제3회난공불락 오픈소스 인프라세미나 - MySQL
제3회난공불락 오픈소스 인프라세미나 - MySQL제3회난공불락 오픈소스 인프라세미나 - MySQL
제3회난공불락 오픈소스 인프라세미나 - MySQLTommy Lee
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentJean-François Gagné
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloudTahsin Hasan
 
NoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
NoSQL on MySQL - MySQL Document Store by Vadim TkachenkoNoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
NoSQL on MySQL - MySQL Document Store by Vadim TkachenkoData Con LA
 

Similar a Securing your MySQL / MariaDB Server data (20)

MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
 
Curso de MySQL 5.7
Curso de MySQL 5.7Curso de MySQL 5.7
Curso de MySQL 5.7
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
 
Securing oracle e-business suite 12.1 and 12.2 technology infrastructure
Securing oracle e-business suite 12.1 and 12.2 technology infrastructureSecuring oracle e-business suite 12.1 and 12.2 technology infrastructure
Securing oracle e-business suite 12.1 and 12.2 technology infrastructure
 
DB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQLDB Floripa - ProxySQL para MySQL
DB Floripa - ProxySQL para MySQL
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL Security
 
MySQL Security and Standardization at PayPal - Percona Live 2019
MySQL Security and Standardization at PayPal - Percona Live 2019MySQL Security and Standardization at PayPal - Percona Live 2019
MySQL Security and Standardization at PayPal - Percona Live 2019
 
Integrating best of breed open source tools to vitess orchestrator pleu21
Integrating best of breed open source tools to vitess  orchestrator   pleu21Integrating best of breed open source tools to vitess  orchestrator   pleu21
Integrating best of breed open source tools to vitess orchestrator pleu21
 
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019Mysql 8 vs Mariadb 10.4 Highload++ 2019
Mysql 8 vs Mariadb 10.4 Highload++ 2019
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Webinar: MariaDB Provides the Solution to Ease Multi-Source Replication
Webinar: MariaDB Provides the Solution to Ease Multi-Source ReplicationWebinar: MariaDB Provides the Solution to Ease Multi-Source Replication
Webinar: MariaDB Provides the Solution to Ease Multi-Source Replication
 
제3회난공불락 오픈소스 인프라세미나 - MySQL
제3회난공불락 오픈소스 인프라세미나 - MySQL제3회난공불락 오픈소스 인프라세미나 - MySQL
제3회난공불락 오픈소스 인프라세미나 - MySQL
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
 
Guob - MySQL e LGPD
Guob - MySQL e LGPDGuob - MySQL e LGPD
Guob - MySQL e LGPD
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
NoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
NoSQL on MySQL - MySQL Document Store by Vadim TkachenkoNoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
NoSQL on MySQL - MySQL Document Store by Vadim Tkachenko
 

Último

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Securing your MySQL / MariaDB Server data

  • 1. #PerconaLive @bytebot @RonaldBradford Securing your MySQL/MariaDB Data Ronald Bradford, Colin Charles Percona Live Europe Amsterdam 2016
  • 2. #PerconaLive @bytebot @RonaldBradford About: Colin Charles ● Chief Evangelist (in the CTO office), Percona Inc ● Founding team of MariaDB Server (2009-2016), previously at Monty Program Ab, merged with SkySQL Ab, now MariaDB Corporation ● Formerly MySQL AB (exit: Sun Microsystems) ● Past lives include Fedora Project (FESCO), OpenOffice.org ● MySQL Community Contributor of the Year Award winner 2014 ● http://bytebot.net/blog/
  • 3. #PerconaLive @bytebot @RonaldBradford About: Ronald Bradford ● Experienced MySQL database guy ● Author/Blogger/Speaker ● Looking for my next great opportunity ● http://ronaldbradford.com/presentations/ ● http://effectivemysql.com
  • 4. #PerconaLive @bytebot @RonaldBradford Agenda ● Observed insecure practices ● Securing communications ● Securing connections ● Securing data ● Securing user accounts ● Securing server access
  • 5. #PerconaLive @bytebot @RonaldBradford Signs of Poor Security ● old_passwords ● Users without passwords ● Anonymous users ● GRANT privilege users ● ALL privilege users ● '%' host user accounts ● 'root' MySQL user without password ● 'root' MySQL user ● Generic OS DBA user e.g. 'dba' ● Disabled OS Firewall/SELinux/Apparmor ● Open data directory privileges ● Default test database Found in any version
  • 6. #PerconaLive @bytebot @RonaldBradford Easy Fixes $ mysql_secure_installation
  • 7. #PerconaLive @bytebot @RonaldBradford Current Insecure Practices ● Using password on command line ○ Command history ○ MySQL shell history ● Using simple passwords ○ It's just a test environment ● Using excessive permissions ○ GRANT, ALL, *.*, % Very easy to fix practices
  • 8. #PerconaLive @bytebot @RonaldBradford Why being SUPER is bad (GRANT ALL ON *.*) ● Bypasses read_only ● Bypasses init_connect ● Can disable binary logging ● Can change dynamic configuration ● Takes the reserved connection http://ronaldbradford.com/blog/why-grant-all-is-bad-2010-08-06/ http://effectivemysql.com/presentation/mysql-idiosyncrasies-that-bite/
  • 9. #PerconaLive @bytebot @RonaldBradford Secure Communications ● SSL for replication ● SSL for client connections ● SSL for admin connections ● Encryption on the wire https://dev.mysql.com/doc/refman/5.6/en/secure-connections.html https://dev.mysql.com/doc/refman/5.7/en/secure-connections.html
  • 10. #PerconaLive @bytebot @RonaldBradford Secure Communications [mysqld] ssl-ca=ca.pem ssl-cert=server-cert.pem ssl-key=server-key.pem
  • 11. #PerconaLive @bytebot @RonaldBradford SSL Protocols and Ciphers mysql> SHOW SESSION STATUS LIKE 'Ssl_version'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Ssl_version | TLSv1 | +---------------+-------+ mysql> SHOW SESSION STATUS LIKE 'Ssl_cipher'; +---------------+---------------------------+ | Variable_name | Value | +---------------+---------------------------+ | Ssl_cipher | DHE-RSA-AES128-GCM-SHA256 | +---------------+---------------------------+
  • 12. #PerconaLive @bytebot @RonaldBradford SSL Client Connections Https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html import mysql.connector from mysql.connector.constants import ClientFlag config = { 'user': 'ssluser', 'password': 'asecret', 'host': '127.0.0.1', 'client_flags': [ClientFlag.SSL], 'ssl_ca': '/opt/mysql/ssl/ca.pem', 'ssl_cert': '/opt/mysql/ssl/client-cert.pem', 'ssl_key': '/opt/mysql/ssl/client-key.pem', } https://dev.mysql.com/doc/connectors/en/connector-net-tutorials-ssl.html
  • 13. #PerconaLive @bytebot @RonaldBradford Secure Connections ● mysql_ssl_rsa_setup in MySQL 5.7 ○ This program creates the SSL certificate and key files and RSA key-pair files required to support secure connections using SSL and secure password exchange using RSA over unencrypted connections, if those files are missing. ● uses the openssl command
  • 14. #PerconaLive @bytebot @RonaldBradford Secure Storage ● Encryption of data at rest ○ Data (table vs tablespace) ○ Binary Logs ○ Other Logs ● Key management
  • 15. #PerconaLive @bytebot @RonaldBradford Encryption in MariaDB Server ● Encryption: tablespace OR table level encryption with support for rolling keys using the AES algorithm ○ table encryption — PAGE_ENCRYPTION=1 ○ tablespace encryption — encrypts everything including log files ● file_key_management_filename, file_key_management_filekey, file_key_management_encryption_algorithm ● Well documented — https://mariadb.com/kb/en/mariadb/data-at-rest-encryption/ ● Tablespace/logs scrubbing: background process that regularly scans through the tables and upgrades the encryption keys ● --encrypt-tmp-files & --encrypt-binlog
  • 16. #PerconaLive @bytebot @RonaldBradford Encryption in MariaDB Server II [mysqld] plugin-load-add=file_key_management.so file-key-management file-key-management-filename = /home/mdb/keys.enc innodb-encrypt-tables innodb-encrypt-log innodb-encryption-threads=4 aria-encrypt-tables=1 # PAGE row format encrypt-tmp-disk-tables=1 # this is for Aria CREATE TABLE customer ( customer_id bigint not null primary key, customer_name varchar(80), customer_creditcard varchar(20)) ENGINE=InnoDB page_encryption=1 page_encryption_key=1;
  • 17. #PerconaLive @bytebot @RonaldBradford Encryption in MariaDB Server III ● Use the preset! - /etc/my.cnf.d/enable_encryption.preset ● MariaDB Enterprise has a plugin for Amazon Key Management Server (KMS) ○ The reality is you can just compile this for MariaDB Server ● mysqlbinlog has no way to read (i.e. decrypt) an encrypted binlog ● This does not work with MariaDB Galera Cluster yet (gcache is not encrypted yet), and also xtrabackup needs additional work (i.e. if you encrypt the redo log)
  • 18. #PerconaLive @bytebot @RonaldBradford Encryption in MySQL ● MySQL 5.7.11 introduces InnoDB tablespace encryption ● early-plugin-load=keyring_file.so in my.cnf ● Must use innodb_file_per_table ● Convert via ALTER TABLE table ENCRYPTION=‘Y’ ● Data is not encrypted in the redo/undo/binary logs ● Has external key management (Oracle Key Vault)
  • 19. #PerconaLive @bytebot @RonaldBradford Secure Accounts ● Privileges ● Passwords ● Password filesystem storage
  • 20. #PerconaLive @bytebot @RonaldBradford MySQL 5.6 improvements ● Password expiry - ALTER USER 'foo'@'localhost' PASSWORD EXPIRE; ● Password validation plugin - VALIDATE_PASSWORD_STRENGTH() ● mysql_config_editor - store authentication credentials in an encrypted login path file named .mylogin.cnf ○ http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html ● Random ‘root’ password on install ○ mysql_install_db —random-passwords stored in $HOME/.mysql_secret
  • 21. #PerconaLive @bytebot @RonaldBradford MySQL 5.7 improvements ● Improved password expiry — automatic password expiration available, so set default_password_lifetime in my.cnf ● You can also require password to be changed every n-days ○ ALTER USER ‘foo'@'localhost' PASSWORD EXPIRE INTERVAL n DAY; ● There is also account locking/unlocking now ○ ACCOUNT LOCK/ACCOUNT UNLOCK
  • 22. #PerconaLive @bytebot @RonaldBradford MariaDB Server passwords ● Password validation plugin (finally) exists now ○ https://mariadb.com/kb/en/mariadb/development/mariadb-internals-documentation/password-v alidation/ ● simple_password_check password validation plugin ○ can enforce a minimum password length and guarantee that a password contains at least a specified number of uppercase and lowercase letters, digits, and punctuation characters. ● cracklib_password_check password validation plugin ○ Allows passwords that are strong enough to pass CrackLib test. This is the same test that pam_cracklib.so does
  • 23. #PerconaLive @bytebot @RonaldBradford Authentication in MySQL / MariaDB Server ● Auth_socket - Authenticates against the Unix socket file, using so_peercred ● Sha256_password - default-authentication-plugin=sha256_password, passwords never exposed as cleartext when connecting; SSL or RSA auth ● Kerberos/GSSAPI/SSPI - User principals: <username>@<KERBEROS REALM> ● Active Directory (Enterprise only) ● Mysql_no_login ( MySQL 5.7 ) - prevents all client connections to an account that uses it
  • 24. #PerconaLive @bytebot @RonaldBradford PAM authentication Percona Server INSTALL PLUGIN auth_pam SONAME ‘auth_pam.so'; CREATE USER byte IDENTIFIED WITH auth_pam; In /etc/pam.d/mysqld: auth required pam_warn.so auth required pam_unix.so audit account required pam_unix.so audit MariaDB Server INSTALL SONAME ‘auth_pam’; CREATE USER byte IDENTIFIED via pam USING ‘mariadb’; Edit /etc/pam.d/mariadb: auth required pam_unix.so account required pam_unix.so Just use —pam-use-cleartext-plugin for MySQL to use mysql_cleartext_password instead of dialog plugin
  • 25. #PerconaLive @bytebot @RonaldBradford SQL standard Roles ● Bundles users together, with similar privileges - follows the SQL standard ● MariaDB Server 10.0 (10.1 adds that each user can have a DEFAULT ROLE) ● MySQL 8.0 DMR CREATE ROLE audit_bean_counters; GRANT SELECT ON accounts.* to audit_bean_counters; GRANT audit_bean_counters to ceo;
  • 26. #PerconaLive @bytebot @RonaldBradford Auditing MySQL - Logging account access - Logging SQL statements - Logging uncommon SQL patterns OS Logging account logins Logging sudo commands
  • 27. #PerconaLive @bytebot @RonaldBradford Auditing Implementation ● MariaDB Server ○ User filtering as an additional feature via audit API extensions ○ Query cache enabled? No table records ● Percona ○ Multiple output formats: OLD, NEW, JSON, CSV ○ Filter by user, SQL command type, database, ○ Auditing can be expensive, so asynchronous/performance/semisynchronous/synchronous modes for logging - e.g. log using memory buffers, drop messages if buffers are full, or log directly to file, flush and sync at events, etc. ● McAfee Audit plugin ○ Uses offsets ● MySQL Enterprise Audit Plugin (utility: mysqlauditgrep)
  • 28. #PerconaLive @bytebot @RonaldBradford Firewall Implementation MySQL - MySQL Enterprise Firewall MariaDB - MariaDB MaxScale dbfirewallfilter Percona - use MariaDB MaxScale / ProxySQL
  • 29. #PerconaLive @bytebot @RonaldBradford SQL Injection ● Always using bind variables ● Escape input content ● Restricted "least" privileges ○ Do not have GRANT ALL
  • 30. #PerconaLive @bytebot @RonaldBradford Database Server Access ● Restricting user access to your database server (login accounts) ○ Every physical person has a dedicated login ○ Separate OS & Database accounts ○ sudo restrictions (e.g. sudo su -) ■ Setup sudo group ■ Grant only specific commands to execute ○ Never share account details ● MFA
  • 31. #PerconaLive @bytebot @RonaldBradford Database Server Access ● Restricting traffic to your database server (open ports) ● Run a software firewall ○ iptables, ufw ● You should use OS software meant to benefit security ○ SELinux / Apparmor
  • 32. #PerconaLive @bytebot @RonaldBradford Database Server Access ● If you can login, and stop MySQL, you can bypass security ○ --skip-grant-tables ● If you can edit /etc/my.cnf you can set ○ --init-file=/path/to/my.sql ● If you use --init-file, can you modify content of file
  • 33. #PerconaLive @bytebot @RonaldBradford Database Server Access ● Restrict access to datadir ● Restrict access to view mysql.user table on filesystem ● Check out the examples of how to Hack MySQL http://effectivemysql.com/downloads/MySQLSecurityEssentialsPerconaLive2015.pdf
  • 34. #PerconaLive @bytebot @RonaldBradford Installation ● Using your Linux distribution… mostly gets you MariaDB when you ask for mysql-server ○ Except on Debian/Ubuntu ■ However, when you get mariadb-server, you get an authentication plugin — auth_socket for “automatic logins” ○ You are asked by debhelper to enter a password ● You can use the APT/YUM repositories from Oracle MySQL, Percona or MariaDB ● Don’t disable SELinux: system_u:system_r:mysqld_t:s0
  • 35. #PerconaLive @bytebot @RonaldBradford Update cadence A security patch is so named because it improves security and generally addresses a means of attack of your system ● OS ● Database ● Application Stack Why are you still running MySQL 5.5 or older?
  • 36. #PerconaLive @bytebot @RonaldBradford Deployment Security Who has control over running deployments? i.e. deploying code that manipulates your data or structure An application user SHOULD NOT have CREATE, ALTER, DROP privileges ● User to write data ● User to read data ● DBA to administer data (restricted to localhost)
  • 37. #PerconaLive @bytebot @RonaldBradford Use of Docker Containers Docker shows a disregard for security with 'root' OS logins by default ● MySQL server installation approach via exposed passwords ○ See Giuseppe's MySQL Docker operations tutorial ● Configuration is contained with container ○ Can you access the container via SSH ○ Can you copy and use container
  • 38. #PerconaLive @bytebot @RonaldBradford Reference Material https://www.mysql.com/why-mysql/presentations/mysql-security-best-practices/ ● MySQL Authentication and Password Policies ● MySQL Authorization and Privilege Management ● MySQL Encryption to secure sensitive data ● MySQL Enterprise Firewall to block database attacks such as an SQL Injection ● MySQL Enterprise Audit to implement policy
  • 39. #PerconaLive @bytebot @RonaldBradford MySQL Manual Security Practices http://dev.mysql.com/doc/refman/5.5/en/security.html http://dev.mysql.com/doc/refman/5.6/en/security.html http://dev.mysql.com/doc/refman/5.7/en/security.html
  • 40. #PerconaLive @bytebot @RonaldBradford Rate us! Thanks/Q&A ● Don’t forget to rate us in the app! ● Ronald Bradford: @RonaldBradford / http://effectivemysql.com ● Colin Charles: @bytebot / http://www.bytebot.net/blog/