COSCUP
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 如何善用MySQL的安全機制打造固若金湯的系統 - 杜修文 {%hackmd tGp8pt49Q2aT5cD5TFyaIA %} > 請從這裡開始 ## 資料庫可能存在的弱點 - Poor Configurations - Set controls and change default setting - Over Privileegd Accounts - Privilege Policies - Weak Access Control - Dedicated Adminstrative Accounts - Weak Authentication - Strong Password Enforcement - Weak Auditing - Compliance & Audit Policies - 對於 DBA 的操作需要有紀錄 - Lack of Encryption - Data, Backup, Network Encryption - Proper Credential & Key management - Use mysql_config_editor, Key Vaults - Unsecured Backups - Encrypted Backups - No Monitoring - Security Monitoring, Users, Objects - Poorly Coded Applications - Database Firewall 在 5.6 之前的版本裝了就能直接用 使用者都用 default 大家隨便登 5.7 版後需要 initiate,會給一組一次性密碼讓你登入 ## 資料庫可能會面臨的攻擊 - SQL Injection - Prevention: DB Firewall, White List, Input Validation - Buffer Overflow - prevention: Frequently apply Database software updates, DB Firewall, White List, Input Validation - Brute Force Attack - Prevention: lock out accounts after a defined number of incorrtct attempts. - 通常人類密碼3~5次過不了就會嘗試忘記密碼功能,不太會爆破 - Network Eavesdropping - Prevention: Reqire SSL/TLS for all Connections and Transport - 乖乖加密加鹽 - Malware - Prevention: Tight Access Conrols, Limited Network IP access, Change default settings, Encryption :::warning :warning: MySQL 不太會出補丁,通常只出 Update,裡面通常是修復 bug 與漏洞 ::: ## 資料庫安控操作 - Account / Privilege Management - Key management ( store / rotate / backup ) - Data classification & prioritization - Patch and update database - 在 5.7 前,每個小版本中不太會有什麼新功能 - 沒事多更新 - Monitoring / detect security breach - Auditing - 留下審核/稽核紀錄 - 主動通知異常 - Remedy security breach ## 資料庫安控的方方面面 - 注意傳 DB 的時候中間的網路可不可信任 DB 有沒有好好加密 ## MYSQL 認證 - Bulit in Authentication - `user` table stores users and encrypted passwords - X.509 - Server authenticates client certifcates - MySQL Native , SHA 256 Password plugin - Native uses SHA1 or plugin with SHA-256 hashing and per user-salting for user account passowrds - MySQL Enterprise Authentication - Microsoft Active Directory - Linux PAMs ( Pluggable Authentication Modules ) - Support LDAP and more - Custom Authentication ## MySQL 的增強:Password Policies - Enforce Strong Passowrd Policies - Password Hashing - Password Expiration - Password Validation Plugin - validate_password_policy - validate_password_dictionary_file - 密碼字典, 若substring出現在裡面(不分大小寫)則拒絕此密碼 - valicate_password_length - validate_password_special_char_count - validate_password_mixed_case_count - Authentication Plugin - Inherits the password policies from the component - LDAP, Windows Active Directory, etc. - Disable accounts when not in use - Account lockout (5.7+) - ~~直接請怪怪的人吃水桶~~ - MySQL_native_password relies on SHA1 algorithm (peformance and security) - Password History (8.0 NF) ## MYSQL企業版的 **認證** - - PAM (Pluggable ...?) - Standard Interface - LDAP - Unix / Linux - Proxy Users - Windows - Windows Active Directory - Windows Native Services ## 應用和憑證-最佳實行原則 - Applications - 儘量不要共用帳戶和密碼 - (總之這邊是上面那行的英文版) - 要支援密碼輪換 - Do not require all passwords to be changes in synchronization - Facilitates better troubleshooting and root-cause analysis - 可追溯密碼變更(8.0) - 密碼的變更應該以安全且直接的方式進行 - Not embedded in your code - Can be changed without redeploying an application - Should never be stored in version control and must differ between environments. - Applications should get credentials using a secure configuration methodology ## 資料庫安控的方方面面 - 授權 ## MySQL 權限管理 - 持續的評估 - 稽核和評估活動 - Who -- does activity match expectation - What -- is this it limited as expected - When -- acts often are at odd / off peak times - Where -- Connections should be from expected hosts - Role (8.0 NF) - MySQL 能簡單的控制權限和設全限制 - set account resource limits (max_user_connections, max_connection_per_hour, max_updates_per_hour) - 例: ```MySQL= CREATE USER 'francis'@'localhost' IDENTIFIED BY 'frank' WITH MAX_OUERIES_PER_HOUR 20 MAX_UPDATES_PER_HOUR 10 MAX_CONNECTIONS_PER_HOURS MAX_USER_CONNECTION 2; ``` ### 舉例 - `MAX_CONNECTIONS_PER_HOURS` 這個帳號同時可以有 10 條連線,若有 11 條以上則有問題,MySQL 可以直接做這個設定 ## MySQL 授權 - Administrative Privileges - 限制root只能從特定host連進來 - Database Privileges - Session Limits and Object Privileges - Fine grained controls over user privileges - Creating altering and deleteing datbases - Creating altering and deleting tables - Execute INSERT, SELECT, UPADATE, DELETE queries - Create, execute, or delete stored procedures and??? - Create ???? ## MySQL 加密 - SSL / TLS Encryption - Betewwn MySQL clients and Server - Replication: between Master & Slave - Data Encryption - AES Encrypt/Decrypt - MySQL Enterprise TDE - Transparent Data Encryption - Key Management(MKIP) - MySQL Enterprise Encryption - ??? - ??? - ??? - MySQL Enterprise Backup - ? > 因為時間關係我們不談了 ## 保護應用端到資料庫的傳輸 - In my.cnf of the database - Create User R??? - - Connecting via SSL ```shell $ mysql --ssl-ca ``` ## 因為 Transparent Data Encryption MySQL 加了哪些功能? - SQL - New otion in CREATE TABLE - ENCRYPTION="Y" - New SQL: `Alter... ?????` - Header跟data row分開加密 - Plugin Infrastructure - ????? - Keyring plugin - ## MySQL 企業備份 - Online ...? - - ## MySQL Repository makes update easier - Linux binary - Yum > sudo rpm .... - apt - SUSE - Windows installer - Linux ## MySQL Enterprise Monitor > 總之如果有 slide 就看 slide 吧 ## 聊天區 > 獨立一下好了 > 實務上,常更新真的會gg qaq > 不更新要祈禱不會被入侵,更新要祈禱不會死掉,所以不少機器就乾脆不更新,省事情 > 不更新應該都是比較常見的做法吧 > 要更新真的會有很多需要注意的事情 > 總之看看 patch note 再說吧 補洞就升阿 > 他跳好快啊啊啊啊啊啊啊啊啊 > 等他給slide好了 G_G > 啊啊啊啊啊啊 > 他會給slide嗎? > :confused: 可...能 吧? > 這是在考驗大家的視讀能力與手速 > 沒動力繼續打了.. > 好吧 大家慢慢等閉幕吧(X > 接下來聽 Key note 打廣告了(X > 大家可以去吃東西喝飲料了(X ###### tags: `COSCUP2018` `misc`

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully