-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(iot): device certificate age check audit configuration #33816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
e4f1db0
b5f8fe5
bd34d1d
78216c7
1eeb527
e426f1b
a025415
9a35c47
c83d981
242c47d
1932e46
04ad544
12a8b41
4d850ba
cdea97c
0a57656
05f0e6e
c31d5c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { Resource, Stack, IResource } from 'aws-cdk-lib/core'; | ||
| import { Resource, Stack, IResource, Duration } from 'aws-cdk-lib/core'; | ||
| import { Construct } from 'constructs'; | ||
| import * as iot from 'aws-cdk-lib/aws-iot'; | ||
| import * as iam from 'aws-cdk-lib/aws-iam'; | ||
|
|
@@ -59,6 +59,25 @@ export interface CheckConfiguration { | |
| */ | ||
| readonly conflictingClientIdsCheck?: boolean; | ||
|
|
||
| /** | ||
| * Checks when a device certificate has been active for a number of days greater than or equal to the number you specify. | ||
| * | ||
| * @default true | ||
| */ | ||
| readonly deviceCertificateAgeCheck?: boolean; | ||
|
|
||
| /** | ||
| * The duration used to check if a device certificate has been active | ||
| * for a number of days greater than or equal to the number you specify. | ||
| * | ||
| * Valid values are between 30 and 3652 days. | ||
|
||
| * | ||
| * You cannot specify a value for this check if `deviceCertificateAgeCheck` is set to `false`. | ||
| * | ||
| * @default - 365 days | ||
| */ | ||
| readonly deviceCertificateAgeCheckDuration?: Duration; | ||
|
|
||
| /** | ||
| * Checks if a device certificate is expiring. | ||
| * | ||
|
|
@@ -201,6 +220,17 @@ export class AccountAuditConfiguration extends Resource implements IAccountAudit | |
| // Enhanced CDK Analytics Telemetry | ||
| addConstructMetadata(this, props); | ||
|
|
||
| const deviceAgeCheckThreshold = props?.checkConfiguration?.deviceCertificateAgeCheckDuration; | ||
|
|
||
| if (deviceAgeCheckThreshold) { | ||
| if (props?.checkConfiguration?.deviceCertificateAgeCheck === false) { | ||
| throw new Error('You cannot specify a value for `deviceCertificateAgeCheckDuration` if `deviceCertificateAgeCheck` is set to `false`.'); | ||
| } | ||
| if (!deviceAgeCheckThreshold.isUnresolved() && deviceAgeCheckThreshold.toDays() < 30 || deviceAgeCheckThreshold.toDays() > 3652) { | ||
| throw new Error(`The device certificate age check threshold must be between 30 and 3652 days. got: ${deviceAgeCheckThreshold.toDays()} days.`); | ||
| } | ||
| } | ||
|
|
||
| this.accountId = Stack.of(this).account; | ||
|
|
||
| const auditRole = new iam.Role(this, 'AuditRole', { | ||
|
|
@@ -261,6 +291,15 @@ export class AccountAuditConfiguration extends Resource implements IAccountAudit | |
| caCertificateExpiringCheck: this.renderAuditCheckConfiguration(checkConfiguration?.caCertificateExpiringCheck), | ||
| caCertificateKeyQualityCheck: this.renderAuditCheckConfiguration(checkConfiguration?.caCertificateKeyQualityCheck), | ||
| conflictingClientIdsCheck: this.renderAuditCheckConfiguration(checkConfiguration?.conflictingClientIdsCheck), | ||
| deviceCertificateAgeCheck: | ||
| checkConfiguration?.deviceCertificateAgeCheck !== false ? | ||
| { | ||
| enabled: true, | ||
| configuration: { | ||
| certAgeThresholdInDays: String(checkConfiguration?.deviceCertificateAgeCheckDuration?.toDays() ?? 365), | ||
| }, | ||
| } : | ||
| undefined, | ||
| deviceCertificateExpiringCheck: this.renderAuditCheckConfiguration(checkConfiguration?.deviceCertificateExpiringCheck), | ||
| deviceCertificateKeyQualityCheck: this.renderAuditCheckConfiguration(checkConfiguration?.deviceCertificateKeyQualityCheck), | ||
| deviceCertificateSharedCheck: this.renderAuditCheckConfiguration(checkConfiguration?.deviceCertificateSharedCheck), | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Uh oh!
There was an error while loading. Please reload this page.