This part two of a blog about Device Guard. For part one, which configures only Credential Guard, see this post: https://www.windowsmanagementexperts.com/windows-10-security-device-guard-and-credential-guard-part-1/windows-10-security-device-guard-and-credential-guard-part-1.htm.
In this part, we are going to configure a Device Guard rule. Device Guard rules protect your machine from un-verified code. Device Guard, like Credential Guard, runs from a protected Hyper-V container, ensuring that your devices remain from malware.
Enabling Device Guard
At the end of part one, we configured Credential Guard using this registry key:
To enable Device Guard, set the middle selection box to “Enabled without Lock”.
Next, you need feed the setting “Deploy Code Integrity Policy” a policy. This policy can be in a .bin format (unsigned file) or a .p7 format (signed file). Open this setting, and type in the path and file name. The file can exist on the local computer, or a network share.
Create Device Guard Policy
Creating a Device Guard policy is pretty simple, actually. You start with a gold master. This master should have the software that can run installed on it, and only that software. From this computer, run this series of PowerShell commands. The path in lines three and four must exist prior to executing those commands. The commands will not create the path, and will error if its not there.
$dg_policy = “c:\dg\dg_policy.xml”
$dg_policyBIN = “c:\dg\dg_policy.bin”
new-cipolicy -level pcacertificate -filepath $dg_policy -userpes
convertfrom-cipolicy $dg_policy $dg_policyBIN
Note that the new-cipolicy step takes quite a while to run. After it completes, you should have your BIN file at C:\dg.
Remember that a device can only have one policy applied to it. I recommend keeping your gold master in a VM that you power on and regenerate this policy if needed. It is possible to merge policies, but that is out of the scope of this post. Additional documentation is available here: https://technet.microsoft.com/en-us/itpro/windows/keep-secure/deploy-code-integrity-policies-steps#merge-code-integrity-policies.
All content provided on this blog is for information purposes only. Windows Management Experts, Inc makes no representation as to accuracy or completeness of any information on this site. Windows Management Experts, Inc will not be liable for any errors or omission in this information nor for the availability of this information. It is highly recommended that you consult one of our technical consultants, should you need any further assistance.