SlideShare a Scribd company logo
© 2017 Percona1
Marcelo Altmann
MySQL: Melhores Práticas de Segurança
Senior Support Engineer
Dia da Liberdade do Software - Novo Hamburgo - RS
16/09/2017
© 2017 Percona2
Agenda
© 2017 Percona3
Agenda
▪ Intro
▪ Segurança no SO
▪ Segurança na aplicação
▪ Setup Inicial
▪ SSL
▪ ACL
▪ Passwords
▪ Connection Control
▪ TDE
▪Audit Plugin
▪Proxy / Firewall
© 2017 Percona4
Sobre Mim
© 2017 Percona5
Marcelo Altmann
▪Engenheiro de Suporte Senior @ percona
• MySQL DBA @ IEDR (CCTLD Irlanda)
▪Oracle ACE Associate
▪Certificaçoes
•Oracle Certified Professional, MySQL 5.6 Database Administrator
•Oracle Certified Professional, MySQL 5.6 Developer
•Oracle Certified Professional, MySQL 5 Database Administrator
•Oracle Certified Professional, MySQL 5 Developer
•Oracle Certified Associate, MySQL 5.0/5.1/5.5
▪blog.marceloaltmann.com
© 2017 Percona6
Intro
© 2017 Percona7
Intro
▪ Se eles querem os teus dados, eles vão ter. Tudo é uma questão de tempo,
recursos, dinheiro e empenho
▪ ELES - Hackers, Competidores, Ex-funcinários, NSA.
▪ Segurança tem um preço
•Dinheiro
•Performance
•Usabilidade
© 2017 Percona8
Intro - principios básicos
▪ Bloqueio por padrão
▪ Mínimo acesso possível
▪ Minimizar possibilidades
▪ Isolar
▪ Auditar
© 2017 Percona9
Segurança no SO
© 2017 Percona10
Segurança no SO
▪ Desinstalar serviços não utilizados
▪ Não rode compiladores
▪ Firewall - De preferencia externo
▪Desligar outbound para internet
▪Mater o sistema sempre atualizado
▪Adicionar KEY no SSH
▪Não habilitar root logar remoto
© 2017 Percona11
Segurança no SO
▪SELinux
•grep mysqld /var/log/audit/audit.log | grep denied
▪yum install policycoreutils-python
•grep mysqld /var/log/audit/audit.log | audit2allow
•grep mysqld /var/log/audit/audit.log | audit2why
© 2017 Percona12
Segurança no SO
▪Alterar datadir
•chcon -R -t mysqld_db_t /mysql/
•semanage fcontext -a -t mysqld_db_t "/mysql(/.*)?"
•restorecon -Rv /mysql/
▪Alterar porta
•semanage port -a -t mysqld_port_t -p tcp 3307
© 2017 Percona13
Segurança na aplicação
© 2017 Percona14
Segurança na aplicação
▪Validar todos inputs
▪Não estorne informações (recuperar senha / login)
▪Não conecte como root.
▪Cada app deve ter seu usuário
▪Criptografe informações sensitivas
•AES_ENCRYPT() e AES_DECRYPT()
•SHA1() e MD5()
© 2017 Percona15
Segurança na aplicação
▪SQL Injection
•$query = “SELECT * FROM users WHERE name = ‘“ . $name .”’”
•$name = marcelo’ OR ‘a’=’a
•SELECT * FROM users WHERE name = ‘marcelo’ OR ‘a’=’a’;
▪Prepared Statements
•$stm = $db->prepare(“SELECT * FROM users WHERE name = ?”)
•$stm->bind_param(“s”, $name)
•$stm->execute()
© 2017 Percona16
Setup inicial
© 2017 Percona17
Setup inicial
▪Conta anônima e test database
▪Conectar sem usuário/senha
▪Todos os privilégios no banco test
© 2017 Percona18
Setup inicial
mysql> CREATE TABLE tb1 ( ID INT AUTO_INCREMENT PRIMARY KEY,
a bigint);
Query OK, 0 rows affected (0.05 sec)
mysql> INSERT INTO tb1 VALUES (NULL, RAND(99999));
mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1;
mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1;
mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1;
mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1;
mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1;
© 2017 Percona19
Setup inicial
▪Conta anônima / uso de memória
mysql> use information_schema;
mysql> SELECT * FROM COLLATIONS a, COLLATIONS b, COLLATIONS
c, COLLATIONS d, COLLATIONS e, COLLATIONS f, COLLATIONS g;
Killed
> dmesg
[ 7392.378967] Out of memory: Kill process 30278 (mysql) score 702 or
sacrifice child
[ 7392.380223] Killed process 30278 (mysql) total-vm:1662332kB, anon-
rss:424576kB, file-rss:0kB, shmem-rss:0kB
© 2017 Percona20
Setup inicial
▪mysql_secure_installation
•DROP DATABASE test;
•DROP USER ''@'localhost';
•DROP USER ''@'HOSTNAME';
• SET PASSWORD FOR root@IP
© 2017 Percona21
SSL
© 2017 Percona22
SSL
▪Por padrão informações trafegam abertas
▪SSL criptografa os dados trafegados
▪Padrão 5.7
▪Gerar certificados
•5.7 - mysql_ssl_rsa_setup
•5.6 - openssl - https://goo.gl/5T7zqF
© 2017 Percona23
SSL
▪Instalação
[mysqld]
ssl-ca=ca.pem
ssl-cert=server-cert.pem
ssl-key=server-key.pem
▪Conectar
mysql --ssl-ca=ca.pem 
--ssl-cert=client-cert.pem 
--ssl-key=client-key.pem
© 2017 Percona24
SSL
▪Forcar usuário a usar SSL
CREATE USER 'marcelo'@'localhost' REQUIRE SSL;
▪Forçar todos os usuários a usarem uma conexão segura
•Socket / namedpipe
•SSL
[mysqld]
require_secure_transport
© 2017 Percona25
ACL
© 2017 Percona26
ACL
▪GRANT [privilégio] ON [banco].[tabela] TO [usuario]@[host]
•GRANT SELECT(campo) ON [banco].[tabela] TO [usuario]@[host]
▪Não adicione GRANT ALL ON *.*
▪Nao adicione % como host
▪Limite os usuários com WITH GRANT OPTION
▪Cuidado com SUPER e PROCESS
•SUPER - max_allowed_connections + 1
•PROCESS - SHOW PROCESSLIST
© 2017 Percona27
Passwords
© 2017 Percona28
Password
▪Crie passwords fortes
•Letras Maiusculas e Minusculas
•Mínimo de 8 characters
•Possuir dígitos
•Possuir acentos
• Não utilize “dictionary” passwords
© 2017 Percona29
Password
▪Password Validation Plugin 5.6+
[mysqld]
plugin-load-add=validate_password.so
validate-password=FORCE_PLUS_PERMANENT
▪validate_password_length (Default 8)
▪validate_password_mixed_case_count (Default 1)
▪validate_password_number_count (Default 1)
▪validate_password_special_char_count (Default 1)
▪validate_password_dictionary_file
▪validate_password_policy (Default 1)
© 2017 Percona30
Password
▪Mysql_native_password
▪Hash de 41 characters
▪Mesmo hash todos mysql
▪Pode ser hackeado via Rainbow table
▪Hash é enviado aberto pela rede
© 2017 Percona31
Password
▪Sha256_password (built-in 5.6+)
▪Hash é calculado com um salt
▪Mesmo password gera um hash diferente toda vez
▪Password é enviado ou por SSL ou criptografado(RSA)
© 2017 Percona32
Password
▪Configurar
cd /var/lib/mysql
openssl genrsa -out private_key.pem 2048
openssl rsa -in private_key.pem 
-pubout -out public_key.pem
chmod 400 private_key.pem;
chmod 444 public_key.pem
© 2017 Percona33
Password
▪Reiniciar MySQL
SHOW STATUS LIKE 'Rsa_public_key'G
*************************** 1. row ***************************
Variable_name: Rsa_public_key
Value: -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt3ioXKWcNMUfBmHrc4JC
WxXBhi/c+UXXRlV5lZcq2rr2fDIRPNhJy/ctOKvVSW99MF2Y92TUlxNN8WK9J96P
X1UjGM3zRuqpd9DH70yYIzte50HHQQ0KYSRdNIiGxXIT4t80bqC3dIZdlRfEiUk5
swJcREzIy96W5ewmhiaOnIh/WPAKKS+a9GgPj+Gb0BDRewLaROiRaZkq1d7yGbJ3
xxUvGHSDChOjF1a5ZOX+4ATBfhhJ8VBrCHG6aXZLuTTk46XAbylB9XDOG4+kKTcT
jbUUY41XcXonKAMthhJWoZU406Tahnntof6AO/ZF5BQXv34pv7eBNSLy50cF7cTw
VQIDAQAB
-----END PUBLIC KEY-----
© 2017 Percona34
Password
▪Criar usuario
CREATE USER 'sha256user'@'localhost' IDENTIFIED WITH
sha256_password;
SET old_passwords = 2;
SET PASSWORD FOR 'sha256user'@'localhost' =
PASSWORD('Sh@256Pa33');
© 2017 Percona35
Password
▪Forçar usuário a trocar password
•MySQL 5.6
ALTER USER 'myuser'@'localhost' PASSWORD EXPIRE;
•MySQL 5.7
[mysqld]
default_password_lifetime=180
CREATE USER 'myuser'@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY;
© 2017 Percona36
Password
mysql> SELECT 1;
ERROR 1820 (HY000): You must SET PASSWORD before executing
this statement
mysql> ALTER USER USER() IDENTIFIED BY 'new_password';
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
© 2017 Percona37
Connection Control
© 2017 Percona38
Connection Control
▪MySQL 5.7.17+
▪Adicionar delay na autenticação após X erros
▪Instalação
[mysqld]
plugin-load-add=connection_control.so
INSTALL PLUGIN CONNECTION_CONTROL SONAME 'connection_control.so';
INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME
'connection_control.so';
© 2017 Percona39
Connection Control
▪Connection_control_failed_connections_threshold
▪Connection_control_min_connection_delay
▪Connection_control_max_connection_delay
© 2017 Percona40
Connection Control
time mysql -u msandbox -pmsandbox2 -P 57182 --protocol=TCP
ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES)
real 0m0.014s
user 0m0.007s
sys 0m0.006s
time mysql -u msandbox -pmsandbox2 -P 57182 --protocol=TCP
ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES)
real 0m0.014s
user 0m0.004s
sys 0m0.009s
time mysql -u msandbox -pmsandbox2 -P 57182 --protocol=TCP
ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES)
real 0m1.513s
user 0m0.009s
sys 0m0.004s
© 2017 Percona41
TDE - Transparent Data Encryption
© 2017 Percona42
TDE
▪InnoDB MySQL 5.7
▪Criptografa os dados armazenados no disco
▪Cada tabela tem sua própria chave
▪Chave da tabela é armazenada no header do arquivo
▪Instalação
[mysqld]
early-plugin-load=keyring_file.so
keyring_file_data=/usr/local/mysql/mysql-keyring/keyring
© 2017 Percona43
TDE
▪Verificar se o plugin está instalado
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME LIKE 'keyring%';
+--------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+--------------+---------------+
| keyring_file | ACTIVE |
+--------------+---------------+
© 2017 Percona44
TDE
▪Criptografar tabelas
mysql> CREATE TABLE t1 (c1 INT) ENCRYPTION='Y';
mysql> ALTER TABLE t1 ENCRYPTION='Y';
© 2017 Percona45
Audit Plugin
© 2017 Percona46
Audit Plugin
▪MySQL Enterprise - Pago
▪Macfee - Grátis
▪Percona Server - Grátis
▪Loga atividades do banco de dados
▪Diferente do general log
▪Filtros por command / usuário / banco
© 2017 Percona47
Audit Plugin
▪Formatos - OLD
<AUDIT_RECORD
"NAME"="Query"
"RECORD"="2_2014-04-28T09:29:40"
"TIMESTAMP"="2014-04-28T09:29:40 UTC"
"COMMAND_CLASS"="install_plugin"
"CONNECTION_ID"="47"
"STATUS"="0"
"SQLTEXT"="INSTALL PLUGIN audit_log SONAME 'audit_log.so'"
"USER"="root[root] @ localhost []"
"HOST"="localhost"
"OS_USER"=""
"IP"="" />
© 2017 Percona48
Audit Plugin
▪Formatos - New
<AUDIT_RECORD>
<NAME>Quit</NAME>
<RECORD>10902_2014-04-28T11:02:54</RECORD>
<TIMESTAMP>2014-04-28T11:02:59 UTC</TIMESTAMP>
<CONNECTION_ID>36</CONNECTION_ID>
<STATUS>0</STATUS>
<USER></USER>
<PRIV_USER></PRIV_USER>
<OS_LOGIN></OS_LOGIN>
<PROXY_USER></PROXY_USER>
<HOST></HOST>
<IP></IP>
<DB></DB>
</AUDIT_RECORD>
© 2017 Percona49
Audit Plugin
▪Formatos - JSON
{
"audit_record":{
"name":"Query",
"record":"4707_2014-08-27T10:43:52",
"timestamp":"2014-08-27T10:44:19 UTC",
"command_class":"show_databases",
"connection_id":"37",
"status":0,
"sqltext":"show databases",
"user":"root[root] @ localhost []",
"host":"localhost",
"os_user":"",
"ip":""
}
}
© 2017 Percona50
Audit Plugin
▪Formatos - CSV
"Query","49284_2014-08-27T10:47:11","2014-08-
27T10:47:23 UTC","show_databases","37",0,"show
databases","root[root] @ localhost
[]","localhost","",""
© 2017 Percona51
Audit Plugin
▪Mysqlauditgrep - buscar informações nos logs
▪Data
▪Tipo de evento
▪Usuário
© 2017 Percona52
Firewall
© 2017 Percona53
Firewall
▪MySQL Enterprise Firewall - Pago
▪ProxySQL - Grátis
▪https://goo.gl/n4VZzH
© 2017 Percona54
Firewall
▪Bloquear queries - SQL INJECTION!
•Original query: SELECT Name FROM world.city WHERE Name = ‘?’
•SQL Injection: ? = São Paulo' OR ID > 0; --
•SELECT Name FROM world.city WHERE Name = 'São Paulo' OR ID > 0; --'
Admin> SELECT username, digest, digest_text FROM stats_mysql_query_digest WHERE digest_text LIKE '% OR ID %'
ORDER BY first_seen DESC LIMIT 1;
+-------------+--------------------+------------------------------------------------------+
| username | digest | digest_text |
+-------------+--------------------+------------------------------------------------------+
| application | 0xD8AF41BF32707ABD | SELECT Name FROM world.city WHERE Name = ? OR ID > ? |
+-------------+--------------------+------------------------------------------------------+
1 row in set (0.00 sec)
© 2017 Percona55
Firewall
Admin> INSERT INTO mysql_query_rules (rule_id, active, digest, error_msg, apply) VALUES
(4,1,'0xD8AF41BF32707ABD','Suspeita de SQL Injection',1);
Query OK, 1 row affected (0.00 sec)
[root@localhost ~]# mysql -u application -papp -e "SELECT Name FROM world.city WHERE Name
= 'São Paulo' OR ID > 0; --' "
ERROR 1148 (42000) at line 1: Suspeita de SQL Injection
© 2017 Percona56
Perguntas?
DATABASE PERFORMANCE
MATTERS
Database Performance MattersDatabase Performance MattersDatabase Performance MattersDatabase Performance MattersDatabase Performance Matters
Obrigado!

More Related Content

What's hot

Load Balancing with Nginx
Load Balancing with NginxLoad Balancing with Nginx
Load Balancing with Nginx
Marian Marinov
 
Nagios Conference 2013 - Eric Stanley - Whats New Core 4
Nagios Conference 2013 - Eric Stanley - Whats New Core 4Nagios Conference 2013 - Eric Stanley - Whats New Core 4
Nagios Conference 2013 - Eric Stanley - Whats New Core 4
Nagios
 
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and StatesSaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
SaltStack
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Harish S
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
Benjamin Cane
 
Nginx
NginxNginx
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
I Goo Lee
 
Nginx dhruba mandal
Nginx dhruba mandalNginx dhruba mandal
Nginx dhruba mandal
Dhrubaji Mandal ♛
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
Server Density
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - Slides
Severalnines
 
Amis puppet building blocks demo for Oracle Database and Weblogic cluster
Amis puppet building blocks demo for Oracle Database and Weblogic clusterAmis puppet building blocks demo for Oracle Database and Weblogic cluster
Amis puppet building blocks demo for Oracle Database and Weblogic cluster
Getting value from IoT, Integration and Data Analytics
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - Slides
Severalnines
 
Considerations for building your private cloud folsom update 041513
Considerations for building your private cloud   folsom update 041513Considerations for building your private cloud   folsom update 041513
Considerations for building your private cloud folsom update 041513OpenStack Foundation
 
