Skip to content

Commit 327b41d

Browse files
committed
Merge pull request #1 from megamorf/patch-2
updated certificate creation section
2 parents ff1dfaf + f94d74d commit 327b41d

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

dsc/secureMOF.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,27 @@ This public key certificate has specific requirements for it to be used for DSC
4949
>EKUs.
5050
5151
Any existing certificate on the _Target Node_ that meets these criteria can be used to secure DSC credentials.
52-
53-
## Creating the Certificate on the Target Node
5452

55-
The private key must be kept secret, because is used to decrypt the MOF on the **Authoring Node**
53+
## Certificate creation
54+
55+
There are two approaches you can take to create and use the required Encryption Certificate (public-private key pair).
56+
57+
1. Create it on the **Target Node** and export just the public key to the **Authoring Node**
58+
2. Create it on the **Authoring Node** and export the entire key pair to the **Target Node**
59+
60+
Method 1 is recommended because the private key used to decrypt credentials in the mof stays on the Target Node at all times.
61+
62+
63+
### Creating the Certificate on the Target Node
64+
65+
The private key must be kept secret, because is used to decrypt the MOF on the **Target Node**
5666
The easiest way to do that is to create the private key certificate on the **Target Node**, and copy the **public key certificate** to the computer being used to author the DSC configuration into a MOF file.
5767
The following example:
5868
1. creates a certificate on the **Target node**
5969
2. exports the public key certificate on the **Target node**.
6070
3. imports the public key certificate into the **my** certificate store on the **Authoring node**.
6171

62-
### On the Target Node: create and export the certificate
72+
#### On the Target Node: create and export the certificate
6373
```powershell
6474
# note: These steps need to be performed in an Administrator PowerShell session
6575
$cert = New-SelfSignedCertificate -Type DocumentEncryptionCertLegacyCsp -DnsName 'DscEncryptionCert'
@@ -69,14 +79,14 @@ $cert | Export-Certificate -FilePath "$env:temp\DscPublicKey.cer" -Force
6979

7080
Once exported, the ```DscPublicKey.cer``` would need to be copied to the **Authoring Node**.
7181

72-
### On the Authoring Node: import the cert’s public key
82+
#### On the Authoring Node: import the cert’s public key
7383
```powershell
7484
# Import to the my store
75-
Import-Certificate -FilePath "$env:temp\DscPublicKey.cer" -CertStoreLocation Cert:\LocalMachine\My > $null
85+
Import-Certificate -FilePath "$env:temp\DscPublicKey.cer" -CertStoreLocation Cert:\LocalMachine\My
7686
```
7787

78-
## Creating the Certificate on the Authoring Node
79-
Alternately, the private key certificate can be created on the **Authoring Node**, exported with the **private key** as a PFX file and then imported on the **Target Node**.
88+
### Creating the Certificate on the Authoring Node
89+
Alternately, the encryption certificate can be created on the **Authoring Node**, exported with the **private key** as a PFX file and then imported on the **Target Node**.
8090
This is the current method for implementing DSC credential encryption on _Nano Server_.
8191
Although the PFX is secured with a password it should be kept secure during transit.
8292
The following example:
@@ -86,7 +96,7 @@ The following example:
8696
4. imports the private key certificate into the root certificate store on the **Target node**.
8797
- it must be added to the root store so that it will be trusted by the **Target node**.
8898

89-
### On the Auhtoring Node: create and export the certificate
99+
#### On the Authoring Node: create and export the certificate
90100
```powershell
91101
# note: These steps need to be performed in an Administrator PowerShell session
92102
$cert = New-SelfSignedCertificate -Type DocumentEncryptionCertLegacyCsp -DnsName 'DscEncryptionCert'
@@ -96,12 +106,12 @@ $cert | Export-PfxCertificate -FilePath "$env:temp\DscPrivateKey.pfx" -Password
96106
# remove the private key certificate from the node but keep the pulbic key certificate
97107
$cert | Export-Certificate -FilePath "$env:temp\DscPublicKey.cer" -Force
98108
$cert | Remove-Item -Force
99-
Import-Certificate -FilePath "$env:temp\DscPublicKey.cer" -CertStoreLocation Cert:\LocalMachine\My > $null
109+
Import-Certificate -FilePath "$env:temp\DscPublicKey.cer" -CertStoreLocation Cert:\LocalMachine\My
100110
```
101111

102112
Once exported, the ```DscPrivateKey.cer``` would need to be copied to the **Target Node**.
103113

104-
### On the Target Node: import the cert’s private key as a trusted root
114+
#### On the Target Node: import the cert’s private key as a trusted root
105115
```powershell
106116
# Import to the root store so that it is trusted
107117
$mypwd = ConvertTo-SecureString -String "YOUR_PFX_PASSWD" -Force -AsPlainText

0 commit comments

Comments
 (0)