Chapter 5
IN THIS CHAPTER
Understanding certificates in Windows Server 2019
Examining certificate types in Active Directory Certificate Services
Selecting the appropriate user certificate
Choosing the right computer certificate
Everyone knows that certificates are a good thing. Far fewer people understand what a certificate is and how it works.
When you go to a website, you might check that the site is using HTTPS. But what does the HTTPS actually mean? Its short for HyperText Transfer Protocol over SSL (which stands for Secure Sockets Layer). A certificate is used to secure the communication channel.
In this chapter, I explain certificates in general and tell you what type of certificates can be issued with Active Directory Certificate Services (AD CS). The certificates I discuss in this chapter are definitely not an exhaustive list, but they are some of the more commonly used certificates.
Windows Server 2019 provides AD CS, which is the focus of the next chapter in this minibook. AD CS allows you to stand up your own public key infrastructure (PKI), which allows you to issue certificates for users and internal systems that are trusted.
You can still install certificates from third-party certificate authorities, like GoDaddy and DigiCert; in fact, this is a must if the certificate is securing a resource that people outside your organization will access. However, if a resource will only be accessed by people within your organization, then it’s a prime candidate for an internal certificate issued by your organization’s PKI. This saves you the expense of the external certificate as well.
Cryptography is used to secure data in transit and at rest. Cryptography uses mathematical algorithms to generate “keys,” which are used to encrypt data. A single key may be used that can encrypt and decrypt the data (see “Symmetric cryptography”), or you may have a private key and a public key, which are mathematically linked. One key encrypts and the other decrypts (see “Asymmetric cryptography”).
There are two types of cryptography: symmetric and asymmetric.
Symmetric cryptography is the ability to encrypt and decrypt with the same key. When you’re using a shared secret or a password, you can think of that as symmetric cryptography. Because it only uses one key, it’s faster, but it’s also less secure because an attacker would only need to find out what the key is to decrypt the data. You can see a diagram of how symmetric cryptography works in Figure 5-1.
Some common symmetric ciphers include
Asymmetric cryptography (or public key cryptography) is an encryption scheme where data is encrypted by one key and decrypted by another key. The keys are mathematically linked and will only work with each other. The private key is kept safe and offers non-repudiation (meaning that it can prove identity) because it isn’t distributed. The public key is given to others and is used to decrypt data that was encrypted by the private key. Asymmetric cryptography is what is used in public key infrastructure (PKI). A common example of asymmetric cryptography is when you use HTTPS. Say you go to your bank’s website. Your browser is presented with the public certificate, which it uses to encrypt and decrypt traffic with the bank’s web servers. Your bank’s web servers have the private key, which proves that the bank is who it says it is, and allows the bank to decrypt your traffic. You can see a diagram of how asymmetric cryptography works at a high level in Figure 5-2.
Certificates fall under asymmetric cryptography. When you need to create a certificate, you generate a private key, and then a certificate signing request (CSR), which is an encoded representation of your public key. The CSR is given to a certificate authority, internal or external, and the certificate is created from there. The private key never leaves your possession.
Common asymmetric ciphers include
No introduction to certificates or cryptography would be complete without clearing up a few terms. If you understand these terms, then this chapter and the next will be a lot simpler:
Server2.sometestorg.com
would be an FQDN.sometestorg.com
would be expressed as *.sometestorg.com
. Wildcard certificates can be used to save money to secure multiple websites and/or servers.There are many types of certificates in AD CS. The standard non-domain-joined server has a set of certificate templates out of the box, but a domain-joined Enterprise certificate authority (CA) has even more certificate templates to choose from.
In the following section, I discuss the more common types of user and computer certificates that you encounter, and what their uses are.
User certificates are all about — you guessed it — the users. These certificates are typically used to establish the identity of a user. Here are some of the more common User certificate types that you may run into:
Code Signing: When you need to run internal PowerShell scripts or executables and you want to ensure that they haven’t been changed or altered in any way, you want a code signing certificate. The Code Signing certificate validates that the code has not been changed or altered in any way since it was last signed. If you want to run remote PowerShell scripts, this is a great way to ensure that only good, tested scripts are run from authorized users because you can set the permissions on who can enroll with the template, as well as the execution policy of PowerShell scripts in your environment.
Encrypting File System (EFS) can be used to encrypt files or folders and can only be decrypted by the user who encrypted them or an authorized recovery agent (EFS Recovery Agent). Please note that this is different from BitLocker, which offers full disk encryption, not file/folder-level encryption.
Key Recovery Agent: The Key Recovery Agent certificate is used by an authorized administrator to decrypt private keys. It can be used to recover private keys assuming that the CA has been configured to archive and allow recovery of the private key that is associated with the public key it was given when a certificate was requested. This template should be used very sparingly because it gives the user with the certificate the ability to recover private keys and, by extension, the ability to decrypt the data encrypted by the certificates to which the private key belongs.
It is considered a best practice by Microsoft to use separation of duties if you want to utilize the Key Recovery Agent template. The recommendation is to allow someone in the Certificate Manager role to retrieve the private key but not decrypt it, and to allow the Key Recovery Agent to decrypt the private key but not retrieve it. This provides better safeguards to organizational data because no one person can decrypt all data.
Computer certificates are similar to user certificates in that they’re verifying identity. The main difference is that they’re verifying the identity of a machine rather than the identity of a user. Here are some of the more common Computer certificate templates and their uses: