Skip to content

Microsoft SQL Server Encryption of Data-at-Rest

Why do we need Encryption of Data-at-Rest?

For data sets that contain sensitive information there are numerous scenarios where the physical drive on which the data is stored should be encrypted. In the event that the physical drive is stolen, a malicious party may access the original data by attaching the disk to another host and then browse the data in the event it is not encrypted. Also consider a multi-tenant virtual environment such as the public cloud, where the physical host on which your VM is running may be compromised. This document describes different mechanisms provided by Microsoft for Windows Server operating systems to encrypt data-at-rest.

We will consider two solutions:

  1. BitLocker Drive Encryption
    1. Drive encryption feature included in Windows Server.
    2. Protects at volume level, so when the database server is online, the volume is unlocked, though not decrypted.
    3. If a malicious user gets access to the whole drive via an out of band mechanism, they still would not be able to attach and use it.
  2. Transparent Data Encryption(TDE)
    1. TDE can be used to encrypt SQL Server data files at rest
    2. TDE can encrypt sensitive data in the database and protect the keys that are used to encrypt the data with a certificate
    3. TDE performs real-time I/O encryption and decryption of data and log files to protect data at rest
    4. If a malicious user gets access to the data file, they cannot use it without the protection keys

It is recommended by Microsoft to have a combined defense mechanism using both Bitlocker and TDE.

With only Bitlocker enabled - if the drive gets stolen, nobody can use the data without access to the key, but if a malicious attacker gained access to the drive via a network share or other services that access data from the drive, they could copy data (for example, an SQL Server backup file or a database file) unless it is locked from doing so, by the running SQL Server process. The copy of this file on the new drive is then not encrypted anymore.

With only TDE enabled - the database files themselves are encrypted. Therefore, if either file is copied or stolen via a network, as in the example above, the attacker cannot read it. But if the attacker gains access to the whole drive, including SQL Server, he can start SQL Server and read the data using SQL, because SQL Server is performing the decryption for him.

Now if both BitLocker and TDE are used concurrently, both data theft vectors are mitigated. Both technologies complement each other, and it is recommended that you use BitLocker together with TDE for an in depth defense.

Source

Enable Bitlocker on Windows Server:

Please follow these steps to configure and enable Bitlocker on Windows Server (The attached screenshots are from Windows Server 2019).

  1. Open Server Manager

    Open Server Manager

  2. Click Manage and select "Add Roles and Features":

    Add Roles and Features

  3. Click Next:

    Next

  4. Installation Type - select "Role Based or Feature Based installation" and click "Next":

    Installation type

  5. Click on "Select a server from the server pool" and choose the server from the server pool. Click "Next":

    Select server

  6. Do not make any changes at the "Server Roles" screen, just click "Next":

    Server roles

  7. In the "Select Features" page select "BitLocker Drive Encryption":

    Select features

  8. Click "Add Features" in the pop-up window and click "Next":

    Add features

  9. Enable "Restart the destination server automatically if required", click "Yes" on the pop-up screen and proceed with "Install":

    Restart_dest_Server

  10. The server may restart during the installation process. Wait for the installation to complete:

    Server restart

  11. Once the installation is completed, open the BitLocker Management console:

    Mngt console 1

    Mngt console 2

  12. Click "Turn on BitLocker" for the drive you wish to encrypt. Select "Use a password to unlock this drive" and provide a strong password. Click "Next":

    Password

  13. Opt how you would like to back up the recovery key. For example, select "Save to a file". Provide the file name and save. Click "Next":

    Backup 1

    Backup 2

  14. Choose how much of your drive to encrypt; Select encryption mode; Click "Start Encrypting":

    Encryption 1

    Encryption 2

    Encryption 3

    Encryption 4

At this point you can see that Volume "E:" has been encrypted.

Enable TDE on SQL Server

Please refer to the steps mentioned in the following link, in order to enable TDE on SQL Servers: https://docs.microsoft.com/en-us/sql/relational-databases/security/encryption/transparent-data-encryption?view=sql-server-ver15

More Information

BitLocker