Databázová bezpečnost Ing. Roman Danel, Ph.D. Institut ekonomiky a systémů řízení Hornicko–geologická fakulta
Bezpečnostní problémy v SŘBD Fyzická integrita – odolnost vůči výpadkům Logická integrita – struktura Elementární integrita – korektní data Auditabilita – sledování kdo a jak něco zaznamenal Autentizace Dostupnost
Hrozby databázové bezpečnosti Zajištění utajení Zajištění integrity Dostupnost systému
Přehled zabezpečení – Availability – Authenticity – Integrity – Confidentiality
Availability - dostupnost Dostupnost dat je časově neomezena Data mají být přístupná pouze uživatelům mající oprávnění k přístupu Trasování, kdo přistupuje na data
Authenticity - pravost Need to ensure that the data has been edited by an authorized source Need to confirm that users accessing the system are who they say they are Need to verify that all report requests are from authorized users Need to verify that any outbound data is going to the expected receiver
Integrity - integrita Need to verify that any external data has the correct formatting and other metadata Need to verify that all input data is accurate and verifiable Need to ensure that data is following the correct work flow rules for your institution/corporation Need to be able to report on all data changes and who authored them to ensure compliance with corporate rules and privacy laws.
Confidentiality - důvěrnost Need to ensure that confidential data is only available to correct people Need to ensure that entire database is security from external and internal system breaches Need to provide for reporting on who has accessed what data and what they have done with it Mission critical and Legal sensitive data must be highly security at the potential risk of lost business and litigation
Hrozby Vnitřní ztráta dat Externí hacking Zabezpečení dat v případě ukradení hardware Neschválený Administrátorský přístup
Built-in protection – Password Controls – Data access based on roles and profiles – IP restrictions for off site access – Auditing capabilities of who has run what reports – Security logging
SQL injection When a user enters a valid username, such as ‘Mary’ and a password of ‘qwerty’, the SQL query becomes: SELECT Count(*) FROM UsersTable WHERE UserName=‘Mary’ AND Password=‘qwerty’;
SQL injection if a user enters the following as a username: ‘OR 1=1 -- the SQL query becomes: SELECT Count(*) FROM UsersTable WHERE UserName=‘‘ OR 1=1 - -’ AND Password=‘‘;
SQL injection SELECT * FROM uzivatele WHERE uzivatel_id = 'x';DROP TABLE uzivatele; SELECT '1'
Útok typu DOS (Denial of Access) x' AND BENCHMARK( ,BENCHMARK(999999,B ENCHMARK(999999,MD5(NOW()))))=0 OR '1'='1
Zabezpečení proti SQL injection $uzivatel_id = intval($_GET['id']); $query = $sql->prepare("SELECT * FROM uzivatele where name = „. $sql->quote($uzivatel_id));
SQL injection wiedzy/publikacje/sql-injection wiedzy/publikacje/sql-injection
Zálohování Backup Restore
Restore – obnova databáze
Recovery Model
Recovery Model (Microsoft) Simple Full Bulk-logged - reduces log space usage by using minimal logging for most bulk operations (bcp, insert into...)
Db systémy Fault-tolerant Disaster-tolerant
HADR High Availability & Disaster Recovery Uptime – downtime MTBF - Mean Time Between Failure MTTR - Mean Time to Repair
Technologie pro fault-tolerant Log-shipping – Na úrovni backup-restore, Job Agent Replikacja – Na úrovni tabulek – Publisher - Subscriber Mirroring – Na úrovni databáze – Principal-Mirror i opcjonalnie Whitness (Arbiter) Always-on – Řešení v kategorii Enterprise, většinou clustering
Log Shipping Source:
Replication
Mirroring
Always-on
Always-on Availability Group