SlideShare a Scribd company logo
Security & Auditing
on SQL Server 2008 R2
Antonios Chatzipavlis
Software Architect Evangelist, IT Consultant
MCT, MCITP, MCPD, MCSD, MCDBA, MCSA, MCTS, MCAD, MCP, OCA
MVP on SQL SERVER
2
• Overview of SQL Server Security
• Protecting the Server Scope
• Protecting the Database Scope
• Managing Keys and Certificates
• Auditing Security
Objectives
3
Overview of SQL Server Security
Security & Auditing on SQL Server 2008 R2
4
• SQL Server Security Framework
• What Are Principals?
• What Are Securables?
• SQL Server Permissions
Overview of SQL Server Security
5
Overview of SQL Server Security
6
SQL Server Security Framework
7
What Are Principals?
Server Role
SQL Server Login
Windows Group
Domain User Account
Local User Account
SQL Server
Database
Windows
Securables
Permissions
Principals
User
Database Role
Application Role
8
What Are Securables?
Server Role
SQL Server Login
Windows Group
Domain User Account
Local User Account
SQL Server
Database
Windows
Files
Registry Keys
Server
Schema
Database
Securables
Permissions
Principals
User
Database Role
Application Role
9
• Server-Level Permissions
• Logins
• Credentials
• Server-Level Roles
• Database-Level Permissions
• Users
• Schemas
• Database Level Roles
SQL Server Permissions
10
Protecting the Server Scope
Security & Auditing on SQL Server 2008 R2
12
• What Are SQL Server Authentication Methods?
• Password Policies
• Server-Level Roles
• Managing SQL Server Logins
• Server-Scope Permissions
Protecting the Server Scope
13
What Are SQL Server Authentication
Methods?
Windows
Authentication
Mixed SQL and Windows
Authentication
14
Password Policies
Group Policy
Object (GPO)
Pa$$w0rd
SQL Server Can Leverage Windows Server 2003/2008 Password Policy
Mechanism
SQL Server Can Manage:
• Password Complexity
• Password Expiration
• Policy Enforcement
15
Server-Level Roles
Role Description
sysadmin Perform any activity
dbcreator Create and alter databases
diskadmin Manage disk files
serveradmin Configure server-wide settings
securityadmin Manage and audit server logins
processadmin Manage SQL Server processes
bulkadmin Run the BULK INSERT statement
setupadmin Configure replication and linked servers
16
Managing SQL Server Logins
CREATE LOGIN [SERVERXSalesDBUsers]
FROM WINDOWS
WITH DEFAULT_DATABASE = AdventureWorks2008
CREATE LOGIN Alice
WITH Password = 'Pa$$w0rd'
CREATE LOGIN login_name
{ WITH SQL_login_options
| FROM WINDOWS [ WITH
windows_login_options ] }
19
Server-Scope Permissions
Server permissions
Server-scope securable permissions
USE master
GRANT ALTER ANY DATABASE
TO [AdventureWorks2008Holly]
USE master
GRANT ALTER
ON LOGIN :: AWWebApp
TO [AdventureWorks2008Holly]
21
Protecting the Database Scope
Security & Auditing on SQL Server 2008 R2
22
• What Are Database Roles?
• What Are Application Roles?
• Managing Users
• Special Users
• Database-Scope Permissions
• Schema-Scope Permissions
Protecting the Database Scope
24
What Are Database Roles?
Database-Level Roles
Application-Level Roles
Users
25
What Are Application Roles?
User runs
app
App connects to
db as user
App authenticates using
sp_setapprole
App assumes
app role
26
• Create a login
• Create a database scope user
• Assign permissions to the user
Managing Users
Steps to Manage Users
27
Special Users
DBO
The sa login and members of sysadmin role are
mapped to dbo account
Guest
This user account allows logins without user
accounts to access a database
28
Database-Scope Permissions
Database permissions
Database-scope securable permissions
USE AdventureWorks2008
GRANT ALTER ANY USER
TO HRManager
USE AdventureWorks2008
GRANT SELECT
ON SCHEMA :: Sales
TO SalesUser
29
Schema-Scope Permissions
User-defined type permissions
All other schema-scope permissions
USE AdventureWorks2008
GRANT EXECUTE
ON TYPE :: Person.addressType
TO SalesUser
USE AdventureWorks2008
GRANT SELECT
ON Sales.Order
TO SalesUser
33
Managing Keys and Certificates
Security & Auditing on SQL Server 2008 R2
34
• What Are Keys?
• What Are Certificates?
• SQL Server Cryptography Architecture
• When to Use Keys and Certificates
• Transparent Data Encryption
Managing Keys and Certificates
35
What Are Keys?
• Symmetric
 Same key used to encrypt and decrypt