Install elasticsearch, logstash and kibana
Install elasticsearch, logstash and kibana Install elasticsearch, logstash and kibana
Install elasticsearch, logstash and kibana
Chanaka Lasantha
 
Install dev stack
Install dev stackInstall dev stack
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
Acquia
 
Webinar slides: Top 9 Tips for building a stable MySQL Replication environment
Webinar slides: Top 9 Tips for building a stable MySQL Replication environmentWebinar slides: Top 9 Tips for building a stable MySQL Replication environment
Webinar slides: Top 9 Tips for building a stable MySQL Replication environment
Severalnines
 
Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!
Trygve Vea
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
SiteGround.com
 

What's hot (20)

Load Balancing with Nginx
Load Balancing with NginxLoad Balancing with Nginx
Load Balancing with Nginx
 
Nagios Conference 2013 - Eric Stanley - Whats New Core 4
Nagios Conference 2013 - Eric Stanley - Whats New Core 4Nagios Conference 2013 - Eric Stanley - Whats New Core 4
Nagios Conference 2013 - Eric Stanley - Whats New Core 4
 
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and StatesSaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Nginx
NginxNginx
Nginx
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
Nginx dhruba mandal
Nginx dhruba mandalNginx dhruba mandal
Nginx dhruba mandal
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - Slides
 
ReplacingSquidWithATS
ReplacingSquidWithATSReplacingSquidWithATS
ReplacingSquidWithATS
 
Amis puppet building blocks demo for Oracle Database and Weblogic cluster
Amis puppet building blocks demo for Oracle Database and Weblogic clusterAmis puppet building blocks demo for Oracle Database and Weblogic cluster
Amis puppet building blocks demo for Oracle Database and Weblogic cluster
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - Slides
 
Considerations for building your private cloud folsom update 041513
Considerations for building your private cloud   folsom update 041513Considerations for building your private cloud   folsom update 041513
Considerations for building your private cloud folsom update 041513
 
Install elasticsearch, logstash and kibana
Install elasticsearch, logstash and kibana Install elasticsearch, logstash and kibana
Install elasticsearch, logstash and kibana
 
Install dev stack
Install dev stackInstall dev stack
Install dev stack
 
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
Varnish and Drupal- Accelerating Website Performance and Flexibility with Var...
 
Webinar slides: Top 9 Tips for building a stable MySQL Replication environment
Webinar slides: Top 9 Tips for building a stable MySQL Replication environmentWebinar slides: Top 9 Tips for building a stable MySQL Replication environment
Webinar slides: Top 9 Tips for building a stable MySQL Replication environment
 
Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 

Similar to MysQL melhores práticas de seguranca

Guob - MySQL e LGPD
Guob - MySQL e LGPDGuob - MySQL e LGPD
Guob - MySQL e LGPD
Vinicius M Grippa
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
Vinicius M Grippa
 
ProxySQL para mysql
ProxySQL para mysqlProxySQL para mysql
ProxySQL para mysql
Marcelo Altmann
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL Security
Vinicius M Grippa
 
Configurações distribuídas com Spring Cloud Config
Configurações distribuídas com Spring Cloud ConfigConfigurações distribuídas com Spring Cloud Config
Configurações distribuídas com Spring Cloud Config
Emmanuel Neri
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
Derek Downey
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
Vinicius M Grippa
 
Securing your MySQL / MariaDB Server data
Securing your MySQL / MariaDB Server dataSecuring your MySQL / MariaDB Server data
Securing your MySQL / MariaDB Server data
Colin Charles
 
Converting you website to https
Converting you website to httpsConverting you website to https
Converting you website to https
Peter Salerno
 
Proxy SQL 2.0 with PXC
Proxy SQL 2.0 with PXCProxy SQL 2.0 with PXC
Proxy SQL 2.0 with PXC
Vinicius M Grippa
 
Curso de MySQL 5.7
Curso de MySQL 5.7Curso de MySQL 5.7
Curso de MySQL 5.7
Eduardo Legatti
 
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
Yashada Jadhav
 
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS InstanceOracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
Revelation Technologies
 
MySQL server security
MySQL server securityMySQL server security
MySQL server security
Damien Seguy
 
PostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
PostgresOpen 2013 A Comparison of PostgreSQL Encryption OptionsPostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
PostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
Faisal Akber
 
MySQL Best Practices - OTN
MySQL Best Practices - OTNMySQL Best Practices - OTN
MySQL Best Practices - OTNRonald Bradford
 
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
ScyllaDB
 
Rootconf admin101
Rootconf admin101Rootconf admin101
Rootconf admin101
Ligaya Turmelle
 
Build your own private openstack cloud
Build your own private openstack cloudBuild your own private openstack cloud
Build your own private openstack cloud
NUTC, imac
 
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyOracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Pythian
 

Similar to MysQL melhores práticas de seguranca (20)

Guob - MySQL e LGPD
Guob - MySQL e LGPDGuob - MySQL e LGPD
Guob - MySQL e LGPD
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
 
ProxySQL para mysql
ProxySQL para mysqlProxySQL para mysql
ProxySQL para mysql
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL Security
 
Configurações distribuídas com Spring Cloud Config
Configurações distribuídas com Spring Cloud ConfigConfigurações distribuídas com Spring Cloud Config
Configurações distribuídas com Spring Cloud Config
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
 
Securing your MySQL / MariaDB Server data
Securing your MySQL / MariaDB Server dataSecuring your MySQL / MariaDB Server data
Securing your MySQL / MariaDB Server data
 
Converting you website to https
Converting you website to httpsConverting you website to https
Converting you website to https
 
Proxy SQL 2.0 with PXC
Proxy SQL 2.0 with PXCProxy SQL 2.0 with PXC
Proxy SQL 2.0 with PXC
 
Curso de MySQL 5.7
Curso de MySQL 5.7Curso de MySQL 5.7
Curso de MySQL 5.7
 
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
 
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS InstanceOracle Database Cloud Service - Provisioning Your First DBaaS Instance
Oracle Database Cloud Service - Provisioning Your First DBaaS Instance
 
MySQL server security
MySQL server securityMySQL server security
MySQL server security
 
PostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
PostgresOpen 2013 A Comparison of PostgreSQL Encryption OptionsPostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
PostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
 
MySQL Best Practices - OTN
MySQL Best Practices - OTNMySQL Best Practices - OTN
MySQL Best Practices - OTN
 
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
 
Rootconf admin101
Rootconf admin101Rootconf admin101
Rootconf admin101
 
Build your own private openstack cloud
Build your own private openstack cloudBuild your own private openstack cloud
Build your own private openstack cloud
 
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyOracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
 

More from Marcelo Altmann

Backup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona XtrabackupBackup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona Xtrabackup
Marcelo Altmann
 
Percona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsPercona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and Improvements
Marcelo Altmann
 
Troubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveTroubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer Perspective
Marcelo Altmann
 
Backup para MySQL
Backup para MySQLBackup para MySQL
Backup para MySQL
Marcelo Altmann
 
GDB e Análise de Bugs
GDB e Análise de BugsGDB e Análise de Bugs
GDB e Análise de Bugs
Marcelo Altmann
 
A Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalkA Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalk
Marcelo Altmann
 
Optimizando MySQL
Optimizando MySQLOptimizando MySQL
Optimizando MySQL
Marcelo Altmann
 
MySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dadosMySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dados
Marcelo Altmann
 
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDRPercona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Marcelo Altmann
 

More from Marcelo Altmann (9)

Backup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona XtrabackupBackup Online no MySQL com Percona Xtrabackup
Backup Online no MySQL com Percona Xtrabackup
 
Percona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and ImprovementsPercona XtraBackup - New Features and Improvements
Percona XtraBackup - New Features and Improvements
 
Troubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveTroubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer Perspective
 
Backup para MySQL
Backup para MySQLBackup para MySQL
Backup para MySQL
 
GDB e Análise de Bugs
GDB e Análise de BugsGDB e Análise de Bugs
GDB e Análise de Bugs
 
A Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalkA Percona Support Engineer Walkthrough on pt-stalk
A Percona Support Engineer Walkthrough on pt-stalk
 
Optimizando MySQL
Optimizando MySQLOptimizando MySQL
Optimizando MySQL
 
MySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dadosMySQL - Melhores práticas de replicação de dados
MySQL - Melhores práticas de replicação de dados
 
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDRPercona Live London 2014 - MySQL Backup Strategy @ IEDR
Percona Live London 2014 - MySQL Backup Strategy @ IEDR
 

