Top Banner
Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 http://tinyurl.com/ISACAClay © 2016, Risenhoover Consulting, Inc. All Rights Reserved 1
32

Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

May 17, 2018

Download

Documents

voque
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Microsoft SQL Server Securityand Auditing

Clay RisenhooverISACA North TexasApril 14, 2016http://tinyurl.com/ISACAClay

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 1

Page 2: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

GoalsUnderstand new and important

security featuresDemonstrate use of some of themDiscuss security ramifications of

all of them

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 2

Page 3: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

AssumptionsThe ideal student:• Not a DBA• Not freaked out by SQL• Understand security/assurance• Understand basic database

concepts (like ACID)

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 3

Page 4: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

ACIDAtomicity (all or nothing

transactions)Consistency (transactions leave DB

in stable state)Isolation (concurrency)Durability (transactions don’t go

away once committed)

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 4

Page 5: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

ModelServer hardeningConfidentialityIntegrityAvailability

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 5

Page 6: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Server HardeningPatch levelAuthentication modes

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 6

Page 7: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

PatchingDetermine running versionSqlserverversions.blogspot.comselect @@versionselect SERVERPROPERTY('productversion')

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 7

Page 8: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

AuthenticationDetermine authentication mode

SELECTSERVERPROPERTY('IsIntegratedSecurityOnly')

SELECT CASESERVERPROPERTY('IsIntegratedSecurityOnly')WHEN 1 THEN 'Windows Authentication'WHEN 0 THEN ‘Mixed Mode Authentication'

END as [Authentication Mode]

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 8

Page 9: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

ConfidentialityEncryptionRow-level securityUser permissions

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 9

Page 10: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Encryption OptionsTransparent data encryption (TDE)Encrypted BackupsAlways encrypted

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 10

Page 11: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Encryption - TDEIntroduced in SQL Server 2008

EnterpriseEncrypts data at restUses hierarchy of keys

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 11

Page 12: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

TDE Key Hierarchy

Database Encryption Key

Database Master Key

Service Master Key (OS Level)

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 12

Page 13: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

TDE – Key BackupsBACKUP MASTER KEY TO FILE ='path_to_file' ENCRYPTION BYPASSWORD = 'password‘

RESTORE MASTER KEY FROM FILE ='path_to_file' DECRYPTION BYPASSWORD = 'password' ENCRYPTION BYPASSWORD = 'password' [ FORCE ]

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 13

Page 14: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Encryption – Encrypted BackupsIntroduced in SQL Server 2014Encrypt database backup filesCan use

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 14

Page 15: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Encryption – Always EncryptedIntroduced in SQL Server 2016Protects data in transit and at restColumns encrypted with keys

stored with application, not inserver

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 15

Page 16: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Encryption – Final ThoughtsBackup and protect all

cryptographic keysTEST YOUR BACKUPS

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 16

Page 17: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Row-Level SecurityIntroduced in SQL Server 2016Uses functions to restrict table

rows available to a userOlder versions, had to use views

and stored procedures toemulate

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 17

Page 18: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Special PermissionsServer-level permissions:• Apply to all databases, present

and futureIntroduced in SQL Server 2014:

CONNECT ANY DATABASESELECT ALL USER SECURABLES

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 18

Page 19: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

IntegrityDelayed durabilityMark transaction as committed,

even if logs have not beenflushed

Makes our ACID a little less ACID-ic

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 19

Page 20: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Integrity – Delayed DurabilityMay be set at:• Database level• Transaction level• For in-memory natively

compiled procedures

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 20

Page 21: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Database levelALTER DATABASE dbnameSET DELAYED_DURABILITY= DISABLED | ALLOWED |FORCED;

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 21

Page 22: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Transaction LevelCOMMIT TRANSACTION WITH(DELAYED_DURABILITY =ON);

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 22

Page 23: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Atomic levelFor natively-compiled procedure

used with in-memory OLTP:BEGIN ATOMIC WITH(DELAYED_DURABILITY =ON, ...)

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 23

Page 24: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Delayed Durability CheckingDatabase properties dialog

Options tab

Query

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 24

Page 25: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Delayed Durability - Options

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 25

Page 26: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Delayed Durability – Query

SELECT name,DATABASEPROPERTYEX(name,'DelayedDurability') ASDelayedDurability,

DATABASEPROPERTYEX(name,Status') AS Status

FROM master.dbo.sysdatabasesORDER BY name

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 26

Page 27: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

AvailabilityFor on-premise installations, a

number of Azure availabilityoptions:

• Managed backups to Azure• “Always on” availability groups

with Azure replicas

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 27

Page 28: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Managed Backup to AzureIntroduced in SQL Server 2014Automated backup to Azure

“blob” storage containerSimilar to disk/tape backup, but

stored in cloud“Backup to URL”

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 28

Page 29: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Backup to URLBACKUP DATABASE TestDB TO URL ='https://<accountname>.blob.core.windows.net/<containername>/TestDB.bak'

WITH CREDENTIAL ='<mycredentialname>' ,COMPRESSION,STATS = 5;

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 29

Page 30: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Always-On Azure ReplicasAlways-On availability groups

used for database replicationReplicas can be hosted in AzureFailover to on-premise or Azure

replica

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 30

Page 31: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

ConclusionBrief overview of interesting

featuresNot exhaustive2016 deployments a good time to

re-check your DB environment

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 31

Page 32: Microsoft SQL Server Security and Auditing - isacantx.org Lunch... · Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14, 2016 ... Introduced in

Questions

http://tinyurl.com/ISACAClay

© 2016, Risenhoover Consulting, Inc. All Rights Reserved 32