• Asymmetric
 Pair of values: public key and private key
 One encrypts, the other decrypts
Encrypt Decrypt
36
What Are Certificates?
• Associates a public key with entity that holds that key
• Contents:
 The public key of the subject
 The identifier information of the subject
 The validity period
 Issuer identifier information
 The digital signature of the issuer
37
SQL Server Cryptography Architecture
38
When to Use Keys and Certificates
• When to use Certificates
• To secure communication in database mirroring
• To sign packets
• To encrypt data or connections
• When to use Keys
• To help secure data
• To sign plaintext
• To secure symmetric keys
39
Transparent Data Encryption
Transparent data encryption performs real-time I/O
encryption and decryption of the data and log files
• Create a master key
• Create or obtain a certificate protected by the master
key
• Create a database encryption key and protect it by the
Certificate
• Set the database to use encryption
Steps to use Transparent Data Encryption
40
Transparent data encryption
41
• Entire database is protected
• Applications do not need to explicitly encrypt/decrypt
data!
• No restrictions with indexes or data types (except
FILESTREAM)
• Performance cost is small
• Backups are unusable without key
• Can be used with Extensible Key Management
Transparent Database Encryption:
More Benefits
42
• Very simple:
• Database pages are encrypted before being written to disk
• Page protection (e.g. checksums) applied after encryption
• Page protection (e.g. checksums) checked before decryption
• Database pages are decrypted when read into memory
• When TDE is enabled, initial encryption of existing
pages happens as a background process
• Similar mechanism for disabling TDE
• The process can be monitored using the encryption_state
column of sys.dm_database_encryption_keys
• Encryption state 2 means the background process has not completed
• Encryption state 3 means the database is fully encrypted
Transparent Data Encryption:
Mechanism
43
• Create a master key
• CREATE MASTER KEY ENCRYPTION BY PASSWORD =
'<UseStrongPwdHere>';
• Create or obtain a certificate protected by the master key
• CREATE CERTIFICATE MyDEKCert WITH SUBJECT = 'My DEK
Certificate';
• Create a database encryption key and protect it by the certificate
• CREATE DATABASE ENCRYPTION KEY WITH ALGORITHM =
AES_128 ENCRYPTION BY SERVER CERTIFICATE MyDEKCert;
• Set the database to use encryption
• ALTER DATABASE MyDatabase SET ENCRYPTION ON;
Transparent Data Encryption: Enabling
44
• A backup of a TDE encrypted database is also
encrypted using the database encryption key
• To restore the backup OR attach the database, the DEK
must be available!
• There is no way around this – if you lose the DEK, you lose the
ability to restore the backup (that’s the point!)
• Maintain backups of server certificates too
Transparent Data Encryption: Backups
45
• Database | Tasks | Manage Database Encryption
Transparent Data Encryption: Tools
Support
46
Auditing Security
Security & Auditing on SQL Server 2008 R2
47
• What Is Auditing?
• Security Auditing with Profiler
• Auditing with DDL Triggers
• Introducing SQL Server Audit
• SQL Server Audit Action Groups and Actions
Auditing Security
48
• What is Auditing?
• What auditing options are available in SQL Server?
• Have you ever had to audit SQL Server?
• If so, how did you do it?
• If not, what do you think is the best use of auditing?
What Is Auditing?
49
Security Auditing with Profiler
• Using SQL Server Profiler, you can do the following:
• Create a trace that is based on a reusable template
• Watch the trace results as the trace runs
• Store the trace results in a table
• Start, stop, pause and modify the trace results
• Replay the trace results
50
Auditing with DDL Triggers
• Use DDL triggers when you want to do the following:
• Prevent certain changes in your database schema
• You want something to occur in the database in
response to a change in your database schema
• You want to record changes or events in the
database schema
• Start, stop, pause and modify the trace results
• Replay the trace results
51
Introducing SQL Server Audit
• SQL Server Auditing
• Tracks and logs events that occur on the system
• Can track changes on the server or database level
• Can be managed with Transact-SQL
52
Using SQL Server Audit
53
Thank you!
54
Q & A
55
• For SQL Server and Databases
• www.autoexec.gr/blogs/antonch
• For .NET & Visual Studio
• www.dotnetzone.gr/cs/blogs/antonch
My Blogs
56

More Related Content

What's hot (19)

PPTX
Step by Step Installation of Microsoft SQL Server 2012
Sameh AboulDahab
 
PDF
Safe peak installation guide version 2.1
Vladi Vexler
 
PPTX
Oracle Access Manager Integration with Microsoft Active Directory for Zero Si...
Sumit Gupta
 
PPT
Oracle Database Vault
Marco Alamanni
 
PDF
Cache Security- The Basics
InterSystems Corporation
 
PDF
Improve oracle 12c security
Laurent Leturgez
 
PPTX
The Spy Who Loathed Me - An Intro to SQL Server Security
Chris Bell
 
PDF
Cache Security- Configuring a Secure Environment
InterSystems Corporation
 
PPTX
Query Store and live Query Statistics
SolidQ
 
PPT
SQL Server 2008 Security Overview
ukdpe
 
PDF
KoprowskiT_SQLSatMoscow_WASDforBeginners
Tobias Koprowski
 
PDF
security-checklist-database
Mohsen B
 
PDF
KoprowskiT_SQLSatMoscow_2AMaDisaterJustBegan
Tobias Koprowski
 
PDF
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
Tobias Koprowski
 
PDF
Owasp Backend Security Project 1.0beta
Security Date
 
PDF
All database solution-Installing Micosoft SQL Server 2016
AllDatabaseSolutions
 
PPTX
Mcse
mazenetsolution
 
PDF
Sql server 2012 autoexec event no 39
Antonios Chatzipavlis
 
PDF
Multiple ldap implementation with ebs using oid
pasalapudi
 
Step by Step Installation of Microsoft SQL Server 2012
Sameh AboulDahab
 
Safe peak installation guide version 2.1
Vladi Vexler
 
Oracle Access Manager Integration with Microsoft Active Directory for Zero Si...
Sumit Gupta
 
Oracle Database Vault
Marco Alamanni
 
Cache Security- The Basics
InterSystems Corporation
 
Improve oracle 12c security
Laurent Leturgez
 
The Spy Who Loathed Me - An Intro to SQL Server Security
Chris Bell
 
Cache Security- Configuring a Secure Environment
InterSystems Corporation
 
Query Store and live Query Statistics
SolidQ
 
SQL Server 2008 Security Overview
ukdpe
 
KoprowskiT_SQLSatMoscow_WASDforBeginners
Tobias Koprowski
 
security-checklist-database
Mohsen B
 
KoprowskiT_SQLSatMoscow_2AMaDisaterJustBegan
Tobias Koprowski
 
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
Tobias Koprowski
 
Owasp Backend Security Project 1.0beta
Security Date
 
All database solution-Installing Micosoft SQL Server 2016
AllDatabaseSolutions
 
Sql server 2012 autoexec event no 39
Antonios Chatzipavlis
 
Multiple ldap implementation with ebs using oid
pasalapudi
 

Viewers also liked (6)

PDF
Auditing Pro 8 Certification By Muhammad Khurram Baig
Muhammad Khurram Baig
 
PDF
10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015
Scott Sutherland
 
PPT
Arens14e ch01 ppt
srkndnz
 
PPTX
SQL Server 2016 New Security Features
Gianluca Sartori
 
PPS
Auditing DB2 on z/VM and z/VSE
Software Product Research
 
PPTX
Software testing ppt
Heritage Institute Of Tech,India
 
Auditing Pro 8 Certification By Muhammad Khurram Baig
Muhammad Khurram Baig
 
10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015
Scott Sutherland
 
Arens14e ch01 ppt
srkndnz
 
SQL Server 2016 New Security Features
Gianluca Sartori
 
Auditing DB2 on z/VM and z/VSE
Software Product Research
 
Software testing ppt
Heritage Institute Of Tech,India
 
Ad

Similar to Isaca sql server 2008 r2 security & auditing (20)

PPTX
Geek Sync | Handling HIPAA Compliance with Your Data Access
IDERA Software
 
PPT
Where should I be encrypting my data?
Information Technology Society Nepal
 
PDF
Presentation database security enhancements with oracle
xKinAnx
 
PPTX
SQL Server 2016: Just a Few of Our DBA's Favorite Things
Hostway|HOSTING
 
PDF
Presentation database security audit vault & database firewall
xKinAnx
 
PPTX
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
PDF
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Zohar Elkayam
 
PPTX
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
SpanishPASSVC
 
PDF
Modern Data Security with MySQL
Vittorio Cioe
 
PDF
A to z for sql azure databases
Antonios Chatzipavlis
 
PPTX
Sql dba 2008 r2 online training
sssql
 
PPTX
Sql server 2012 dba online training
sqlmasters
 
PDF
SOUG Day Oracle 21c New Security Features
Stefan Oehrli
 
PDF
Oracle Enterprise Manager 12c: updates and upgrades.
Rolta
 
PPTX
Partially Contained Databases
Microsoft TechNet - Belgium and Luxembourg
 
PPTX
Sql server dba certification
sssql
 
PDF
MySQL Data Encryption at Rest
Mydbops
 
PDF
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
Tobias Koprowski
 
PPTX
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
Michael Noel
 
PPTX
Oracle Database 23c Security New Features.pptx
Satishbabu Gunukula
 
Geek Sync | Handling HIPAA Compliance with Your Data Access
IDERA Software
 
Where should I be encrypting my data?
Information Technology Society Nepal
 
Presentation database security enhancements with oracle
xKinAnx
 
SQL Server 2016: Just a Few of Our DBA's Favorite Things
Hostway|HOSTING
 
Presentation database security audit vault & database firewall
xKinAnx
 
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Zohar Elkayam
 
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
SpanishPASSVC
 
Modern Data Security with MySQL
Vittorio Cioe
 
A to z for sql azure databases
Antonios Chatzipavlis
 
Sql dba 2008 r2 online training
sssql
 
Sql server 2012 dba online training
sqlmasters
 
SOUG Day Oracle 21c New Security Features
Stefan Oehrli
 
Oracle Enterprise Manager 12c: updates and upgrades.
Rolta
 
Partially Contained Databases
Microsoft TechNet - Belgium and Luxembourg
 
Sql server dba certification
sssql
 
MySQL Data Encryption at Rest
Mydbops
 
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
Tobias Koprowski
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
Michael Noel
 
Oracle Database 23c Security New Features.pptx
Satishbabu Gunukula
 
Ad

More from Antonios Chatzipavlis (20)

PPTX
Data virtualization using polybase
Antonios Chatzipavlis
 
PDF
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
PDF
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
PDF
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
PDF
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
PDF
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
PDF
Introduction to DAX Language
Antonios Chatzipavlis
 
PDF
Building diagnostic queries using DMVs and DMFs
Antonios Chatzipavlis
 
PDF
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PDF
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PDF
SQLServer Database Structures
Antonios Chatzipavlis
 
PDF
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
PDF
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
PDF
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
PDF
Statistics and Indexes Internals
Antonios Chatzipavlis
 
PDF
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
PDF
Azure SQL Data Warehouse
Antonios Chatzipavlis
 
PDF
Introduction to azure document db
Antonios Chatzipavlis
 
Data virtualization using polybase
Antonios Chatzipavlis
 
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
Introduction to DAX Language
Antonios Chatzipavlis
 
Building diagnostic queries using DMVs and DMFs
Antonios Chatzipavlis
 
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
SQLServer Database Structures
Antonios Chatzipavlis
 
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
Statistics and Indexes Internals
Antonios Chatzipavlis
 
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
Azure SQL Data Warehouse
Antonios Chatzipavlis
 
Introduction to azure document db
Antonios Chatzipavlis
 

Recently uploaded (20)

PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
July Patch Tuesday
Ivanti
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 

Isaca sql server 2008 r2 security & auditing

  • 1. Security & Auditing on SQL Server 2008 R2 Antonios Chatzipavlis Software Architect Evangelist, IT Consultant MCT, MCITP, MCPD, MCSD, MCDBA, MCSA, MCTS, MCAD, MCP, OCA MVP on SQL SERVER
  • 2. 2 • Overview of SQL Server Security • Protecting the Server Scope • Protecting the Database Scope • Managing Keys and Certificates • Auditing Security Objectives
  • 3. 3 Overview of SQL Server Security Security & Auditing on SQL Server 2008 R2
  • 4. 4 • SQL Server Security Framework • What Are Principals? • What Are Securables? • SQL Server Permissions Overview of SQL Server Security
  • 5. 5 Overview of SQL Server Security
  • 7. 7 What Are Principals? Server Role SQL Server Login Windows Group Domain User Account Local User Account SQL Server Database Windows Securables Permissions Principals User Database Role Application Role
  • 8. 8 What Are Securables? Server Role SQL Server Login Windows Group Domain User Account Local User Account SQL Server Database Windows Files Registry Keys Server Schema Database Securables Permissions Principals User Database Role Application Role
  • 9. 9 • Server-Level Permissions • Logins • Credentials • Server-Level Roles • Database-Level Permissions • Users • Schemas • Database Level Roles SQL Server Permissions
  • 10. 10 Protecting the Server Scope Security & Auditing on SQL Server 2008 R2
  • 11. 12 • What Are SQL Server Authentication Methods? • Password Policies • Server-Level Roles • Managing SQL Server Logins • Server-Scope Permissions Protecting the Server Scope
  • 12. 13 What Are SQL Server Authentication Methods? Windows Authentication Mixed SQL and Windows Authentication
  • 13. 14 Password Policies Group Policy Object (GPO) Pa$$w0rd SQL Server Can Leverage Windows Server 2003/2008 Password Policy Mechanism SQL Server Can Manage: • Password Complexity • Password Expiration • Policy Enforcement
  • 14. 15 Server-Level Roles Role Description sysadmin Perform any activity dbcreator Create and alter databases diskadmin Manage disk files serveradmin Configure server-wide settings securityadmin Manage and audit server logins processadmin Manage SQL Server processes bulkadmin Run the BULK INSERT statement setupadmin Configure replication and linked servers
  • 15. 16 Managing SQL Server Logins CREATE LOGIN [SERVERXSalesDBUsers] FROM WINDOWS WITH DEFAULT_DATABASE = AdventureWorks2008 CREATE LOGIN Alice WITH Password = 'Pa$$w0rd' CREATE LOGIN login_name { WITH SQL_login_options | FROM WINDOWS [ WITH windows_login_options ] }
  • 16. 19 Server-Scope Permissions Server permissions Server-scope securable permissions USE master GRANT ALTER ANY DATABASE TO [AdventureWorks2008Holly] USE master GRANT ALTER ON LOGIN :: AWWebApp TO [AdventureWorks2008Holly]
  • 17. 21 Protecting the Database Scope Security & Auditing on SQL Server 2008 R2
  • 18. 22 • What Are Database Roles? • What Are Application Roles? • Managing Users • Special Users • Database-Scope Permissions • Schema-Scope Permissions Protecting the Database Scope
  • 19. 24 What Are Database Roles? Database-Level Roles Application-Level Roles Users
  • 20. 25 What Are Application Roles? User runs app App connects to db as user App authenticates using sp_setapprole App assumes app role
  • 21. 26 • Create a login • Create a database scope user • Assign permissions to the user Managing Users Steps to Manage Users
  • 22. 27 Special Users DBO The sa login and members of sysadmin role are mapped to dbo account Guest This user account allows logins without user accounts to access a database
  • 23. 28 Database-Scope Permissions Database permissions Database-scope securable permissions USE AdventureWorks2008 GRANT ALTER ANY USER TO HRManager USE AdventureWorks2008 GRANT SELECT ON SCHEMA :: Sales TO SalesUser
  • 24. 29 Schema-Scope Permissions User-defined type permissions All other schema-scope permissions USE AdventureWorks2008 GRANT EXECUTE ON TYPE :: Person.addressType TO SalesUser USE AdventureWorks2008 GRANT SELECT ON Sales.Order TO SalesUser
  • 25. 33 Managing Keys and Certificates Security & Auditing on SQL Server 2008 R2
  • 26. 34 • What Are Keys? • What Are Certificates? • SQL Server Cryptography Architecture • When to Use Keys and Certificates • Transparent Data Encryption Managing Keys and Certificates
  • 27. 35 What Are Keys? • Symmetric  Same key used to encrypt and decrypt • Asymmetric  Pair of values: public key and private key  One encrypts, the other decrypts Encrypt Decrypt
  • 28. 36 What Are Certificates? • Associates a public key with entity that holds that key • Contents:  The public key of the subject  The identifier information of the subject  The validity period  Issuer identifier information  The digital signature of the issuer
  • 30. 38 When to Use Keys and Certificates • When to use Certificates • To secure communication in database mirroring • To sign packets • To encrypt data or connections • When to use Keys • To help secure data • To sign plaintext • To secure symmetric keys
  • 31. 39 Transparent Data Encryption Transparent data encryption performs real-time I/O encryption and decryption of the data and log files • Create a master key • Create or obtain a certificate protected by the master key • Create a database encryption key and protect it by the Certificate • Set the database to use encryption Steps to use Transparent Data Encryption
  • 33. 41 • Entire database is protected • Applications do not need to explicitly encrypt/decrypt data! • No restrictions with indexes or data types (except FILESTREAM) • Performance cost is small • Backups are unusable without key • Can be used with Extensible Key Management Transparent Database Encryption: More Benefits
  • 34. 42 • Very simple: • Database pages are encrypted before being written to disk • Page protection (e.g. checksums) applied after encryption • Page protection (e.g. checksums) checked before decryption • Database pages are decrypted when read into memory • When TDE is enabled, initial encryption of existing pages happens as a background process • Similar mechanism for disabling TDE • The process can be monitored using the encryption_state column of sys.dm_database_encryption_keys • Encryption state 2 means the background process has not completed • Encryption state 3 means the database is fully encrypted Transparent Data Encryption: Mechanism
  • 35. 43 • Create a master key • CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<UseStrongPwdHere>'; • Create or obtain a certificate protected by the master key • CREATE CERTIFICATE MyDEKCert WITH SUBJECT = 'My DEK Certificate'; • Create a database encryption key and protect it by the certificate • CREATE DATABASE ENCRYPTION KEY WITH ALGORITHM = AES_128 ENCRYPTION BY SERVER CERTIFICATE MyDEKCert; • Set the database to use encryption • ALTER DATABASE MyDatabase SET ENCRYPTION ON; Transparent Data Encryption: Enabling
  • 36. 44 • A backup of a TDE encrypted database is also encrypted using the database encryption key • To restore the backup OR attach the database, the DEK must be available! • There is no way around this – if you lose the DEK, you lose the ability to restore the backup (that’s the point!) • Maintain backups of server certificates too Transparent Data Encryption: Backups
  • 37. 45 • Database | Tasks | Manage Database Encryption Transparent Data Encryption: Tools Support
  • 38. 46 Auditing Security Security & Auditing on SQL Server 2008 R2
  • 39. 47 • What Is Auditing? • Security Auditing with Profiler • Auditing with DDL Triggers • Introducing SQL Server Audit • SQL Server Audit Action Groups and Actions Auditing Security
  • 40. 48 • What is Auditing? • What auditing options are available in SQL Server? • Have you ever had to audit SQL Server? • If so, how did you do it? • If not, what do you think is the best use of auditing? What Is Auditing?
  • 41. 49 Security Auditing with Profiler • Using SQL Server Profiler, you can do the following: • Create a trace that is based on a reusable template • Watch the trace results as the trace runs • Store the trace results in a table • Start, stop, pause and modify the trace results • Replay the trace results
  • 42. 50 Auditing with DDL Triggers • Use DDL triggers when you want to do the following: • Prevent certain changes in your database schema • You want something to occur in the database in response to a change in your database schema • You want to record changes or events in the database schema • Start, stop, pause and modify the trace results • Replay the trace results
  • 43. 51 Introducing SQL Server Audit • SQL Server Auditing • Tracks and logs events that occur on the system • Can track changes on the server or database level • Can be managed with Transact-SQL
  • 47. 55 • For SQL Server and Databases • www.autoexec.gr/blogs/antonch • For .NET & Visual Studio • www.dotnetzone.gr/cs/blogs/antonch My Blogs
  • 48. 56

Editor's Notes

  • #19: Contain windows authentication informationAllow SQL Accounts to connect to non-SQL resourcesSQL Logins can only map to one credentialCreated automatically. Associated with specific endpoints