Eine Zertifizierungsstelle ist unter Windows Server schnell installiert. Im wesentlichen wird die Rolle „Zertifizierungsstelle“ hinzugefügt, ein paar mal auf „Weiter“ geklickt und schon hat man eine CA die alle möglichen Zertifikate ausstellen kann. Somit hat man eine PKI, Funktioniert zwar, ist aber schlecht.
A PKI and its CAs must be well planned, and legal, organizational and administrative matters must be taken into account. Quickly installing a CA and issuing certificates for all kinds of purposes without having thought about revocation lists, security and requirements beforehand can quickly end fatally. Especially when it comes to issues such as smartcard authentication or encryption (Bitlocker, EFS, S/MIME).
Natürlich kann ich niemanden die sorgfältige Planung und Installation einer PKI abnehmen, aber dieses Howto liefert zumindest eine solide Basis für eine PKI, die vielen Anforderungen gerecht werden kann. Besser als die „Weiter…Weiter…Weiter..Fertigstellen“-Methode ist es allemal.
In this howto, a 2-tier PKI consisting of an offline standalone CA and an Active Directory integrated sub-CA (company CA) is installed. This howto also contains a few adjustments to increase security and avoid problems.
Root CA
This howto is about a 2-tier PKI, so the root CA (or root certification authority) must first be installed and configured. This requires a Windows Server 2008 (R2) or Windows Server 2012 (R2), the Standard Edition is completely sufficient. In productive environments, a VM is recommended, as the root CA is rarely required. Normally, the root CA is offline, switched off, locked in the vault and buried. A VM is therefore a good option, as the vault and the hole can be somewhat smaller.
A Windows Server 2008 Standard or Windows Server 2012 Standard is sufficient for the installation. I have installed a Server 2008 R2, but the configuration is identical for Server 2012. The server is not an Active Directory member, only all updates have been installed so far.
Before the root CA is installed, the CAPolicy.inf file must be created. I use a CAPolicy.inf with the following content:
[Version] Signature = "$Windows NT$" [CRLDistributionPoint] Empty = true [AuthorityInformationAccess] Empty = true [certsrv_server] RenewalKeyLength = 4096 RenewalValidityPeriodUnits = 20 RenewalValidityPeriod = years
The INF file specifies that the CA does not have an AIA and CDP. This information is important as it is an offline root CA. Clients therefore do not need to check the root CA's revocation list or AIA. Furthermore, the use of keys is restricted so that the Root CA can only sign Sub CAs. After all, the Root CA is not supposed to issue certificates for other purposes. While you are at it, you can also make the settings for renewing the root certificate. If the certificate is renewed once, it will only be extended by 2 years without these settings. This would also mean that no more certificates can be issued that have a longer term than 2 years.
Es muss also eine Datei mit dem Namen „CAPolicy.inf“ erstellt werden, die den oben gezeigten Inhalt enthält. Die CAPolicy.inf muss dann in das Windows Verzeichnis (C:\Windows) kopiert werden. Die CAPolicy.inf wird bei der Installation der Zertifizierungsstelle eingelesen, nachträglich funktioniert das nicht mehr.
As soon as the CAPolicy.inf is in the Windows directory, the CA can be installed:
Im Server Manager wird die Rolle „Active Directory -Zertifikatsdienste“ hinzugefügt
Only the certification authority is required as a role service
Da es sich bei dem Server um kein Active Directory Mitglied handelt, kann nur „Eigenständig“ als Installationstyp gewählt werden
Da es sich um die Root-CA handelt, wird bei Zertifizierungsstellentyp „Stammzertifizierungsstelle“ ausgewählt
And since we do not want to migrate or recover a CA, we create a new private key
The cryptography tab is an important point, SHA1 is considered cracked and will no longer be supported by Microsoft as a hash algorithm in the future. To be on the safe side for the next few years, SHA256 and 4096 bits are selected here as the key length. 2048-bit keys are now considered the minimum.
Now assign a descriptive name for the CA. The host name of the server should not be part of the CA name, after all, nobody needs to know the host name of our root CA...
And now to the final question: How long should the CA be valid for? Not too short and not too long, the shorter the more secure the more effort. The longer, the less secure, the less effort. I would set 5 years as the minimum, 20 years as the maximum.
Den Rest der Dialoge mit „Weiter“ bestätigen. Sobald die Installation abgeschlossen ist, haben wir eine Root-CA.
The CA can now be configured conveniently from the command line (Attention: Adjustments necessary, see below):
net stop certsvc certutil -setreg CA\DSConfigDN "CN=Configuration,DC=frankysweb,DC=local" certutil -setreg CA\ValidityPeriodUnits 10 certutil -setreg CA\ValidityPeriod "years" certutil -setreg CA\AuditFilter 127 certutil -setreg CA\CRLPeriodUnits 1 certutil -setreg CA\CRLPeriod "years" certutil -setreg CA\CRLDeltaPeriodUnits 0 certutil -setreg CA\CRLDeltaPeriod "days" ::CRL-Publizierung, %%10 bedeutet, dass es sich bei dem Objekt um ein CRL-Publication-Point handelt certutil -setreg CA\CRLPublicationURLs "1:%WINDIR%\system32\CertSrv\CertEnroll\%%3%%8%%9.crl\n10:LDAP:///CN=%%7%%8,CN=%%2,CN=CDP,CN=Public Key Services,CN=Services,%%6%%10\n2:http://ca.frankysweb.de/cert/%%3%%8%%9.crl" ::AIA-Extension-URLs, %%11 bedeutet, dass es sich bei dem Objekt um einen AIA-Objekt handelt. certutil -setreg CA\CACertPublicationURLs "1:%WINDIR%\system32\CertSrv\CertEnroll\%%1_%%3%%4.crt\n2:LDAP:///CN=%%7,CN=AIA,CN=Public Key Services,CN=Services,%%6%%11\n2:http://ca.frankysweb.de/cert/%%1_%%3%%4.crt" net start certsvc
The commands above can be copied into a .BAT file and must then be adapted slightly:
Zeile 3: Hier muss die Active Directory Konfigurationspartition angegeben werden. Meine AD-Domain heißt frankysweb.local. Daher ist es bei mir „CN=Configuration,DC=frankysweb,DC=local“. Der entsprechende Eintrag lässt sich per ADSI-Edit von einem Domain Controller ermitteln:
Zeile 17 und Zeile 20: Wenn sichergestellt werden soll, dass die Sperrliste auch von externen Clients erreichbar sein soll (Wichtig bei Clients ohne Verbindung zum AD), muss am Ende der Zeile einen Webserver angeben, der aus dem Internet erreichbar ist. Wer nur AD-Mitglieder bedienen muss, kann das Ende der Zeile entfernen (Nicht die ganze Zeile, nur das ab „n2“). Ich empfehle allerdings eine gültige URL einzutragen, später dazu mehr.
Abschließend müssen die Sperrliste und das Root-CA Zertifikat auf den Server kopiert werden der später Sub-CA werden soll. Ich kopiere also die Dateien aus „C:\Windows\System32\CertSrv\CertEnroll“ auf einen Server der ActiveDirectory Mitglied ist. Die Zertifikate müssen dort importiert werden (Teil 2)
So, now we have a root CA. Next up is the Active Directory integrated CA (Sub-CA) (Part 2)