Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ankit branch #3

Open
wants to merge 103 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
d38d791
Update HGS LAB Setup.txt
ankitsandel Jul 20, 2022
9122e6a
Update HGS LAB Setup.txt
ankitsandel Jul 20, 2022
098a935
Create HGS_Deploy_Script.txt
ankitsandel Jul 20, 2022
0ce37bf
Add files via upload
ankitsandel Jul 20, 2022
620a6e5
Delete HGS LAB.jpg
ankitsandel Jul 20, 2022
fe084bc
Create README.md
ankitsandel Jul 20, 2022
02eeb5e
Update and rename README.md to HGS_LAB_Setup.md
ankitsandel Jul 20, 2022
43a96a2
Update HGS_LAB_Setup.md
ankitsandel Jul 20, 2022
16e45ac
Create LAB Setup.jpg
ankitsandel Jul 20, 2022
dd2162f
Merge branch 'AnkitBranch' of https://github.com/Shashank231190/HGSDe…
ankitsandel Jul 20, 2022
f6e85ff
Update HGS_LAB_Setup.md
ankitsandel Jul 20, 2022
caf5317
LAb
ankitsandel Jul 20, 2022
e2f96f3
Update HGS_LAB_Setup.md
ankitsandel Jul 20, 2022
d881427
Create HGS_Server_Deployment.md
ankitsandel Jul 20, 2022
09a4ce6
Update HGS_Server_Deployment.md
ankitsandel Jul 20, 2022
a805f24
Update HGS_Server_Deployment.md
ankitsandel Jul 20, 2022
407e6b9
Create Part 1 - HGS install on Node 1.mp4
ankitsandel Jul 20, 2022
f7add0a
Create Part 2- Install HGS on second node.Mp4
ankitsandel Jul 20, 2022
49cd1ef
Merge branch 'AnkitBranch' of https://github.com/Shashank231190/HGSDe…
ankitsandel Jul 20, 2022
2068cdd
Create HGS_Server_Deployment.md
ankitsandel Jul 20, 2022
5b5bc55
Create Part 1 - HGS install on Node 1.zip
ankitsandel Jul 20, 2022
3295b10
Create Part 2- Install HGS on second node.zip
ankitsandel Jul 20, 2022
d43c3c8
Delete HGS_Server_Deployment.md
ankitsandel Jul 20, 2022
bed7789
Create Initializing HGS Node.md
ankitsandel Jul 20, 2022
f4fe327
Create Part 4 - Adding Second node to HGS cluster.zip
ankitsandel Jul 20, 2022
72abc86
Create Part 3 - Genrating certificates and Initialization of HGS Serv…
ankitsandel Jul 20, 2022
3739aa0
Delete Part 1 - HGS install on Node 1.mp4
ankitsandel Jul 20, 2022
29546cd
Delete Part 2- Install HGS on second node.Mp4
ankitsandel Jul 20, 2022
8312dd1
change
ankitsandel Jul 20, 2022
322cc65
Update HGS_Server_Deployment.md
ankitsandel Jul 20, 2022
748ec29
Update Initializing HGS Node.md
ankitsandel Jul 20, 2022
eec34cb
Create Part 5 - Install Host guardian on Compute nodes.zip
ankitsandel Jul 20, 2022
118f089
Create Configuring Guarded Hosts
ankitsandel Jul 20, 2022
25b51a5
Create HGS_LAB_Setup.md
ankitsandel Jul 20, 2022
f3704a0
Delete Configuring Guarded Hosts
ankitsandel Jul 20, 2022
654a53d
Configuring Guarded Host
ankitsandel Jul 20, 2022
5545e58
Merge branch 'AnkitBranch' of https://github.com/Shashank231190/HGSDe…
ankitsandel Jul 20, 2022
c739413
Update Configuring guarded Host .md
ankitsandel Jul 20, 2022
c2a1de2
Update Configuring guarded Host .md
ankitsandel Jul 20, 2022
0b96af4
Update Configuring guarded Host .md
ankitsandel Jul 20, 2022
b8b9fea
Update Configuring guarded Host .md
ankitsandel Jul 20, 2022
edecb4f
Create Live Migration of vTPM enabled VM.7z
ankitsandel Jul 20, 2022
a79a5e9
HGS_Deploy_script
ankitsandel Jul 20, 2022
cafd569
Update HGS_Deploy_Script.md
ankitsandel Jul 20, 2022
9b02313
Update HGS_Deploy_Script.md
ankitsandel Jul 20, 2022
1397d06
Update Configuring a vTPM enabled VM.md
ankitsandel Jul 20, 2022
04d03d0
Update Configuring a vTPM enabled VM.md
ankitsandel Jul 20, 2022
5fa5cf2
Update Configuring a vTPM enabled VM.md
ankitsandel Jul 20, 2022
9060623
Update Configuring a vTPM enabled VM.md
ankitsandel Jul 20, 2022
06b6d1c
Update Live Migration of vTPM enabled VM.md
ankitsandel Jul 20, 2022
21e5893
Update Live Migration of vTPM enabled VM.md
ankitsandel Jul 20, 2022
1ce93aa
Update Live Migration of vTPM enabled VM.md
ankitsandel Jul 20, 2022
b915a4d
Update Live Migration of vTPM enabled VM.md
ankitsandel Jul 20, 2022
ad2fb4b
Update Live Migration of vTPM enabled VM.md
ankitsandel Jul 20, 2022
13d7015
Update Live Migration of vTPM enabled VM.md
ankitsandel Jul 20, 2022
eb864c8
TS
ankitsandel Jul 20, 2022
69bd379
Update HGS_Deploy_Script.md
ankitsandel Jul 21, 2022
0cf5f1e
Update HGS_Deploy_Script.md
ankitsandel Jul 21, 2022
c95e916
HGS_Server_deploy
ankitsandel Jul 21, 2022
655b1ee
Delete Part 1 - HGS install on Node 1.zip
ankitsandel Jul 21, 2022
04ea92c
Update HGS_Server_Deployment.md
ankitsandel Jul 21, 2022
cab98b9
Create test1.md
ankitsandel Aug 19, 2022
888f310
Update test1.md
ankitsandel Aug 19, 2022
91e43df
Update test1.md
ankitsandel Aug 19, 2022
37d789b
Update test1.md
ankitsandel Aug 19, 2022
2d56bcb
Delete test1.md
ankitsandel Nov 15, 2022
5cce6ae
Update HGS_LAB_Setup.md
ankitsandel Nov 15, 2022
e78b580
update
AnkitSandel1 Dec 15, 2022
4da0ee2
Update Initializing HGS Node.md
ankitsandel Dec 15, 2022
525e446
Update Configuring guarded Host .md
ankitsandel Dec 15, 2022
dc211cd
Merge branch 'AnkitBranch' of https://github.com/Shashank231190/HGSDe…
AnkitSandel1 Dec 15, 2022
48d8e24
Update Configuring guarded Host .md
ankitsandel Dec 15, 2022
ec3959e
Create Introduction.md
AnkitSandel1 Feb 20, 2023
05637b3
Update Introduction.md
ankitsandel Feb 20, 2023
afb88d5
Update Introduction.md
ankitsandel Feb 20, 2023
5eb6aa7
Update Introduction.md
ankitsandel Feb 20, 2023
67b724b
Update Introduction.md
ankitsandel Feb 20, 2023
9f3aae7
Update Introduction.md
ankitsandel Feb 20, 2023
7322888
Update Introduction.md
ankitsandel Feb 20, 2023
480dd26
Update Introduction.md
ankitsandel Feb 20, 2023
6d76c82
Update Introduction.md
ankitsandel Feb 20, 2023
5720966
Create README.md
ankitsandel Feb 20, 2023
fc3f0b0
Update README.md
ankitsandel Feb 20, 2023
2f850ed
Update README.md
ankitsandel Feb 20, 2023
0eb4593
Delete HGS_LAB_Setup.md
AnkitSandel1 Feb 20, 2023
0165438
Update README.md
ankitsandel Feb 20, 2023
d532365
Create Shielded VM
ankitsandel Feb 20, 2023
b8e1e36
Update and rename Shielded VM to Shielded VM.md
ankitsandel Feb 20, 2023
6773d24
Update Shielded VM.md
ankitsandel Feb 20, 2023
1120d25
Update Shielded VM.md
ankitsandel Feb 20, 2023
ffaa223
Update Shielded VM.md
ankitsandel Feb 20, 2023
f123ac7
Update Shielded VM.md
ankitsandel Feb 20, 2023
704d465
Create Attestation Mode.md
ankitsandel Feb 20, 2023
9eedc41
Update Attestation Mode.md
ankitsandel Feb 20, 2023
099a610
Update Attestation Mode.md
ankitsandel Feb 20, 2023
2d90b5f
Update Attestation Mode.md
ankitsandel Feb 20, 2023
88b96b6
Create HGS.md
ankitsandel Feb 20, 2023
dae9b5e
Update HGS.md
ankitsandel Feb 20, 2023
40d9591
Create Key Protection Service.md
ankitsandel Feb 20, 2023
cb7b20c
Update HGS_Deploy_Script.md
ankitsandel Apr 18, 2023
1342a30
Update HGS_Server_Deployment.md
ankitsandel Apr 11, 2024
79cb4c9
Update HGS_Server_Deployment.md
ankitsandel Apr 11, 2024
b763e1f
Update HGS_Server_Deployment.md
ankitsandel Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions Attestation Mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Attestation modes in the Guarded Fabric solution
![image](https://user-images.githubusercontent.com/71546848/220191567-78ab163c-00ae-4fcb-90ff-a61840b8f7d6.png)

The Attestation Service does two things:
1. The Identity Attestation of the host
The Service makes sure if this is the right host to trust. If the Service is using TPM, then it knows the ekPub it is requesting. If the Service is AD based, then the host needs to be part of a trusted AD Host Group. That is the HOST identity validation.
2. Measurements
The Attestation Service validates how the host is booted, whether the host has the right configuration, and if the configuration is trusted. Once both validations pass, then the Attestation Certificate is signed by the attestation signing key.

Below are the Modes of attestation available in HGS
1. Admin Trusted attestation
2. TPM-trusted attestation (hardware-based)
3. Host key attestation (based on asymmetric key pairs)

# Admin Trusted attestation
![image](https://user-images.githubusercontent.com/71546848/220190750-ff95b1c2-7ed8-4787-8bd5-84191b6e893c.png)

Shielded VMs can only be decrypted and started on hosts that Fabric Admin has designated as guarded hosts.
By adding them to a security group you create in Fabric (not HGS) Active Directory Domain Services, you can identify hosts as guarded (AD DS). The forest of the Host Guardian Service and the fabric AD must establish a trust connection.

AD based attestation uses the group SID and configure that with Attestation service.
The AD attestation is the way to identify servers that will be able to run the Shielded VMs. The security of these servers will have to be based on external processes and solutions provided by the customer.

![image](https://user-images.githubusercontent.com/71546848/220192682-b8f3058e-2b68-4e3e-bea9-b790e442c012.png)

Admin-trusted attestation is deprecated beginning with Windows Server 2019.


# TPM-trusted attestation (hardware-based)

![image](https://user-images.githubusercontent.com/71546848/220192830-5b31ea51-fb33-4148-9405-1692f92fdefc.png)

Host hardware and firmware must include TPM 2.0 and UEFI 2.3.1 with secure boot enabled
Offers the strongest possible protections

Only hosts that HGS Admin have designated as guarded hosts, and that are running code they have identified as trusted, can start Shielded VMs.
The technologies that help make sure that the hosts are running trusted code are built into the Windows Server operating system, and include Secure Boot, Measured Boot and Code Integrity policies

Here are some of the measurements that the Attestation Service validates:
Request coming from the EKPub
This is data signed by the TPM, and used to validate that the TPM chip is trusted.
The TCG Log
A set of events that show how the host was booted; once the TCG log is verified to be valid, then a check is done to see if the content matches any known good policies.

Code Integrity Policy
There is a hash of the CI that gets placed in the TCG log and the Attestation service checks if the hash matches. The CI Policy ensures that you have the right set of drivers running on the Host OS kernel. It also verifies the UEFI parameters, ensures secure boot is enabled, and that no debuggers are attached. Only then does it issue the attestation certificate once the host passes.
Upon Attestation, the host is granted “Attestation Certificate”.
This certificate is used to unlock the VM’s vTPM.

The Get-Platformidentifier creates an XML file that contains the EKPub for the TPM chip. You take that and configure the attestation service by letting it know that this is a known good and authorized host that is trusted.

![image](https://user-images.githubusercontent.com/71546848/220194329-34c5df80-ec46-47c4-8126-fe4f8803e761.png)


TPM based Attestation Measurements performed/requested by AS

Authorized List of TPMs (EKpub)
Request is coming from a known trusted host

TCG Log Integrity Validation
Replay TCG Log to match TPM PCR measurements

Code Integrity Policy
Ensure host is not running any unknown code
(e.g. malware or debugger)

Secure Boot
Make sure Secure Boot is enabled

Unified Extensible Firmware Interface
Validate UEFI secure boot parameters


# Host key attestation (based on asymmetric key pairs)

Intended to support existing host hardware where TPM 2.0 isn't available. Requires fewer configuration steps and is compatible with commonplace server hardware.

Guarded hosts are approved based on possession of the key.

Reference:
https://learn.microsoft.com/en-us/windows-server/security/guarded-fabric-shielded-vm/guarded-fabric-create-host-key

19 changes: 0 additions & 19 deletions HGS LAB Setup.txt

This file was deleted.

29 changes: 29 additions & 0 deletions HGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Host Guardian Service (HGS)

An external authority in a guarded fabric that verifies the health of guarded hosts, and controls the release of keys required to start or live migrate Shielded VMs.

A way to verify a host is in a healthy state
A process to securely release keys to healthy hosts

HGS runs on a separate physical machine, typically in three instances. It runs two services: Attestation and Key Protection Service. The Hyper-V host contacts these services to get Attested, and to ask for the transport key to become unlocked.

Each HGS instance is a multi-instance web app, therefore you can have multiple instances—up to 64 in a single cluster.

![image](https://user-images.githubusercontent.com/71546848/220195667-80b590b9-a449-4ac1-b11a-a57b290329f4.png)

Provides below functionalities

Guarded Hosts Verification

The service verifies that only trusted fabric hosts that are pre-registered and identified by TPM hardware ID, will be authorized to run Shielded VMs in the fabric Or in the case of Admin-Attestation, that they are authorized hosts.

Remote Host Attestation

The service performs attestation for the Guarded hosts in the fabric, to make sure that these hosts booted with the appropriate binaries, and have the right Hyper-V Code Integrity (HVCI) policy applied, It then provides the attested host with an attestation certificate to be used while requesting the Key Protector (KP) for a Shielded VM that needs to be launched

Key Protection

A Shielded VM (when using BitLocker) can only be run by a host that is able to decrypt the vTPM of that VM (where the BitLocker key resides)
A Guarded host should present its attestation certificate to request the decryptable Key Protector (KP) from the Key Protection Service (KPS), so that it can decrypt the vTPM.


215 changes: 215 additions & 0 deletions HGS_Deploy_Script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# Settings up Variables

$GHostPlainPassword="Welcome@1234" #password to access Guarded nodes Compute1 and Compute2
$HGSPlainPassword ="Welcome@1234" #password to access HGS cluster nodes. In production environments it should be different

$SafeModeAdministratorPlainPassword="Welcome@1234" #SafeModePassword for HGS Domain
$HGSDomainName='Hgslab.local'
$HGSServiceName = 'MyHGS'

#Create creds

$GHostPassword = ConvertTo-SecureString $GHostPlainPassword -AsPlainText -Force
$HGSPassword = ConvertTo-SecureString $HGSPlainPassword -AsPlainText -Force

$GHostCreds = New-Object System.Management.Automation.PSCredential ("Pikachu\Administrator", $GHostPassword)
$HGSCreds = New-Object System.Management.Automation.PSCredential ("Administrator", $HGSPassword)
$HGSDomainCreds = New-Object System.Management.Automation.PSCredential ("$HGSDomainName\Administrator", $HGSPassword)

#wait until machines are up and grab IPs

do{
$HGSServerIPs=Invoke-Command -VMName *HGS1, *HGS2 -Credential $HGSCreds -ScriptBlock {(Get-NetIPAddress -InterfaceAlias Ethernet -AddressFamily IPv4).IPAddress} -ErrorAction SilentlyContinue
Start-Sleep 5
}until ($HGSServerIPs.count -eq 3)

# Configuring HGS Server

#Install required HGS feature on HGS VMs

Invoke-Command -VMName *HGS1,*HGS2 -Credential $HGSCreds -ScriptBlock {
Install-WindowsFeature -Name HostGuardianServiceRole -IncludeManagementTools
}

#restart VMs

Restart-VM -VMName *HGS* -Type Reboot -Force -Wait -For HeartBeat

#Install HGS on first node

Invoke-Command -VMName *HGS1 -Credential $HGSCreds -scriptblock {
$SafeModeAdministratorPassword = ConvertTo-SecureString -AsPlainText $using:SafeModeAdministratorPlainPassword -Force
Install-HgsServer -HgsDomainName $using:HGSDomainName -SafeModeAdministratorPassword $SafeModeAdministratorPassword #-Restart
}

#restart HGS1

Restart-VM -VMName *HGS1 -Type Reboot -Force -Wait -For HeartBeat

# Setting up DNS Forwarder

#Set the DNS forwarder on the fabric DC so other nodes can find the new domain

Invoke-Command -VMName *DC -Credential $FabricCreds -ScriptBlock {
Add-DnsServerConditionalForwarderZone -Name $using:HGSDomainName -ReplicationScope Forest -MasterServers $using:HgsServerIPs
}

#wait for DC to be initialized
#Note: Sometimes DC starts for quite some time (Please wait for the Group Policy Client or Applying Computer settings).

$Result=$null
do {
$Result=Invoke-Command -VMName *HGS1 -Credential $HGSDomainCreds -ScriptBlock {
Get-ADComputer -Filter * -Server HGS1 -ErrorAction SilentlyContinue
Start-Sleep 5
}
}until($Result)

#Wait for HGS2 to finish dcpromo

$Result=$null
do {
$Result=Invoke-Command -VMName *HGS2 -Credential $HGSDomainCreds -ScriptBlock {
Get-ADComputer -Filter * -Server HGS2
Start-Sleep 5
}
}until($Result)


# Add HGSServer on HGS2

Invoke-Command -VMName *HGS2 -Credential $HGSCreds -ScriptBlock {
$SafeModeAdministratorPassword = ConvertTo-SecureString -AsPlainText $using:SafeModeAdministratorPlainPassword -Force
Install-HgsServer -HgsDomainName $using:HGSDomainName -HgsDomainCredential $using:HGSDomainCreds -SafeModeAdministratorPassword $SafeModeAdministratorPassword #-Restart
}

#restart HGS2

Restart-VM -VMName *HGS2 -Type Reboot -Force -Wait -For HeartBeat

# Creating Certificates for HGS Server

#you can create CA in Bastion forest https://docs.microsoft.com/en-us/windows-server/security/guarded-fabric-shielded-vm/guarded-fabric-obtain-certs#request-certificates-from-your-certificate-authority

#or just create self signed cert

Invoke-Command -VMName *HGS1 -Credential $HGSDomainCreds -ScriptBlock {
$certificatePassword = ConvertTo-SecureString -AsPlainText -String "Welcome@1234" -Force
$signCert = New-SelfSignedCertificate -Subject "CN=HGS Signing Certificate"
Export-PfxCertificate -FilePath $env:temp\signCert.pfx -Password $certificatePassword -Cert $signCert
Remove-Item $signCert.PSPath
$encCert = New-SelfSignedCertificate -Subject "CN=HGS Encryption Certificate"
Export-PfxCertificate -FilePath $env:temp\encCert.pfx -Password $certificatePassword -Cert $encCert
Remove-Item $encCert.PSPath
Initialize-HgsServer -HgsServiceName $using:HGSServiceName -SigningCertificatePath "$env:temp\signCert.pfx" -SigningCertificatePassword $certificatePassword -EncryptionCertificatePath "$env:Temp\encCert.pfx" -EncryptionCertificatePassword $certificatePassword -TrustTpm -hgsversion V1
}


# Join HGS2 to the cluster

Invoke-Command -VMName *HGS2 -Credential $HGSDomainCreds -ScriptBlock {
Initialize-HgsServer -HgsServerIPAddress $using:HGSServerIPs[0]
}

# Set HGS configuration to support VMs (disable IOMMU requirement)

Invoke-Command -VMName *HGS1 -Credential $HGSDomainCreds -ScriptBlock {
Disable-HgsAttestationPolicy Hgs_IommuEnabled
}

# Install HostGuardian Hyper-V Support on compute nodes

Invoke-Command -VMName *Compute1,*Compute2 -Credential $FabricCreds -ScriptBlock {
Install-WindowsFeature HostGuardian -IncludeManagementTools
}

#Restart compute nodes

Restart-VM -VMName *Compute1,*Compute2 -Type Reboot -Force -Wait -For HeartBeat

#Wait for installation to complete
#Start-Sleep 60

#Set registry key to not require IOMMU for VBS in VMs and apply default CI policy
#Also generate attestation artifacts (CI policy, TPM EK, and TPM baseline)
#You should also include https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/microsoft-recommended-block-rules

# Generating attestation artifacts (CI policy, TPM EK, and TPM baseline)

#grab recommended xml blocklist from GitHub
#[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$content=Invoke-WebRequest -UseBasicParsing -Uri https://raw.githubusercontent.com/MicrosoftDocs/windows-itpro-docs/master/windows/security/threat-protection/windows-defender-application-control/microsoft-recommended-block-rules.md
#find start and end
$XMLStart=$content.Content.IndexOf("<?xml version=")
$XMLEnd=$content.Content.IndexOf("</SiPolicy>")+11 # 11 is lenght of string
#create xml
[xml]$XML=$content.Content.Substring($xmlstart,$XMLEnd-$XMLStart) #find XML part

Invoke-Command -VMName *Compute1, *Compute2 -Credential $FabricCreds -ScriptBlock {
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard -Name RequirePlatformSecurityFeatures -Value 0
md C:\attestationdata
$cipolicy = "C:\attestationdata\CI_POLICY_AUDIT.xml"
Copy-Item "$env:SystemRoot\schemas\CodeIntegrity\ExamplePolicies\AllowMicrosoft.xml" $cipolicy -Force
#add recommended XML blocklist
($using:XML).Save("$env:TEMP\blocklist.xml")
#add to MyPolicy.xml
$mergedPolicyRules = Merge-CIPolicy -PolicyPaths "$env:TEMP\blocklist.xml",$cipolicy -OutputFilePath $cipolicy
Write-Host ('Merged policy contains {0} rules' -f $mergedPolicyRules.Count)
# For testing, convert the policy to an audit policy to avoid constrained language mode in PS
Set-RuleOption -FilePath $cipolicy -Option 3
# Allowing a CI policy to be updated without a reboot can allow someone to pass attestation and replace with a bad policy, so we disallow that
Set-RuleOption -FilePath $cipolicy -Option 16 -Delete
ConvertFrom-CIPolicy -XmlFilePath $cipolicy -BinaryFilePath "C:\attestationdata\CI_POLICY_AUDIT.bin"
Copy-Item "C:\attestationdata\CI_POLICY_AUDIT.bin" "$env:SystemRoot\System32\CodeIntegrity\SIPolicy.p7b" -Force
Initialize-Tpm
(Get-PlatformIdentifier -Name $env:COMPUTERNAME).Save("C:\attestationdata\TPM_EK_$env:COMPUTERNAME.xml")
Get-HgsAttestationBaselinePolicy -Path "C:\attestationdata\TPM_Baseline_$env:COMPUTERNAME.xml" -SkipValidation
}

#Reboot VMs again for setting to take effect

Restart-VM -Name *Compute1,*Compute2 -Type Reboot -Force -Wait -For HeartBeat

# Collect attestation artifacts from hosts

$HGS1Session = New-PSSession -VMName *HGS1 -Credential $HGSDomainCreds
$Compute1Session = New-PSSession -VMName *Compute1 -Credential $FabricCreds
$Compute2Session = New-PSSession -VMName *Compute2 -Credential $FabricCreds

#Create folder on HGS1
Invoke-Command -Session $HGS1Session -ScriptBlock {
New-Item -Name AttestationData -Path c:\ -ItemType Directory
}

#Copy files

Copy-Item -Path "C:\attestationdata\TPM_EK_COMPUTE1.xml" -Destination $env:Temp -FromSession $Compute1Session
Copy-Item -Path "$env:temp\TPM_EK_COMPUTE1.xml" -Destination C:\attestationdata\ -ToSession $HGS1Session
Copy-Item -Path "C:\attestationdata\TPM_EK_COMPUTE2.xml" -Destination $env:Temp -FromSession $Compute2Session
Copy-Item -Path "$env:temp\TPM_EK_COMPUTE2.xml" -Destination C:\attestationdata\ -ToSession $HGS1Session
Copy-Item -Path "C:\attestationdata\TPM_Baseline_COMPUTE1.xml" -Destination $env:Temp -FromSession $Compute1Session
Copy-Item -Path "$env:temp\TPM_Baseline_COMPUTE1.xml" -Destination C:\attestationdata\ -ToSession $HGS1Session
Copy-Item -Path "C:\attestationdata\CI_POLICY_AUDIT.bin" -Destination $env:Temp -FromSession $Compute1Session
Copy-Item -Path "$env:temp\CI_POLICY_AUDIT.bin" -Destination C:\attestationdata\ -ToSession $HGS1Session


# Import the attestation policies on HGS

Invoke-Command -VMName *HGS1 -Credential $HGSDomainCreds -ScriptBlock {
# Every individual EK needs to be added
Add-HgsAttestationTpmHost -Path C:\attestationdata\TPM_EK_COMPUTE1.xml -Force
Add-HgsAttestationTpmHost -Path C:\attestationdata\TPM_EK_Compute2.xml -Force

# But only one copy of the baseline and CI policy, since they should be identical on both hosts

Add-HgsAttestationTpmPolicy -Path C:\attestationdata\TPM_Baseline_COMPUTE1.xml -Name "Hyper-V TPM Baseline"
Add-HgsAttestationCIPolicy -Path C:\attestationdata\CI_POLICY_AUDIT.bin -Name "AllowMicrosoft-AUDIT-CI"
}

# Now, have the hosts try to attest

Invoke-Command -VMName *Compute1, *Compute2 -Credential $GHostCreds -ScriptBlock {
Set-HgsClientConfiguration -AttestationServerUrl "http://$using:HGSServiceName.$using:HGSDomainName/Attestation" -KeyProtectionServerUrl "http://$using:HGSServiceName.$using:HGSDomainName/KeyProtection"
}

24 changes: 24 additions & 0 deletions Introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Introduction

With the evolution of servers to virtual environments, this brings new challenges in trying to protect the datacenter environment.

The virtualization fabric bring new items to be considered when planning for a security strategy:
1. Administrators have the “keys to the kingdom”, and in the case of sensitive workloads such as Domain Controllers, virtualization admins can access the secrets inside virtual machines. A compromised fabric administrator can be a malicious administrator or an administrative account that was compromised by an attacker.
2. A virtual machine is really just a file and virtual disks, that can be copied to a USB stick or a laptop and then be mounted in another environment.
3. In the past, to protect a server or a sensitive workload, we use to put these servers in a highly secured physical environment that only allowed people would be able to access and have physical access to the assets. In the case of a virtual machine, anyone who have access to the virtualization host will have access to the virtual machine source files, which bring us back to the first statement.
4. In the last few years, great new capabilities came up such as TPM chips, Secure Boot, UEFI 2.0 and others. The problem is that these features are tied to hardware capabilities that are not exposed to virtual machines.



![image](https://user-images.githubusercontent.com/71546848/220169455-70f0eab6-660c-4407-bda6-94d78ab24a59.png)

What do these attacks have in common?
1. Stolen admin credentials
2. Phishing attacks
3. Pass-the-hash (PtH) attacks
4. Insider attacks
5. Fabric attacks

![image](https://user-images.githubusercontent.com/71546848/220170897-dbcd87d0-367c-45f9-89ae-3bb5900c8f69.png)


16 changes: 16 additions & 0 deletions Key Protection Service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Key Protection Service

Validate Host’s “Attestation Certificate”

Validates and uses attestation health certificate to authorize key release

Key Protection Service (KPS)

KPS rolls the transport key in order to provide forward secrecy

Bring Your Own Key (Optional)

Enables per Tenant encryption & signing keys, typically backed by HSM (hardware security module)
Tenants work with the Hoster Security Admin(s) to provision HSM with Tenant keys

![image](https://user-images.githubusercontent.com/71546848/220197247-fd129afa-5262-49fe-a6e0-7b20a6e1adbd.png)
Loading