Recently uploaded

急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 

Recently uploaded (20)

急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 

MysQL melhores práticas de seguranca

  • 1. © 2017 Percona1 Marcelo Altmann MySQL: Melhores Práticas de Segurança Senior Support Engineer Dia da Liberdade do Software - Novo Hamburgo - RS 16/09/2017
  • 3. © 2017 Percona3 Agenda ▪ Intro ▪ Segurança no SO ▪ Segurança na aplicação ▪ Setup Inicial ▪ SSL ▪ ACL ▪ Passwords ▪ Connection Control ▪ TDE ▪Audit Plugin ▪Proxy / Firewall
  • 5. © 2017 Percona5 Marcelo Altmann ▪Engenheiro de Suporte Senior @ percona • MySQL DBA @ IEDR (CCTLD Irlanda) ▪Oracle ACE Associate ▪Certificaçoes •Oracle Certified Professional, MySQL 5.6 Database Administrator •Oracle Certified Professional, MySQL 5.6 Developer •Oracle Certified Professional, MySQL 5 Database Administrator •Oracle Certified Professional, MySQL 5 Developer •Oracle Certified Associate, MySQL 5.0/5.1/5.5 ▪blog.marceloaltmann.com
  • 7. © 2017 Percona7 Intro ▪ Se eles querem os teus dados, eles vão ter. Tudo é uma questão de tempo, recursos, dinheiro e empenho ▪ ELES - Hackers, Competidores, Ex-funcinários, NSA. ▪ Segurança tem um preço •Dinheiro •Performance •Usabilidade
  • 8. © 2017 Percona8 Intro - principios básicos ▪ Bloqueio por padrão ▪ Mínimo acesso possível ▪ Minimizar possibilidades ▪ Isolar ▪ Auditar
  • 10. © 2017 Percona10 Segurança no SO ▪ Desinstalar serviços não utilizados ▪ Não rode compiladores ▪ Firewall - De preferencia externo ▪Desligar outbound para internet ▪Mater o sistema sempre atualizado ▪Adicionar KEY no SSH ▪Não habilitar root logar remoto
  • 11. © 2017 Percona11 Segurança no SO ▪SELinux •grep mysqld /var/log/audit/audit.log | grep denied ▪yum install policycoreutils-python •grep mysqld /var/log/audit/audit.log | audit2allow •grep mysqld /var/log/audit/audit.log | audit2why
  • 12. © 2017 Percona12 Segurança no SO ▪Alterar datadir •chcon -R -t mysqld_db_t /mysql/ •semanage fcontext -a -t mysqld_db_t "/mysql(/.*)?" •restorecon -Rv /mysql/ ▪Alterar porta •semanage port -a -t mysqld_port_t -p tcp 3307
  • 14. © 2017 Percona14 Segurança na aplicação ▪Validar todos inputs ▪Não estorne informações (recuperar senha / login) ▪Não conecte como root. ▪Cada app deve ter seu usuário ▪Criptografe informações sensitivas •AES_ENCRYPT() e AES_DECRYPT() •SHA1() e MD5()
  • 15. © 2017 Percona15 Segurança na aplicação ▪SQL Injection •$query = “SELECT * FROM users WHERE name = ‘“ . $name .”’” •$name = marcelo’ OR ‘a’=’a •SELECT * FROM users WHERE name = ‘marcelo’ OR ‘a’=’a’; ▪Prepared Statements •$stm = $db->prepare(“SELECT * FROM users WHERE name = ?”) •$stm->bind_param(“s”, $name) •$stm->execute()
  • 17. © 2017 Percona17 Setup inicial ▪Conta anônima e test database ▪Conectar sem usuário/senha ▪Todos os privilégios no banco test
  • 18. © 2017 Percona18 Setup inicial mysql> CREATE TABLE tb1 ( ID INT AUTO_INCREMENT PRIMARY KEY, a bigint); Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO tb1 VALUES (NULL, RAND(99999)); mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1; mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1; mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1; mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1; mysql> INSERT INTO tb1 SELECT NULL, RAND(99999) FROM tb1;
  • 19. © 2017 Percona19 Setup inicial ▪Conta anônima / uso de memória mysql> use information_schema; mysql> SELECT * FROM COLLATIONS a, COLLATIONS b, COLLATIONS c, COLLATIONS d, COLLATIONS e, COLLATIONS f, COLLATIONS g; Killed > dmesg [ 7392.378967] Out of memory: Kill process 30278 (mysql) score 702 or sacrifice child [ 7392.380223] Killed process 30278 (mysql) total-vm:1662332kB, anon- rss:424576kB, file-rss:0kB, shmem-rss:0kB
  • 20. © 2017 Percona20 Setup inicial ▪mysql_secure_installation •DROP DATABASE test; •DROP USER ''@'localhost'; •DROP USER ''@'HOSTNAME'; • SET PASSWORD FOR root@IP
  • 22. © 2017 Percona22 SSL ▪Por padrão informações trafegam abertas ▪SSL criptografa os dados trafegados ▪Padrão 5.7 ▪Gerar certificados •5.7 - mysql_ssl_rsa_setup •5.6 - openssl - https://goo.gl/5T7zqF
  • 24. © 2017 Percona24 SSL ▪Forcar usuário a usar SSL CREATE USER 'marcelo'@'localhost' REQUIRE SSL; ▪Forçar todos os usuários a usarem uma conexão segura •Socket / namedpipe •SSL [mysqld] require_secure_transport
  • 26. © 2017 Percona26 ACL ▪GRANT [privilégio] ON [banco].[tabela] TO [usuario]@[host] •GRANT SELECT(campo) ON [banco].[tabela] TO [usuario]@[host] ▪Não adicione GRANT ALL ON *.* ▪Nao adicione % como host ▪Limite os usuários com WITH GRANT OPTION ▪Cuidado com SUPER e PROCESS •SUPER - max_allowed_connections + 1 •PROCESS - SHOW PROCESSLIST
  • 28. © 2017 Percona28 Password ▪Crie passwords fortes •Letras Maiusculas e Minusculas •Mínimo de 8 characters •Possuir dígitos •Possuir acentos • Não utilize “dictionary” passwords
  • 29. © 2017 Percona29 Password ▪Password Validation Plugin 5.6+ [mysqld] plugin-load-add=validate_password.so validate-password=FORCE_PLUS_PERMANENT ▪validate_password_length (Default 8) ▪validate_password_mixed_case_count (Default 1) ▪validate_password_number_count (Default 1) ▪validate_password_special_char_count (Default 1) ▪validate_password_dictionary_file ▪validate_password_policy (Default 1)
  • 30. © 2017 Percona30 Password ▪Mysql_native_password ▪Hash de 41 characters ▪Mesmo hash todos mysql ▪Pode ser hackeado via Rainbow table ▪Hash é enviado aberto pela rede
  • 31. © 2017 Percona31 Password ▪Sha256_password (built-in 5.6+) ▪Hash é calculado com um salt ▪Mesmo password gera um hash diferente toda vez ▪Password é enviado ou por SSL ou criptografado(RSA)
  • 32. © 2017 Percona32 Password ▪Configurar cd /var/lib/mysql openssl genrsa -out private_key.pem 2048 openssl rsa -in private_key.pem -pubout -out public_key.pem chmod 400 private_key.pem; chmod 444 public_key.pem
  • 33. © 2017 Percona33 Password ▪Reiniciar MySQL SHOW STATUS LIKE 'Rsa_public_key'G *************************** 1. row *************************** Variable_name: Rsa_public_key Value: -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt3ioXKWcNMUfBmHrc4JC WxXBhi/c+UXXRlV5lZcq2rr2fDIRPNhJy/ctOKvVSW99MF2Y92TUlxNN8WK9J96P X1UjGM3zRuqpd9DH70yYIzte50HHQQ0KYSRdNIiGxXIT4t80bqC3dIZdlRfEiUk5 swJcREzIy96W5ewmhiaOnIh/WPAKKS+a9GgPj+Gb0BDRewLaROiRaZkq1d7yGbJ3 xxUvGHSDChOjF1a5ZOX+4ATBfhhJ8VBrCHG6aXZLuTTk46XAbylB9XDOG4+kKTcT jbUUY41XcXonKAMthhJWoZU406Tahnntof6AO/ZF5BQXv34pv7eBNSLy50cF7cTw VQIDAQAB -----END PUBLIC KEY-----
  • 34. © 2017 Percona34 Password ▪Criar usuario CREATE USER 'sha256user'@'localhost' IDENTIFIED WITH sha256_password; SET old_passwords = 2; SET PASSWORD FOR 'sha256user'@'localhost' = PASSWORD('Sh@256Pa33');
  • 35. © 2017 Percona35 Password ▪Forçar usuário a trocar password •MySQL 5.6 ALTER USER 'myuser'@'localhost' PASSWORD EXPIRE; •MySQL 5.7 [mysqld] default_password_lifetime=180 CREATE USER 'myuser'@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY;
  • 36. © 2017 Percona36 Password mysql> SELECT 1; ERROR 1820 (HY000): You must SET PASSWORD before executing this statement mysql> ALTER USER USER() IDENTIFIED BY 'new_password'; Query OK, 0 rows affected (0.01 sec) mysql> SELECT 1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec)
  • 38. © 2017 Percona38 Connection Control ▪MySQL 5.7.17+ ▪Adicionar delay na autenticação após X erros ▪Instalação [mysqld] plugin-load-add=connection_control.so INSTALL PLUGIN CONNECTION_CONTROL SONAME 'connection_control.so'; INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME 'connection_control.so';
  • 39. © 2017 Percona39 Connection Control ▪Connection_control_failed_connections_threshold ▪Connection_control_min_connection_delay ▪Connection_control_max_connection_delay
  • 40. © 2017 Percona40 Connection Control time mysql -u msandbox -pmsandbox2 -P 57182 --protocol=TCP ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES) real 0m0.014s user 0m0.007s sys 0m0.006s time mysql -u msandbox -pmsandbox2 -P 57182 --protocol=TCP ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES) real 0m0.014s user 0m0.004s sys 0m0.009s time mysql -u msandbox -pmsandbox2 -P 57182 --protocol=TCP ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES) real 0m1.513s user 0m0.009s sys 0m0.004s
  • 41. © 2017 Percona41 TDE - Transparent Data Encryption
  • 42. © 2017 Percona42 TDE ▪InnoDB MySQL 5.7 ▪Criptografa os dados armazenados no disco ▪Cada tabela tem sua própria chave ▪Chave da tabela é armazenada no header do arquivo ▪Instalação [mysqld] early-plugin-load=keyring_file.so keyring_file_data=/usr/local/mysql/mysql-keyring/keyring
  • 43. © 2017 Percona43 TDE ▪Verificar se o plugin está instalado mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'keyring%'; +--------------+---------------+ | PLUGIN_NAME | PLUGIN_STATUS | +--------------+---------------+ | keyring_file | ACTIVE | +--------------+---------------+
  • 44. © 2017 Percona44 TDE ▪Criptografar tabelas mysql> CREATE TABLE t1 (c1 INT) ENCRYPTION='Y'; mysql> ALTER TABLE t1 ENCRYPTION='Y';
  • 46. © 2017 Percona46 Audit Plugin ▪MySQL Enterprise - Pago ▪Macfee - Grátis ▪Percona Server - Grátis ▪Loga atividades do banco de dados ▪Diferente do general log ▪Filtros por command / usuário / banco
  • 47. © 2017 Percona47 Audit Plugin ▪Formatos - OLD <AUDIT_RECORD "NAME"="Query" "RECORD"="2_2014-04-28T09:29:40" "TIMESTAMP"="2014-04-28T09:29:40 UTC" "COMMAND_CLASS"="install_plugin" "CONNECTION_ID"="47" "STATUS"="0" "SQLTEXT"="INSTALL PLUGIN audit_log SONAME 'audit_log.so'" "USER"="root[root] @ localhost []" "HOST"="localhost" "OS_USER"="" "IP"="" />
  • 48. © 2017 Percona48 Audit Plugin ▪Formatos - New <AUDIT_RECORD> <NAME>Quit</NAME> <RECORD>10902_2014-04-28T11:02:54</RECORD> <TIMESTAMP>2014-04-28T11:02:59 UTC</TIMESTAMP> <CONNECTION_ID>36</CONNECTION_ID> <STATUS>0</STATUS> <USER></USER> <PRIV_USER></PRIV_USER> <OS_LOGIN></OS_LOGIN> <PROXY_USER></PROXY_USER> <HOST></HOST> <IP></IP> <DB></DB> </AUDIT_RECORD>
  • 49. © 2017 Percona49 Audit Plugin ▪Formatos - JSON { "audit_record":{ "name":"Query", "record":"4707_2014-08-27T10:43:52", "timestamp":"2014-08-27T10:44:19 UTC", "command_class":"show_databases", "connection_id":"37", "status":0, "sqltext":"show databases", "user":"root[root] @ localhost []", "host":"localhost", "os_user":"", "ip":"" } }
  • 50. © 2017 Percona50 Audit Plugin ▪Formatos - CSV "Query","49284_2014-08-27T10:47:11","2014-08- 27T10:47:23 UTC","show_databases","37",0,"show databases","root[root] @ localhost []","localhost","",""
  • 51. © 2017 Percona51 Audit Plugin ▪Mysqlauditgrep - buscar informações nos logs ▪Data ▪Tipo de evento ▪Usuário
  • 53. © 2017 Percona53 Firewall ▪MySQL Enterprise Firewall - Pago ▪ProxySQL - Grátis ▪https://goo.gl/n4VZzH
  • 54. © 2017 Percona54 Firewall ▪Bloquear queries - SQL INJECTION! •Original query: SELECT Name FROM world.city WHERE Name = ‘?’ •SQL Injection: ? = São Paulo' OR ID > 0; -- •SELECT Name FROM world.city WHERE Name = 'São Paulo' OR ID > 0; --' Admin> SELECT username, digest, digest_text FROM stats_mysql_query_digest WHERE digest_text LIKE '% OR ID %' ORDER BY first_seen DESC LIMIT 1; +-------------+--------------------+------------------------------------------------------+ | username | digest | digest_text | +-------------+--------------------+------------------------------------------------------+ | application | 0xD8AF41BF32707ABD | SELECT Name FROM world.city WHERE Name = ? OR ID > ? | +-------------+--------------------+------------------------------------------------------+ 1 row in set (0.00 sec)
  • 55. © 2017 Percona55 Firewall Admin> INSERT INTO mysql_query_rules (rule_id, active, digest, error_msg, apply) VALUES (4,1,'0xD8AF41BF32707ABD','Suspeita de SQL Injection',1); Query OK, 1 row affected (0.00 sec) [root@localhost ~]# mysql -u application -papp -e "SELECT Name FROM world.city WHERE Name = 'São Paulo' OR ID > 0; --' " ERROR 1148 (42000) at line 1: Suspeita de SQL Injection
  • 57. DATABASE PERFORMANCE MATTERS Database Performance MattersDatabase Performance MattersDatabase Performance MattersDatabase Performance MattersDatabase Performance Matters Obrigado!