You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/packages/services/certificatevendor/README.md
+69-1Lines changed: 69 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@
4
4
5
5
The certificate vendor manages the rotation of certificates involving a number of moving parts across CDF and AWS IoT.
6
6
7
-
There are two flows for certificate rotation. In the fist case, device certificates are pre-created and registered before the rotation request. In this case the device requests a new certificate and is vended an S3 presigned URL in order to download the certificate package. In the second case, the device provides the certificate vendor module a CSR. In this way the device can request an updated certificate while keeping the private key on the device. The certificate vendor then uses a CA certificate registered with AWS IoT to create a device certificate from the CSR and return this certificate to the device.
7
+
There are two flows for certificate rotation. In the fist case, device certificates are pre-created and registered before the rotation request. In this case the device requests a new certificate and is vended an S3 presigned URL in order to download the certificate package. In the second case, the device provides the certificate vendor module a CSR. In this way the device can request an updated certificate while keeping the private key on the device.
8
+
There are two options for CSR case. One option is to use ACM PCA to issue the certificate, and another option is to create a certificate from a CA certificate registered with AWS IoT, and CA private key sorted in EC2 Parameter store.
8
9
9
10
## Architecture
10
11
@@ -20,8 +21,41 @@ A certificate package comprising of the certificate, public key and private key
20
21
21
22
### Certificate Creation with a device CSR
22
23
24
+
#### Certiicate Creation with CA private key
25
+
23
26
A CA certificate needs to be registered with AWS IoT. In addtion, the CA private key needs to be encrypted and stored in EC2 Parameter store so the certificate vendor module can sign device certificates using the CA.
24
27
28
+
#### Certificate Creation from ACMPCA
29
+
30
+
AWS Private Certificate Authority needs to be prepared and private CA needs to be created as prerequisite.
31
+
The private CA needs to be registered with AWS IoT. The example registration step is as follows.
32
+
33
+
```
34
+
1. Create Verification CSR
35
+
$ openssl genrsa -out verificationCert.key 2048
36
+
2. Get IoT Core Registration Code
37
+
$ aws iot get-registration-code
38
+
3. Create CSR. Insert the registration code in Common Name.
The registered CA Certificate ID and PCA Authority Arn need to be entered
57
+
in the inquiry prompt in the installer or request body as parameters.
58
+
25
59
## Deployment
26
60
27
61
The following resources are automatically created as part of the deployment and utilized by this flow:
@@ -139,6 +173,40 @@ MQTT PUBLISH BODY:
139
173
}
140
174
```
141
175
176
+
Example MQTT message body sent from the device to the AWS IoT Gateway to retrieve a certificate based on a provided CSR. That use ACM PCA to issue a new certificate:
"acmpcaParameters" :{ // If not specified, the values specified in the installer will be used.
185
+
// Mandatory. Either provide the ACM PCA CA ARN to issue the device certificate,
186
+
// or an alias that points to said AWS ACM PCA CA ARN:
187
+
"acmpcaCaArn": "?",
188
+
"acmpcaCaAlias": "?",
189
+
190
+
// Mandatory. Either provide the AWS IoT CA ID of the ACM PCA CA registered with AWS IoT,
191
+
// or an alias that points to said AWS IoT CA ID:
192
+
"awsiotCaID": "?",
193
+
"awsiotCaAlias": "?",
194
+
195
+
// Optional. Certificate information to apply:
196
+
"certInfo": { // optional.
197
+
"commonName": "?", // optional
198
+
"organization": "?", // optional
199
+
"organizationalUnit": "?", // optional
200
+
"locality": "?", // optional
201
+
"stateName": "?", // optional
202
+
"country": "?", // optional
203
+
"emailAddress": "?", // optional
204
+
"daysExpiry": ? // optional
205
+
}
206
+
}
207
+
}
208
+
```
209
+
142
210
Upon receiving the request, the CDF Certificate Vendor module validates that the device is approved to received a new certificate. The registry to be used, whether the AWS IoT Device Registry or the CDF Asset Library module, is configured as part of the initial deployment. This reference implementation determines whether something is approved by checking its existence. If these behavior needs to be enhanced, refer to `src/registry/assetlibrary.service.ts` / `src/registry/deviceregistry.service.ts`
143
211
144
212
If approved, the CDF Certificate Vendor module checks for the presence of a CSR in the request. If provided, the CSR is used to create a new device certificate and returned to the device. If not present, teh CDF Certificate Vendor module proceeds to download the S3 Object Metadata associated with the certificate package to retrieve the `certificateId`, activates the certificate within AWS IoT, then constructs and returns a pre-signed url to the device for secure downloading of the certificate package. Finally the device status is updated to activated.
0 commit comments