Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Estratégias para construir um ambiente MySQL seguro e gerenciável
Airton Lastori [email protected] agosto-2015
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
DBA ou SysAdmin Desenvolvedor
Oracle Confidential – Internal/Restricted/Highly Restricted 3
Gerencial
Quem?
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
43% das empresas passaram por uma violação de dados no ano passado. Fonte: Ponemon Institute, 2014
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Administrar bem um banco de dados não é trivial...
1. Planejamento, Análise & Implementação
2. Operação & Manutenção Disponibilidade e Performance
Monitoramento e Tuning
Backup e Recovery
Governança e Conformidade (compliance) Processos e controle
Segurança e Autorização - pode envolver interação com áreas de Segurança e Negócios
Patches, Upgrades e Migração
Integridade dos dados
Oracle Confidential – Internal/Restricted/Highly Restricted 6
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Desconhecimento
Falta de processos Desorganização e esquecimento
Má fé Roubo e Fraudes
Quebra de confidencialidade e privacidade
Falhas sistêmicas bugs no software
falhas físicas no hardware
etc.
Oracle Confidential – Internal/Restricted/Highly Restricted 7
...coisas erradas podem acontecer.
Ambos podem comprometer a disponibilidade, performance,
integridade e segurança da informação!
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Mais conhecimento
Processos definidos Baseados em boas práticas
Apoiados por ferramentas
Automação, DevOps
Falhas sistêmicas software atualizado, testado e
homologado
redundâncias na infra-estrutura
Oracle Confidential – Internal/Restricted/Highly Restricted 8
Como minimizar riscos?
Esteja preparado!
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Mais conhecimento
Processos definidos Baseados em boas práticas
Apoiados por ferramentas
Automação, DevOps
Falhas sistêmicas software atualizado, testado e
homologado
redundâncias na infra-estrutura
Oracle Confidential – Internal/Restricted/Highly Restricted 9
Como minimizar riscos?
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL for Beginners Ed 3
MySQL for Database Administrators Ed 3.1
MySQL Performance Tuning
MySQL High Availability
MySQL Cluster
MySQL DBA
Introduction to MySQL 5.5
MySQL Developers Techniques
MySQL for Beginners Ed 3
MySQL and PHP Developing Dynamic Web
Applications
MySQL for Developers Ed 2
MySQL Advanced Stored Procedures
MySQLDeveloper
education.oracle.com/mysql
Opcional
Necessário
Mais conhecimento para a equipe
Oracle Certified Professional, MySQL 5.6
DBA
Certificações
Oracle Certified Professional, MySQL 5.6
Developer
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 11
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
@MySQLBR meetup.com/MySQL-BR facebook.com/MySQLBR
pt.planet.mysql.com
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Ajuda externa: engenheiros MySQL como parte do seu time
• Acesso direto 24 x 7 x 365
• Número ilimitado de incidentes
• Base de conhecimento, Hot fixes, Patches
• Tradução para o Português
• Suporte Consultivo
• Maior time de especialistas MySQL no mundo
• Suportados pelos próprios Desenvolvedores do MySQL
Oracle Premier Support para MySQL
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
• Troubleshooting remoto
• Revisões: Replicação, Particionamento, Schema, Queries
• Performance Tuning
• Revisão de Código gerado pelo cliente: Client APIs, User Defined Functions, Server Extensions, Stored Routines (Triggers, Procedures, Functions)
• Suporte remoto em instalação e upgrades
https://www.mysql.com/support/consultative.html
Suporte Consultivo MySQL Portfolio de serviços
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Mais conhecimento
Processos definidos Baseados em boas práticas
Apoiados por ferramentas
Automação, DevOps
Falhas sistêmicas software atualizado, testado e
homologado
redundâncias na infra-estrutura
Oracle Confidential – Internal/Restricted/Highly Restricted 18
Como minimizar riscos?
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Quais são as boas práticas?
1. Gerais para infraestrutura como um todo: Governança, ITIL, regulamentações
para Bancos de Dados: experiência reaproveitada de outros SGBDs relacionais
segurança: IT baselines protection, OWASP, NIST...
2. Específicas para MySQL Treinamento , Base de Conhecimento, Suporte Consultivo, Consultoria...
OWASP, NIST, Manual, Livros, Eventos...
Google, Blogs, Fóruns, Youtube... com cuidado!
Oracle Confidential – Internal/Restricted/Highly Restricted 19
Muito complicado e trabalhoso? Calma! Vamos ver alguns atalhos...
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Mais conhecimento
Processos definidos Baseados em boas práticas
Apoiados por ferramentas
Automação, DevOps
Falhas sistêmicas software atualizado, testado e
homologado
redundâncias na infra-estrutura
Oracle Confidential – Internal/Restricted/Highly Restricted 20
Como minimizar riscos?
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Workbench 6.1 Dashboards: Performance & Status
Analyze hotspots, costly SQL statements, wait times, locks, InnoDB stats, and more
Network, Server, InnoDB
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 24
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Advisors implementam e automatizam boas práticas
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Advisors de Segurança
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
46% das empresas que passaram por uma violação, levaram mais que 4 meses para detectar o problema. Fonte: OnePool and LogRhythm, 2015
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise Secutiry
• External Authentication Plugins
• Delega autenticação para diretório de usuários, como AD, LDAP
• Linux e Windows
MySQL Enterprise Firewall
• Bloqueio online de ameaças
• Transparente para Aplicação
• Alertas & Logs
Oracle Confidential – Internal/Restricted/Highly Restricted 31
MySQL Enterprise Audit
• Implementa logs de auditoria com um único comando de instalação
• Flexibilidade na configuração
• Aderente às principais normas de regulação
MySQL Enterprise Encryption
• Funções do OpenSSL via SQL
• Gerenciamento de Certificados
• Criptografia Assimétrica
Plugins Comerciais para Segurança
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Authenticate
CREATE USER win_joe
IDENTIFIED WITH authentication_windows
AS ‘joe';
LDAP/AD PAM / Windows
Auth
Usuário/senha definidos no diretório
Privilégios definidos no MySQL e mapeados para usuários/grupos do diretório
Enterprise Security com External Authentication
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise Audit
33
2. Usuário conecta e executa query
1. DBA habilita Audit plugin
3. Log de conexões e queries
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 35
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
• Construção automática de Whitelists
• Detecção ou bloqueio online
• Alertas & Logs
• Transparente para Aplicação
• Alta performance & Escalável
Enterprise Firewall
Select *.* from employee where id=22
Select *.* from employee where id=22 or 1=1 Block & Log ✖
Allow & Log ✔
White List Applications
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | 39
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Novos Advisors para o MySQL Enterprise Firewall
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise Encryption
• MySQL encryption libraries – Symmetric encryption AES256
– Public-key / asymmetric cryptography
• Key management – Public & private keys
– Key exchange methods: RSA, DSA, DH
• Sign & verify data – Cryptographic hashing: digital signing, verification, & validation
Criptografia simétrica ou assimétrica baseada em chave pública/privada
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Exemplo com MySQL Enterprise Encryption
43
Encryption Public Key
Decryption Private Key
Encrypted Data
Sensitive Data Sensitive Data
Applications Applications
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal 48
MySQL Database Hardening
User Management
• Remove Extra Accounts
• Grant Minimal Privileges
• Audit users and privileges
Configuration
• Firewall
• Auditing and Logging
• Limit Network Access
• Monitor changes
Installation
• Mysql_secure_installation
• Keep MySQL up to date
• MySQL Installer for Windows
• Yum/Apt Repository
Backups
• Monitor Backups
• Encrypt Backups
Encryption
• SSL/TLS for Secure Connections
• Data Encryption (AES, RSA)
Passwords
• Strong Password Policy
• Hashing, Expiration
• Password Validation Plugin
www.mysql.com/why-mysql/presentations/mysql-security-best-practices
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Utilities
• Automatiza tarefas comuns de DevOps – Replication: provisionamento, teste, monitoramento e failover
– Comparação de Databases: verificação de consistência
– Manutenção: users, connections, tables
– Auditoria
• Scripts em Python – Pacote standalone ou via MySQL Workbench
– Extensíveis para incluir scripts customizados (usa Python library)
• Novo: Integração Openstack Nova, “Server providers” https://oracleus.activeevents.com/2014/connect/fileDownload/session/CF4F217F7E733EF6066ED14D5CB7371C/CON5636_Kindahl-MySQLFabricElasticityOOW2014.pdf
Útil para DevOps e gerenciamento automatizado do MySQL
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
HA group
MySQL Fabric
• Alta disponibilidade: – Monitoramento do Server com failover automático
e transparente para aplicação
• Provisionamento usando OpenStack
• Conectores devem ser “Fabric-aware”: – Java, Python, .NET, C, PHP (alguns alfa)
– Sem Proxy, sem latência extra e SPoF
Gerencie farms MySQL com suporte a HA e Sharding
Connector
Application
SQL
Read-slaves Read-slaves
HA group
MySQL Fabric
• (Opcional) Escalabilidade de escrita com sharding
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Whitepaper: MySQL Fabric September 2014 mysql.com/why-mysql/white-papers
Tutorial disponível no white paper
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL no Docker Introdução ao conceito de MySQL rodando em Linux Containers
• [blog post] http://www.alastori.com.br/2015/03/mysql-no-docker.html
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Mais conhecimento
Processos definidos Baseados em boas práticas
Apoiados por ferramentas
Automação, DevOps
Falhas sistêmicas software atualizado, testado e
homologado
redundâncias na infra-estrutura
Oracle Confidential – Internal/Restricted/Highly Restricted 54
Como minimizar riscos?
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Qual versão do MySQL Database você usa? SELECT @@version;
+---------------------------------------+
| @@version |
+---------------------------------------+
| 5.6.25-enterprise-commercial-advanced |
+---------------------------------------+
1 row in set (0,00 sec)
Patches aproximadamente a cada 2 meses. Mantenha o MySQL atualizado!
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
No Windows: MySQL Installer Next, Next... Finish!
dev.mysql.com/downloads/windows/installer
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
No Linux: repositórios YUM e APT para MySQL
• Suporta as distribuições Enterprise Linux – RedHat Enterprise/Oracle Linux
– Fedora
– Debian/Ubuntu
• Inclui os pacotes mais atuais – MySQL Database
– MySQL Workbench
– MySQL Connectors
– MySQL Utilities
Maneira simples e conveniente de instalar e atualizar produtos MySQL
Mais de 50% dos downloads para Fedora/RedHat já são
feitos do repositório
www.alastori.com.br/2014/05/tutorial-de-instalacao-do-mysql-56-e.html
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
…ou manualmente via binários pré-compilados
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Download: MySQL 5.7 Release Candidate disponível para testes
dev.mysql.com/downloads/mysql
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL 5.7: Melhorias de Segurança
• AES 256 Encryption e SSL habilitado por default – usa certificados existentes ou gera automaticamente caso necessário
– novo utilitátio: mysql_ssl_rsa_setup
• Definição de roles através para todos plugins de autenticação (proxy user)
• Políticas de expiração de senhas globais ou por usuário
• Facilidade na inicialização segura do servidor – mysqld --initialize
• Instalação segura por padrão – Senha aleatória na instalação
– Sem conta anônima, schemas de testes
• Suporte nativo ao systemd com detecção automática e envio de logs ao syslog
60
RC
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Participe com seu Feedback
bugs.mysql.com
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Código-fonte no GitHub
bugs.mysql.com
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Saiba mais... Detalhes sobre “O que há de novo no MySQL 5.7 (até agora)”
• [blog post] http://www.alastori.com.br/2014/11/o-que-ha-de-novo-no-mysql-5.html
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise é testado e homologado pela Oracle
• Oracle Enterprise Manager for MySQL
• Oracle Linux (w/DRBD stack)
• Oracle VM
• Oracle Solaris
• Oracle Solaris Clustering
• Oracle Clusterware
• Oracle Audit Vault and Database Firewall
• Oracle Secure Backup
• Oracle Fusion Middleware
• Oracle GoldenGate
• My Oracle Support
MySQL Enterprise integra-se no seu ambiente Oracle
64
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Fator humano Mais conhecimento
Processos definidos Baseados em boas práticas
Apoiados por ferramentas
Automação, DevOps
Falhas sistêmicas software atualizado, testado e
homologado
redundâncias na infra-estrutura
Oracle Confidential – Internal/Restricted/Highly Restricted 65
Como minimizar riscos?
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Whitepaper: MySQL: A Guide to High Availability January 2015 mysql.com/why-mysql/white-papers
Guia para HA disponível no white paper
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL HA & Scaling Solutions MySQL
Replication MySQL Fabric
Oracle VM Template
Oracle Clusterware
Solaris Cluster
Windows Cluster
DRBD MySQL Cluster
App Auto-Failover ✖ ✔ ✔ ✔ ✔ ✔ ✔ ✔
Data Layer Auto-Failover ✖ ✔ ✔ ✔ ✔ ✔ ✔ ✔
Zero Data Loss MySQL 5.7 MySQL 5.7 ✔ ✔ ✔ ✔ ✔ ✔
Platform Support All All Linux Linux Solaris Windows Linux All
Clustering Mode Master +
Slaves Master +
Slaves Active/Pas
sive Active/Passi
ve Active/P
assive Active/Pas
sive Active/P
assive Multi-Master
Failover Time N/A Secs Secs + Secs + Secs + Secs + Secs + < 1 Sec
Scale-out Reads ✔ ✖ ✖ ✖ ✖ ✖ ✔
Cross-shard operations N/A ✖ N/A N/A N/A N/A N/A ✔
Transparent routing ✖ For HA ✔ ✔ ✔ ✔ ✔ ✔
Shared Nothing ✔ ✔ ✖ ✖ ✖ ✖ ✔ ✔
Storage Engine InnoDB+ InnoDB+ InnoDB+ InnoDB+ InnoDB+ InnoDB+ InnoDB+ NDB
Single Vendor Support ✔ ✔ ✔ ✔ ✔ ✖ ✔ ✔
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Ambiente profissional com o MySQL Enterprise Edition Suporte + Backup + Monitor + Workbench + Plug-ins
Escalabilidade Segurança
Firewall Auditoria
Criptografia
Oracle Enterprise Manager for MySQL
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Sumário
• Há fatores humanos e sistêmicos geradores de riscos para disponibilidade, performance, integridade e segurança da informação.
• Diminua riscos com mais conhecimento, processos bem definidos, baseados em boas práticas e automatizados com ferramentas. Mantenha o MySQL atualizado.
• O MySQL Enterprise Edition é uma opção para ajudar a implementar boas práticas automatizadas e estender o conhecimento da equipe através do suporte consultivo.
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Obrigado!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Perguntas?
Estratégias para construir um ambiente MySQL seguro e gerenciável Contato: [email protected] twitter.com/mysqlbr facebook.com/mysqlbr
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
MySQL Enterprise Edition Contatos comerciais
Marcos Trujillo
Enterprise Sales, Oracle
Alison Rabelo
OEM/ISV Sales, Oracle