- Mar 22, 2017
- 587
This is a short guide on how to set-up 2FA for Windows Server 2016, installed on a (headless) home server, also known as smart card authentication, with the Yubikey as the smart card.
Because of the complexity of this environment, you should only follow this guide if you are already familiarized with the concepts of Active Directory and what it is used for.
Enjoy
Because of the complexity of this environment, you should only follow this guide if you are already familiarized with the concepts of Active Directory and what it is used for.
- Clean install Server 2016
- Fully update the OS
- Run this command in an elevated cmd prompt:
Code:bcdedit /set {bootmgr} displaybootmenu yes
- this is necessary in case you lock yourself out, as you can F8 at boot and choose "Directory Services Restore Mode" (read more about this here: Directory Services Restore Mode (DSRM))
- Install Active Directory Domain Services following this guide: Step-By-Step: Setting up Active Directory in Windows Server 2016
- Follow this guide to prepare your AD environment for smart card auth: https://www.yubico.com/wp-content/uploads/2016/03/YubiKeyPIVDeploymentGuide_March25_2016_FINAL.pdf
- The guide contains step by step instructions on how to install Active Directory Certificate Services, set-up smart card login templates, deploying the templates in the CA
- The guide contains two methods of enrolling a user's Yubikey to the system. I prefer the first (Creating a Smart Card Login Template for User Self-Enrollment) and if you don't have many users (being a home server) I recommend to start with this and experiment on the second one (Creating a Smart Card Login Template for Enrolling on Behalf of Other Users) later
- Consider using "Changing the Behaviour for Your Domain When You Remove the Smart Card" step of the guide, as this is another very good enforcement of the mechanism. Note that for this to work (and not mentioned in the guide), you have to manually set the startup type of the "Smart Card Removal Policy" service to "Automatic" and restart
- Log in with your user to the domain controller on the DC or on the joined machine OR connect to the DC with RDP (this is very important, you have to make an initial connection to the domain with the user)
- Follow this guide to enroll your Yubikey for the user (while being logged on): https://www.yubico.com/wp-content/uploads/2016/04/YubiKey-PIV-Manager_Users_Guide_April04_2016.pdf
- Enable auto-enrolment and renewal following this guide: Configure Certificate Autoenrollment or Setting Up the Certificate Autoenrollment Feature in a Windows Public Key Infrastructure
- To connect remotely to the DC with your smart card, you must disable "Allow connections only from computers running Remote Desktop with Network Level Authentication" domain-wide/on the DC. Before you ask "is it safe", read this: Why doesn’t NLA work with cross-domain smart card authentication?
- Disconnect your Yubikey, restart the DC, test your Yubikey (locally or via RDP)
Enjoy
Last edited: