This post is in Draft Mode - it will not appear on the site or in search results

SQL Server Database Security Best Practices

SQL Serever Database Secuirty Best Practices for the Vigilant DBA

Hugo Shebbeare, SQL MVP 2010

http://www.sqlservercentral.com/blogs/hugo/
https://www.simple-talk.com/author/hugo-shebbeare/

SQL PASS (Profesional Association of SQL Server) chapter

2016 CTP - Features Frozen
CTP - Community Technology Preview
RTM - Release to Manufacturing

Getting Started With Always Encrypted

CREATE TABLE [dbo].[Patients](
	 [PatientId] [int] IDENTITY(1,1), 
	 [SSN] [nvarchar](11) 
		 COLLATE Latin1_General_BIN2 
		 ENCRYPTED WITH (ENCRYPTION_TYPE = DETERMINISTIC, 
		 ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256', 
		 COLUMN_ENCRYPTION_KEY = CEK1) NOT NULL,
	 [FirstName] [nvarchar](50) NULL,
	 [LastName] [nvarchar](50) NULL, 
	 [MiddleName] [nvarchar](50) NULL,
	 [StreetAddress] [nvarchar](50) NULL,
	 [City] [nvarchar](50) NULL,
	 [ZipCode] [int] NULL,
	 [State] [nvarchar](50) NULL
 )
 GO

screenshot

Guidelines

-- Check for passwords that are null or the same name as accnt
SELECT name, type_desc, create_date, modify_date,
passowrd_hash
FROM sys.sql_logins
WHERE PWDCOMPARE('',password_hash)=1;
--WHERE PWDCOMPARE(name,password_hash)=1;

Flexible Server Roles

DENY IMPERSONATE ON SvcAccountName to DBAS

GUI - Create Script

Million Dollar System From IBM - Guardium

Check which services are used and disable unnecessary or unused

SELECT * FROM sys.dm_server_services

Logon Auditing - BOTH failed and successful logins
Beware of space - can be <30-40GB for busy prod server (VM might be more easily scalable)

-- see errors
xp_readerrorlog
-- see available logins (same as SSMS > db > Security > Logins, but you can do remotely)
xp_logininfo

Principle of Least Privilege

GRANT SELECT On Object::dbo.Employe(FirstName, LastName) To HumanResourcesAssistant;
DENY SELECT On Object::dbo.Employe(SSN)

Allows you to grant elevated privileges temporarily through to objects via Stored Procs

EXECUTE AS caller/OWNER/SELF
REVER

Row-Level Security (i.e. first three months of data / people without SSN) - without having to create a new object or a view

Business Case to Executives

$$ - Fines for data vulnerability

How to Avoid the 'Abuse' of SysAdmin by Applying User Defined Roles in SQL 2012 (and keep Exec.s and Auditors Happy)

Patching

GDR - General Distribution Releases
QFE - Quick Fix Engineering

Takes down production - but if you're not ahead of "known" vulnerabilities - that's pretty bad

Activity Monitor

sp_who2

Right click on the instance - Activity Monitor

Learn what's normal activity - learn what's not normal