Create Key to Encrypt the Windows and Linux
Create Key to Encrypt the Windows and Linux
SSG : Azure at Ericsson : Create Key to Encrypt the Windows and Linux
Servers
Knowledge Article KBA00263922
Problem
Key requires to secure Servers from untheorized access.
Environment
Windows Server 2012 R2
Windows Server 2016
Windows Server 2019
Linux OS (RedHat)
Linux (suse 12)
azure at ericsson
Resolution
1. Login to Azure Portal (https://portal.azure.com)
2. Search the Key Vaults
3. Go to Key Vaults and select the Keys.
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 1/7
16/08/2023, 18:01 KBA00263922
5. If we can set the key expiration date, we can also do, it will be by default for 2 years.
6. After creating the keys, it will show the Current Version, Status and Expiration Date.
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 2/7
16/08/2023, 18:01 KBA00263922
Enable Azure Disk Encryption for Windows VMs - Azure Virtual Machines | Microsoft Docs
By Default, RHEL Encrypted VM Unable to boot because of missing VFAT module error.
Re-enable the VFAT module by commenting out the following entry from the modprobe configuration file:
Look for the file CIS.conf or any other *.conf file inside the /etc/modprobe.d directory
Review the contents of each *.conf file and look for the following line and comment it out or remove it from the configuration file. This line
takes care of blacklisting the VFAT module
# vi /etc/modprobe.d/CIS.conf
# install vfat /bin/true # -> comment out/remove this line
Check if the vfat module is loaded in the current initramfs if not rebuild the initramfs to include it.
Validate if the VFAT module is loaded in the current initramfs file using the following command. In case it returns nothing, it means the VFAT
module is not loaded
Refer to the below sample output to know how a loaded VFAT module would look like:
# modinfo vfat
filename: /lib/modules/3.10.0- 957.5.1.el7.x86_64/kernel/fs/fat/vfat.ko.xz
author: Gordon Chaffee
description: VFAT filesystem support
license: GPL
alias: fs-vfat
retpoline: Y
rhelversion: 7.6
srcversion: A3254796A3CD9815ABDDC94
depends: fat
If the VFAT module is not loaded into initramfs, proceed to regenerate the initramfs using the following commands:
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 3/7
16/08/2023, 18:01 KBA00263922
# modinfo vfat
(In case it returns above output, it means the VFAT module is loaded)
# cp /etc/fstab /etc/fstab_beforevfatchange.bak
Take the snippet of df –Th output
Detach Data disk first from azure portal for safer side. (Because we are encrypting OS disk first)
Comment disk mount entry in # vi /etc/fstab and save the file by :wq
$rgName = 'RG-UAT-AVAAMO';
$vmName = 'azweulx0321';
$KeyVaultName = 'avaamokeyvaultuat';
$KeyName = 'azweulx0321';
$KeyVault = Get-AzureRmKeyVault -VaultName $KeyVaultName -ResourceGroupName $rgname;
$diskEncryptionKeyVaultUrl = $KeyVault.VaultUri;
$KeyVaultResourceId = $KeyVault.ResourceId;
$KEK = Get-AzureKeyVaultKey -VaultName $KeyVaultName -name $KeyName;
$KeyEncryptionKeyUrl = $KEK.Id
$VolumeType = 'OS'
Set-AzureRmKeyVaultAccessPolicy -VaultName $KeyVaultName -ResourceGroupName $rgname –EnabledForDiskEncryption
Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -DiskEncryptionKeyVaultUrl
$diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $KeyVaultResourceId -KeyEncryptionKeyVaultId $KeyVaultResourceId -KeyEncryptionKeyUrl
$KeyEncryptionKeyUrl -VolumeType $VolumeType -EncryptFormatAll -SkipVmBackup –Force
# df -Th
$rgName = 'RG-UAT-AVAAMO';
$vmName = 'azweulx0321';
$KeyVaultName = 'avaamokeyvaultuat';
$KeyName = 'azweulx0321';
$KeyVault = Get-AzureRmKeyVault -VaultName $KeyVaultName -ResourceGroupName $rgname;
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 4/7
16/08/2023, 18:01 KBA00263922
$diskEncryptionKeyVaultUrl = $KeyVault.VaultUri;
$KeyVaultResourceId = $KeyVault.ResourceId;
$KEK = Get-AzureKeyVaultKey -VaultName $KeyVaultName -name $KeyName;
$KeyEncryptionKeyUrl = $KEK.Id
$VolumeType = 'ALL'
Set-AzureRmKeyVaultAccessPolicy -VaultName $KeyVaultName -ResourceGroupName $rgname –EnabledForDiskEncryption
Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -DiskEncryptionKeyVaultUrl
$diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $KeyVaultResourceId -KeyEncryptionKeyVaultId $KeyVaultResourceId -KeyEncryptionKeyUrl
$KeyEncryptionKeyUrl -VolumeType $VolumeType -EncryptFormatAll -SkipVmBackup –Force
Run command # lsblk to check the volume id of newly vfat volume and create PV (physical volume)
# pvcreate /dev/mapper/baa012de-7300-49b5-af8e-3f186fa6fd12
Check the status of PV create by # pvs it will show up the size of PV, Now we have to add this PV in VG (volume group). Check the name of
volume group by # vgs
PV move and VG reduce process will take some time complete. After finishing up this task you can verify the data in Data disk volume and remove
un-encrypted Data disk from Azure portal
Cause
Keys require for encrypt the Windows / Linux Servers.
Resources
Article Metadata
Publish to External Audiences
No
Author
Gopal Khatri
Assigned to
Bharat Kumar Sharma
Company
All (Primary)
Keywords
Keyvault, Key Encryption, Database Encrption, Disk Encrption, azure at ericsson, Key Creation, azure at Ericsson
Business Service
azure at ericsson
Operational Category
Failure > Break&Fix (Primary)
Product Category
Service > IT Service > Support Service > azure at ericsson (Primary)
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 5/7
16/08/2023, 18:01 KBA00263922
Attachments
This Article has no attachments
Activity
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 6/7
16/08/2023, 18:01 KBA00263922
https://ericsson-smartit.onbmc.com/smartit/app/#/knowledge/AGGB8NLFJQ7EFAQY5S8TQX6VMX7YIY 7/7