@fjall/components-infrastructure 0.89.4 → 0.89.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +50 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -18
- package/dist/lib/app.d.ts +12 -12
- package/dist/lib/app.js +61 -56
- package/dist/lib/aspects/index.d.ts +1 -1
- package/dist/lib/aspects/index.js +1 -6
- package/dist/lib/aspects/resourceInventory.js +6 -13
- package/dist/lib/config/audit.js +1 -5
- package/dist/lib/config/aws/accessAnalyser.d.ts +11 -0
- package/dist/lib/config/aws/accessAnalyser.js +17 -0
- package/dist/lib/config/aws/accountAuditRole.js +11 -15
- package/dist/lib/config/aws/accountMonitoringRole.js +25 -29
- package/dist/lib/config/aws/alarmTopic.d.ts +8 -0
- package/dist/lib/config/aws/alarmTopic.js +19 -0
- package/dist/lib/config/aws/cloudTrail.js +4 -9
- package/dist/lib/config/aws/configRecorder.d.ts +16 -0
- package/dist/lib/config/aws/configRecorder.js +51 -0
- package/dist/lib/config/aws/configRulePreset.d.ts +13 -0
- package/dist/lib/config/aws/configRulePreset.js +62 -0
- package/dist/lib/config/aws/disasterRecovery.d.ts +1 -1
- package/dist/lib/config/aws/disasterRecovery.js +56 -73
- package/dist/lib/config/aws/ebsDefaultEncryption.d.ts +8 -0
- package/dist/lib/config/aws/ebsDefaultEncryption.js +41 -0
- package/dist/lib/config/aws/ecrDefaultImage.js +25 -30
- package/dist/lib/config/aws/eventBus.js +8 -11
- package/dist/lib/config/aws/guardDutyDetector.d.ts +16 -0
- package/dist/lib/config/aws/guardDutyDetector.js +26 -0
- package/dist/lib/config/aws/identityCenter.d.ts +1 -1
- package/dist/lib/config/aws/identityCenter.js +23 -25
- package/dist/lib/config/aws/identityCenterGroupMembership.js +18 -22
- package/dist/lib/config/aws/index.d.ts +19 -8
- package/dist/lib/config/aws/index.js +19 -25
- package/dist/lib/config/aws/inspectorEnablement.d.ts +9 -0
- package/dist/lib/config/aws/inspectorEnablement.js +51 -0
- package/dist/lib/config/aws/ipam.js +9 -13
- package/dist/lib/config/aws/oidcConnector.js +8 -12
- package/dist/lib/config/aws/platform.js +1 -5
- package/dist/lib/config/aws/s3BlockPublicAccess.d.ts +9 -0
- package/dist/lib/config/aws/s3BlockPublicAccess.js +55 -0
- package/dist/lib/config/aws/scpPreset.d.ts +21 -0
- package/dist/lib/config/aws/scpPreset.js +311 -0
- package/dist/lib/config/aws/securityBaseline.d.ts +15 -0
- package/dist/lib/config/aws/securityBaseline.js +27 -0
- package/dist/lib/config/aws/securityHubHub.d.ts +15 -0
- package/dist/lib/config/aws/securityHubHub.js +28 -0
- package/dist/lib/config/aws/securityServicesAdmin.d.ts +20 -0
- package/dist/lib/config/aws/securityServicesAdmin.js +115 -0
- package/dist/lib/config/index.d.ts +2 -2
- package/dist/lib/config/index.js +2 -21
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +5 -26
- package/dist/lib/patterns/aws/account.d.ts +17 -1
- package/dist/lib/patterns/aws/account.js +61 -33
- package/dist/lib/patterns/aws/apexDomainPattern.d.ts +26 -0
- package/dist/lib/patterns/aws/apexDomainPattern.js +91 -0
- package/dist/lib/patterns/aws/auditRole.js +13 -16
- package/dist/lib/patterns/aws/buildkite.d.ts +1 -1
- package/dist/lib/patterns/aws/buildkite.js +70 -75
- package/dist/lib/patterns/aws/cdn.d.ts +5 -5
- package/dist/lib/patterns/aws/cdn.js +22 -28
- package/dist/lib/patterns/aws/compute.d.ts +1 -1
- package/dist/lib/patterns/aws/compute.js +31 -44
- package/dist/lib/patterns/aws/computeEc2.d.ts +1 -1
- package/dist/lib/patterns/aws/computeEc2.js +11 -14
- package/dist/lib/patterns/aws/computeEcs.d.ts +18 -2
- package/dist/lib/patterns/aws/computeEcs.js +41 -31
- package/dist/lib/patterns/aws/computeLambda.d.ts +2 -2
- package/dist/lib/patterns/aws/computeLambda.js +24 -31
- package/dist/lib/patterns/aws/database.d.ts +16 -7
- package/dist/lib/patterns/aws/database.js +81 -73
- package/dist/lib/patterns/aws/delegatedDomainPattern.d.ts +17 -0
- package/dist/lib/patterns/aws/delegatedDomainPattern.js +54 -0
- package/dist/lib/patterns/aws/dnsRecordComposer.d.ts +25 -0
- package/dist/lib/patterns/aws/dnsRecordComposer.js +225 -0
- package/dist/lib/patterns/aws/domain.d.ts +32 -0
- package/dist/lib/patterns/aws/domain.js +115 -0
- package/dist/lib/patterns/aws/domainDelegation.d.ts +3 -3
- package/dist/lib/patterns/aws/domainDelegation.js +28 -37
- package/dist/lib/patterns/aws/domainFactory.d.ts +20 -5
- package/dist/lib/patterns/aws/domainFactory.js +48 -10
- package/dist/lib/patterns/aws/domainValidation.d.ts +11 -0
- package/dist/lib/patterns/aws/domainValidation.js +145 -0
- package/dist/lib/patterns/aws/externalRecordsPattern.d.ts +18 -0
- package/dist/lib/patterns/aws/externalRecordsPattern.js +141 -0
- package/dist/lib/patterns/aws/fivetranProxy.d.ts +1 -1
- package/dist/lib/patterns/aws/fivetranProxy.js +6 -11
- package/dist/lib/patterns/aws/index.d.ts +21 -19
- package/dist/lib/patterns/aws/index.js +25 -36
- package/dist/lib/patterns/aws/interfaces/cdn.js +1 -5
- package/dist/lib/patterns/aws/interfaces/compute.js +4 -11
- package/dist/lib/patterns/aws/interfaces/connector.js +1 -15
- package/dist/lib/patterns/aws/interfaces/database.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/database.js +6 -15
- package/dist/lib/patterns/aws/interfaces/domain.d.ts +80 -2
- package/dist/lib/patterns/aws/interfaces/domain.js +1 -6
- package/dist/lib/patterns/aws/interfaces/index.js +8 -41
- package/dist/lib/patterns/aws/interfaces/messaging.js +4 -11
- package/dist/lib/patterns/aws/interfaces/organisation.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/organisation.js +4 -11
- package/dist/lib/patterns/aws/interfaces/pattern.js +2 -7
- package/dist/lib/patterns/aws/interfaces/storage.js +1 -5
- package/dist/lib/patterns/aws/managedIdentityCenter.js +7 -12
- package/dist/lib/patterns/aws/messaging.d.ts +7 -7
- package/dist/lib/patterns/aws/messaging.js +22 -33
- package/dist/lib/patterns/aws/network.d.ts +2 -2
- package/dist/lib/patterns/aws/network.js +9 -14
- package/dist/lib/patterns/aws/organisation.d.ts +6 -2
- package/dist/lib/patterns/aws/organisation.js +34 -35
- package/dist/lib/patterns/aws/organisationFactory.d.ts +3 -3
- package/dist/lib/patterns/aws/organisationFactory.js +7 -12
- package/dist/lib/patterns/aws/pattern.js +6 -12
- package/dist/lib/patterns/aws/payload.js +73 -63
- package/dist/lib/patterns/aws/platform.d.ts +6 -3
- package/dist/lib/patterns/aws/platform.js +15 -15
- package/dist/lib/patterns/aws/storage.d.ts +6 -4
- package/dist/lib/patterns/aws/storage.js +35 -40
- package/dist/lib/patterns/aws/subdomainHostedZone.js +11 -16
- package/dist/lib/patterns/aws/targets/fjallTargets.d.ts +37 -0
- package/dist/lib/patterns/aws/targets/fjallTargets.js +66 -0
- package/dist/lib/patterns/aws/targets/index.d.ts +2 -0
- package/dist/lib/patterns/aws/targets/index.js +2 -0
- package/dist/lib/patterns/aws/targets/targetResolution.d.ts +76 -0
- package/dist/lib/patterns/aws/targets/targetResolution.js +119 -0
- package/dist/lib/patterns/index.d.ts +1 -0
- package/dist/lib/patterns/index.js +1 -0
- package/dist/lib/resources/aws/analytics/clickhouse.d.ts +15 -0
- package/dist/lib/resources/aws/analytics/clickhouse.js +292 -0
- package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +73 -0
- package/dist/lib/resources/aws/analytics/clickhouseConstants.js +87 -0
- package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.d.ts +13 -0
- package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.js +28 -0
- package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +47 -0
- package/dist/lib/resources/aws/analytics/clickhouseTypes.js +1 -0
- package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +5 -0
- package/dist/lib/resources/aws/analytics/clickhouseUserData.js +248 -0
- package/dist/lib/resources/aws/analytics/index.d.ts +2 -0
- package/dist/lib/resources/aws/analytics/index.js +1 -0
- package/dist/lib/resources/aws/audit/auditRole.js +10 -15
- package/dist/lib/resources/aws/audit/index.d.ts +1 -1
- package/dist/lib/resources/aws/audit/index.js +1 -6
- package/dist/lib/resources/aws/backup/backupPlan.d.ts +1 -1
- package/dist/lib/resources/aws/backup/backupPlan.js +14 -16
- package/dist/lib/resources/aws/backup/backupVault.d.ts +1 -1
- package/dist/lib/resources/aws/backup/backupVault.js +13 -15
- package/dist/lib/resources/aws/backup/index.d.ts +2 -2
- package/dist/lib/resources/aws/backup/index.js +2 -19
- package/dist/lib/resources/aws/base/awsStack.js +17 -19
- package/dist/lib/resources/aws/base/index.d.ts +1 -1
- package/dist/lib/resources/aws/base/index.js +1 -18
- package/dist/lib/resources/aws/cdn/cloudFront.js +40 -42
- package/dist/lib/resources/aws/cdn/index.d.ts +1 -1
- package/dist/lib/resources/aws/cdn/index.js +1 -18
- package/dist/lib/resources/aws/compute/ec2.js +39 -39
- package/dist/lib/resources/aws/compute/ecs.d.ts +18 -396
- package/dist/lib/resources/aws/compute/ecs.js +105 -976
- package/dist/lib/resources/aws/compute/ecsCapacityProviderAspect.d.ts +22 -0
- package/dist/lib/resources/aws/compute/ecsCapacityProviderAspect.js +35 -0
- package/dist/lib/resources/aws/compute/ecsConstants.d.ts +20 -0
- package/dist/lib/resources/aws/compute/ecsConstants.js +49 -0
- package/dist/lib/resources/aws/compute/ecsContext.d.ts +12 -0
- package/dist/lib/resources/aws/compute/ecsContext.js +1 -0
- package/dist/lib/resources/aws/compute/ecsImages.d.ts +4 -0
- package/dist/lib/resources/aws/compute/ecsImages.js +35 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +28 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.js +290 -0
- package/dist/lib/resources/aws/compute/ecsRoles.d.ts +15 -0
- package/dist/lib/resources/aws/compute/ecsRoles.js +110 -0
- package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +33 -0
- package/dist/lib/resources/aws/compute/ecsServiceFactory.js +183 -0
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +30 -0
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +168 -0
- package/dist/lib/resources/aws/compute/ecsTypes.d.ts +337 -0
- package/dist/lib/resources/aws/compute/ecsTypes.js +10 -0
- package/dist/lib/resources/aws/compute/ecsValidation.d.ts +18 -0
- package/dist/lib/resources/aws/compute/ecsValidation.js +72 -0
- package/dist/lib/resources/aws/compute/index.d.ts +3 -3
- package/dist/lib/resources/aws/compute/index.js +3 -20
- package/dist/lib/resources/aws/compute/lambda.d.ts +10 -2
- package/dist/lib/resources/aws/compute/lambda.js +82 -70
- package/dist/lib/resources/aws/database/dynamodb.js +27 -28
- package/dist/lib/resources/aws/database/index.d.ts +7 -7
- package/dist/lib/resources/aws/database/index.js +14 -33
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +10 -2
- package/dist/lib/resources/aws/database/rdsAurora.js +76 -61
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +2 -2
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +24 -21
- package/dist/lib/resources/aws/database/rdsDefaults.js +3 -7
- package/dist/lib/resources/aws/database/rdsHelpers.d.ts +2 -2
- package/dist/lib/resources/aws/database/rdsHelpers.js +21 -29
- package/dist/lib/resources/aws/database/rdsInstance.d.ts +11 -3
- package/dist/lib/resources/aws/database/rdsInstance.js +101 -83
- package/dist/lib/resources/aws/database/rdsProxyOutput.js +5 -9
- package/dist/lib/resources/aws/iam/delegationRole.d.ts +18 -0
- package/dist/lib/resources/aws/iam/delegationRole.js +60 -0
- package/dist/lib/resources/aws/iam/identityCenter/assignment.js +4 -9
- package/dist/lib/resources/aws/iam/identityCenter/group.js +5 -9
- package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +3 -3
- package/dist/lib/resources/aws/iam/identityCenter/index.js +3 -20
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -1
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +5 -9
- package/dist/lib/resources/aws/iam/index.d.ts +5 -4
- package/dist/lib/resources/aws/iam/index.js +5 -21
- package/dist/lib/resources/aws/iam/instanceProfile.js +2 -7
- package/dist/lib/resources/aws/iam/managedPolicy.js +2 -7
- package/dist/lib/resources/aws/iam/policy.js +2 -7
- package/dist/lib/resources/aws/iam/role.js +2 -7
- package/dist/lib/resources/aws/index.d.ts +7 -7
- package/dist/lib/resources/aws/index.js +7 -24
- package/dist/lib/resources/aws/logging/cloudTrail.d.ts +1 -1
- package/dist/lib/resources/aws/logging/cloudTrail.js +18 -22
- package/dist/lib/resources/aws/logging/index.d.ts +2 -2
- package/dist/lib/resources/aws/logging/index.js +2 -19
- package/dist/lib/resources/aws/logging/logGroup.js +4 -10
- package/dist/lib/resources/aws/messaging/eventbridge.js +11 -14
- package/dist/lib/resources/aws/messaging/index.d.ts +4 -4
- package/dist/lib/resources/aws/messaging/index.js +4 -21
- package/dist/lib/resources/aws/messaging/sns.js +11 -14
- package/dist/lib/resources/aws/messaging/sqs.js +32 -34
- package/dist/lib/resources/aws/messaging/utils.d.ts +1 -1
- package/dist/lib/resources/aws/messaging/utils.js +1 -6
- package/dist/lib/resources/aws/monitoring/alarmDefaults.d.ts +36 -0
- package/dist/lib/resources/aws/monitoring/alarmDefaults.js +34 -0
- package/dist/lib/resources/aws/monitoring/ecsAlarms.d.ts +21 -0
- package/dist/lib/resources/aws/monitoring/ecsAlarms.js +88 -0
- package/dist/lib/resources/aws/monitoring/index.d.ts +4 -0
- package/dist/lib/resources/aws/monitoring/index.js +4 -5
- package/dist/lib/resources/aws/monitoring/lambdaAlarms.d.ts +18 -0
- package/dist/lib/resources/aws/monitoring/lambdaAlarms.js +44 -0
- package/dist/lib/resources/aws/monitoring/rdsAlarms.d.ts +20 -0
- package/dist/lib/resources/aws/monitoring/rdsAlarms.js +52 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.d.ts +17 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +26 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.js +22 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.js +23 -0
- package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.d.ts +17 -0
- package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.js +22 -0
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.d.ts +17 -0
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +17 -0
- package/dist/lib/resources/aws/networking/dnsRecord/index.d.ts +10 -0
- package/dist/lib/resources/aws/networking/dnsRecord/index.js +10 -0
- package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.d.ts +16 -0
- package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.d.ts +18 -0
- package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.js +21 -0
- package/dist/lib/resources/aws/networking/domain.d.ts +1 -1
- package/dist/lib/resources/aws/networking/domain.js +32 -34
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +8 -3
- package/dist/lib/resources/aws/networking/domainCertificate.js +22 -16
- package/dist/lib/resources/aws/networking/hostedZone.d.ts +23 -19
- package/dist/lib/resources/aws/networking/hostedZone.js +70 -134
- package/dist/lib/resources/aws/networking/index.d.ts +8 -7
- package/dist/lib/resources/aws/networking/index.js +8 -24
- package/dist/lib/resources/aws/networking/ipam.js +2 -7
- package/dist/lib/resources/aws/networking/ipamPool.d.ts +1 -1
- package/dist/lib/resources/aws/networking/ipamPool.js +45 -55
- package/dist/lib/resources/aws/networking/securityGroup.js +2 -7
- package/dist/lib/resources/aws/networking/vpc.d.ts +1 -1
- package/dist/lib/resources/aws/networking/vpc.js +17 -21
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +1 -1
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +11 -15
- package/dist/lib/resources/aws/organisation/index.d.ts +5 -5
- package/dist/lib/resources/aws/organisation/index.js +4 -12
- package/dist/lib/resources/aws/organisation/organisation.js +5 -7
- package/dist/lib/resources/aws/organisation/organisationAccount.js +7 -10
- package/dist/lib/resources/aws/organisation/organisationPolicy.js +5 -9
- package/dist/lib/resources/aws/organisation/organisationalUnit.js +1 -3
- package/dist/lib/resources/aws/secrets/alias.js +2 -7
- package/dist/lib/resources/aws/secrets/index.d.ts +4 -4
- package/dist/lib/resources/aws/secrets/index.js +4 -21
- package/dist/lib/resources/aws/secrets/kms.js +15 -18
- package/dist/lib/resources/aws/secrets/parameter.d.ts +3 -3
- package/dist/lib/resources/aws/secrets/parameter.js +19 -22
- package/dist/lib/resources/aws/secrets/secret.d.ts +2 -2
- package/dist/lib/resources/aws/secrets/secret.js +12 -14
- package/dist/lib/resources/aws/storage/ecr.d.ts +2 -2
- package/dist/lib/resources/aws/storage/ecr.js +7 -13
- package/dist/lib/resources/aws/storage/index.d.ts +2 -2
- package/dist/lib/resources/aws/storage/index.js +2 -19
- package/dist/lib/resources/aws/storage/s3.d.ts +1 -1
- package/dist/lib/resources/aws/storage/s3.js +24 -12
- package/dist/lib/resources/aws/utilities/awsCustomResource.js +3 -7
- package/dist/lib/resources/aws/utilities/codeBuild.js +7 -12
- package/dist/lib/resources/aws/utilities/customResource.js +14 -17
- package/dist/lib/resources/aws/utilities/customResourceProvider.js +2 -7
- package/dist/lib/resources/aws/utilities/index.d.ts +5 -5
- package/dist/lib/resources/aws/utilities/index.js +5 -22
- package/dist/lib/resources/aws/utilities/resourceShare.js +2 -7
- package/dist/lib/resources/index.d.ts +1 -1
- package/dist/lib/resources/index.js +1 -18
- package/dist/lib/types.js +1 -3
- package/dist/lib/utils/accountsUtils.d.ts +5 -0
- package/dist/lib/utils/accountsUtils.js +18 -0
- package/dist/lib/utils/addSuffixToEmail.js +1 -5
- package/dist/lib/utils/backupTierMapping.js +2 -6
- package/dist/lib/utils/capitaliseString.js +1 -10
- package/dist/lib/utils/connections.js +9 -13
- package/dist/lib/utils/connector.js +10 -23
- package/dist/lib/utils/constructMap.d.ts +33 -0
- package/dist/lib/utils/constructMap.js +154 -0
- package/dist/lib/utils/databaseTypes.js +4 -10
- package/dist/lib/utils/dnsRecords.d.ts +1 -1
- package/dist/lib/utils/dnsRecords.js +23 -27
- package/dist/lib/utils/domainTypes.d.ts +0 -1
- package/dist/lib/utils/domainTypes.js +2 -10
- package/dist/lib/utils/env.js +14 -26
- package/dist/lib/utils/getAccountId.js +3 -7
- package/dist/lib/utils/getAsync.js +7 -10
- package/dist/lib/utils/getConfig.d.ts +0 -2
- package/dist/lib/utils/getConfig.js +29 -47
- package/dist/lib/utils/getStackOutput.js +4 -8
- package/dist/lib/utils/index.d.ts +12 -12
- package/dist/lib/utils/index.js +12 -29
- package/dist/lib/utils/manifestWriter.d.ts +14 -3
- package/dist/lib/utils/manifestWriter.js +60 -43
- package/dist/lib/utils/orgConfigParser.d.ts +14 -0
- package/dist/lib/utils/orgConfigParser.js +49 -0
- package/dist/lib/utils/removalPolicy.js +5 -9
- package/dist/lib/utils/resourceNaming.js +11 -16
- package/dist/lib/utils/standardTagsAspect.js +9 -16
- package/dist/lib/utils/stripAndCamelCase.js +1 -5
- package/dist/lib/utils/validationLogger.js +12 -18
- package/dist/lib/utils/vpcUtils.js +5 -10
- package/package.json +25 -8
- package/dist/lib/config/aws/accountId.d.ts +0 -6
- package/dist/lib/config/aws/accountId.js +0 -32
- package/dist/lib/config/aws/backupGlobalSettings.d.ts +0 -29
- package/dist/lib/config/aws/backupGlobalSettings.js +0 -49
- package/dist/lib/config/aws/costAllocationTags.d.ts +0 -12
- package/dist/lib/config/aws/costAllocationTags.js +0 -47
- package/dist/lib/config/aws/ipamDelegateAdmin.d.ts +0 -8
- package/dist/lib/config/aws/ipamDelegateAdmin.js +0 -57
- package/dist/lib/config/aws/ipamPoolId.d.ts +0 -16
- package/dist/lib/config/aws/ipamPoolId.js +0 -42
- package/dist/lib/config/aws/organisation.d.ts +0 -30
- package/dist/lib/config/aws/organisation.js +0 -92
- package/dist/lib/config/aws/organisationId.d.ts +0 -7
- package/dist/lib/config/aws/organisationId.js +0 -45
- package/dist/lib/config/aws/organisationsAccess.d.ts +0 -10
- package/dist/lib/config/aws/organisationsAccess.js +0 -49
- package/dist/lib/config/aws/ramSharing.d.ts +0 -4
- package/dist/lib/config/aws/ramSharing.js +0 -34
- package/dist/lib/config/monitoring.d.ts +0 -18
- package/dist/lib/config/monitoring.js +0 -22
- package/dist/lib/patterns/aws/connections.d.ts +0 -46
- package/dist/lib/patterns/aws/connections.js +0 -159
- package/dist/lib/patterns/aws/hostedZone.d.ts +0 -28
- package/dist/lib/patterns/aws/hostedZone.js +0 -150
- package/dist/lib/patterns/aws/managedAccount.d.ts +0 -9
- package/dist/lib/patterns/aws/managedAccount.js +0 -55
- package/dist/lib/patterns/aws/managedOrganisation.d.ts +0 -36
- package/dist/lib/patterns/aws/managedOrganisation.js +0 -97
- package/dist/lib/patterns/aws/managedPlatform.d.ts +0 -12
- package/dist/lib/patterns/aws/managedPlatform.js +0 -29
- package/dist/lib/resources/aws/database/database.d.ts +0 -14
- package/dist/lib/resources/aws/database/database.js +0 -28
- package/dist/lib/resources/aws/database/databaseInstance.d.ts +0 -15
- package/dist/lib/resources/aws/database/databaseInstance.js +0 -30
- package/dist/lib/resources/aws/database/migrationLambda.d.ts +0 -80
- package/dist/lib/resources/aws/database/migrationLambda.js +0 -119
- package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.d.ts +0 -13
- package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.js +0 -51
- package/dist/lib/resources/aws/iam/securityGroup.d.ts +0 -5
- package/dist/lib/resources/aws/iam/securityGroup.js +0 -14
- package/dist/lib/resources/aws/monitoring/monitoringRole.d.ts +0 -29
- package/dist/lib/resources/aws/monitoring/monitoringRole.js +0 -120
- package/dist/lib/utils/capitalizeString.d.ts +0 -12
- package/dist/lib/utils/capitalizeString.js +0 -30
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import { OrganisationPolicy } from "../../resources/aws/organisation/organisationPolicy.js";
|
|
3
|
+
const EXEMPT_ROLE_PATTERNS = [
|
|
4
|
+
"arn:aws:iam::*:role/FjallDeploy*",
|
|
5
|
+
"arn:aws:iam::*:role/OrganizationAccountAccessRole"
|
|
6
|
+
];
|
|
7
|
+
const SCP_BYTE_LIMIT = 5120;
|
|
8
|
+
const IAM_POLICY_VERSION = "2012-10-17";
|
|
9
|
+
const SCP_POLICY_TYPE = "SERVICE_CONTROL_POLICY";
|
|
10
|
+
function automationExemption() {
|
|
11
|
+
return {
|
|
12
|
+
ArnNotLike: {
|
|
13
|
+
"aws:PrincipalArn": EXEMPT_ROLE_PATTERNS
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function buildFoundationGuardrails(allowedRegions) {
|
|
18
|
+
return {
|
|
19
|
+
Version: IAM_POLICY_VERSION,
|
|
20
|
+
Statement: [
|
|
21
|
+
{
|
|
22
|
+
Sid: "DenyRootUserActions",
|
|
23
|
+
Effect: "Deny",
|
|
24
|
+
Action: "*",
|
|
25
|
+
Resource: "*",
|
|
26
|
+
Condition: {
|
|
27
|
+
StringLike: {
|
|
28
|
+
"aws:PrincipalArn": "arn:aws:iam::*:root"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
Sid: "DenyLeaveOrganisation",
|
|
34
|
+
Effect: "Deny",
|
|
35
|
+
Action: "organizations:LeaveOrganization",
|
|
36
|
+
Resource: "*",
|
|
37
|
+
Condition: automationExemption()
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
Sid: "DenyOutsideAllowedRegions",
|
|
41
|
+
Effect: "Deny",
|
|
42
|
+
NotAction: [
|
|
43
|
+
"iam:*",
|
|
44
|
+
"sts:*",
|
|
45
|
+
"cloudfront:*",
|
|
46
|
+
"route53:*",
|
|
47
|
+
"organizations:*",
|
|
48
|
+
"support:*",
|
|
49
|
+
"budgets:*",
|
|
50
|
+
"ce:*",
|
|
51
|
+
"waf:*",
|
|
52
|
+
"wafv2:*",
|
|
53
|
+
"globalaccelerator:*",
|
|
54
|
+
"health:*",
|
|
55
|
+
"account:*",
|
|
56
|
+
"tag:*",
|
|
57
|
+
"trustedadvisor:*"
|
|
58
|
+
],
|
|
59
|
+
Resource: "*",
|
|
60
|
+
Condition: {
|
|
61
|
+
StringNotEquals: {
|
|
62
|
+
"aws:RequestedRegion": allowedRegions
|
|
63
|
+
},
|
|
64
|
+
...automationExemption()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function buildSecurityProtection() {
|
|
71
|
+
return {
|
|
72
|
+
Version: IAM_POLICY_VERSION,
|
|
73
|
+
Statement: [
|
|
74
|
+
{
|
|
75
|
+
Sid: "ProtectCloudTrail",
|
|
76
|
+
Effect: "Deny",
|
|
77
|
+
Action: [
|
|
78
|
+
"cloudtrail:DeleteTrail",
|
|
79
|
+
"cloudtrail:StopLogging",
|
|
80
|
+
"cloudtrail:UpdateTrail",
|
|
81
|
+
"cloudtrail:PutEventSelectors"
|
|
82
|
+
],
|
|
83
|
+
Resource: "*",
|
|
84
|
+
Condition: automationExemption()
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
Sid: "ProtectConfig",
|
|
88
|
+
Effect: "Deny",
|
|
89
|
+
Action: [
|
|
90
|
+
"config:DeleteConfigurationRecorder",
|
|
91
|
+
"config:DeleteDeliveryChannel",
|
|
92
|
+
"config:DeleteRetentionConfiguration",
|
|
93
|
+
"config:StopConfigurationRecorder"
|
|
94
|
+
],
|
|
95
|
+
Resource: "*",
|
|
96
|
+
Condition: automationExemption()
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
Sid: "ProtectGuardDuty",
|
|
100
|
+
Effect: "Deny",
|
|
101
|
+
Action: [
|
|
102
|
+
"guardduty:DeleteDetector",
|
|
103
|
+
"guardduty:DisassociateFromMasterAccount",
|
|
104
|
+
"guardduty:DisassociateMembers",
|
|
105
|
+
"guardduty:StopMonitoringMembers"
|
|
106
|
+
],
|
|
107
|
+
Resource: "*",
|
|
108
|
+
Condition: automationExemption()
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
Sid: "ProtectSecurityHub",
|
|
112
|
+
Effect: "Deny",
|
|
113
|
+
Action: [
|
|
114
|
+
"securityhub:DisableSecurityHub",
|
|
115
|
+
"securityhub:DeleteMembers",
|
|
116
|
+
"securityhub:DisassociateMembers"
|
|
117
|
+
],
|
|
118
|
+
Resource: "*",
|
|
119
|
+
Condition: automationExemption()
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
Sid: "ProtectVpcFlowLogs",
|
|
123
|
+
Effect: "Deny",
|
|
124
|
+
Action: ["ec2:DeleteFlowLogs"],
|
|
125
|
+
Resource: "*",
|
|
126
|
+
Condition: automationExemption()
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
Sid: "ProtectKmsKeys",
|
|
130
|
+
Effect: "Deny",
|
|
131
|
+
Action: ["kms:ScheduleKeyDeletion"],
|
|
132
|
+
Resource: "*",
|
|
133
|
+
Condition: automationExemption()
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function buildEncryptionAndAccess() {
|
|
139
|
+
return {
|
|
140
|
+
Version: IAM_POLICY_VERSION,
|
|
141
|
+
Statement: [
|
|
142
|
+
{
|
|
143
|
+
Sid: "EnforceEbsEncryption",
|
|
144
|
+
Effect: "Deny",
|
|
145
|
+
Action: "ec2:RunInstances",
|
|
146
|
+
Resource: "arn:aws:ec2:*:*:volume/*",
|
|
147
|
+
Condition: {
|
|
148
|
+
Bool: { "ec2:Encrypted": "false" }
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
Sid: "EnforceRdsEncryption",
|
|
153
|
+
Effect: "Deny",
|
|
154
|
+
Action: ["rds:CreateDBInstance", "rds:CreateDBCluster"],
|
|
155
|
+
Resource: "*",
|
|
156
|
+
Condition: {
|
|
157
|
+
Bool: { "rds:StorageEncrypted": "false" }
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
Sid: "EnforceS3Encryption",
|
|
162
|
+
Effect: "Deny",
|
|
163
|
+
Action: "s3:PutObject",
|
|
164
|
+
Resource: "*",
|
|
165
|
+
Condition: {
|
|
166
|
+
StringNotEquals: {
|
|
167
|
+
"s3:x-amz-server-side-encryption": ["AES256", "aws:kms"]
|
|
168
|
+
},
|
|
169
|
+
Null: { "s3:x-amz-server-side-encryption": "false" }
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
Sid: "DenyDisableEbsDefaultEncryption",
|
|
174
|
+
Effect: "Deny",
|
|
175
|
+
Action: "ec2:DisableEbsEncryptionByDefault",
|
|
176
|
+
Resource: "*"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
Sid: "DenyS3PublicAccessChanges",
|
|
180
|
+
Effect: "Deny",
|
|
181
|
+
Action: [
|
|
182
|
+
"s3:PutBucketPublicAccessBlock",
|
|
183
|
+
"s3:PutAccountPublicAccessBlock"
|
|
184
|
+
],
|
|
185
|
+
Resource: "*",
|
|
186
|
+
Condition: automationExemption()
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
Sid: "EnforceImdsV2",
|
|
190
|
+
Effect: "Deny",
|
|
191
|
+
Action: "ec2:RunInstances",
|
|
192
|
+
Resource: "arn:aws:ec2:*:*:instance/*",
|
|
193
|
+
Condition: {
|
|
194
|
+
StringNotEquals: { "ec2:MetadataHttpTokens": "required" }
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
Sid: "DenyIamUserCreation",
|
|
199
|
+
Effect: "Deny",
|
|
200
|
+
Action: [
|
|
201
|
+
"iam:CreateUser",
|
|
202
|
+
"iam:CreateAccessKey",
|
|
203
|
+
"iam:CreateLoginProfile"
|
|
204
|
+
],
|
|
205
|
+
Resource: "*",
|
|
206
|
+
Condition: automationExemption()
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function buildCostControls() {
|
|
212
|
+
return {
|
|
213
|
+
Version: IAM_POLICY_VERSION,
|
|
214
|
+
Statement: [
|
|
215
|
+
{
|
|
216
|
+
Sid: "DenyExpensiveEc2Instances",
|
|
217
|
+
Effect: "Deny",
|
|
218
|
+
Action: "ec2:RunInstances",
|
|
219
|
+
Resource: "arn:aws:ec2:*:*:instance/*",
|
|
220
|
+
Condition: {
|
|
221
|
+
StringNotLike: {
|
|
222
|
+
"ec2:InstanceType": ["t3.*", "t3a.*", "t4g.*"]
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
Sid: "DenyExpensiveRdsInstances",
|
|
228
|
+
Effect: "Deny",
|
|
229
|
+
Action: [
|
|
230
|
+
"rds:CreateDBInstance",
|
|
231
|
+
"rds:CreateDBCluster",
|
|
232
|
+
"rds:ModifyDBInstance",
|
|
233
|
+
"rds:ModifyDBCluster"
|
|
234
|
+
],
|
|
235
|
+
Resource: "*",
|
|
236
|
+
Condition: {
|
|
237
|
+
StringNotLike: {
|
|
238
|
+
"rds:DatabaseClass": ["db.t3.*", "db.t4g.*"]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function validateByteLimit(name, policy) {
|
|
246
|
+
const json = JSON.stringify(policy);
|
|
247
|
+
const byteLength = Buffer.byteLength(json, "utf-8");
|
|
248
|
+
if (byteLength > SCP_BYTE_LIMIT) {
|
|
249
|
+
throw new Error(`SCP "${name}" exceeds ${SCP_BYTE_LIMIT}-byte limit: ${byteLength} bytes`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Creates a set of Service Control Policies (SCPs) based on a preset level.
|
|
254
|
+
*
|
|
255
|
+
* Standard preset: 3 root-level SCPs (FoundationGuardrails, SecurityProtection, EncryptionAndAccess).
|
|
256
|
+
* Hardened preset: 3 root + per-OU cost controls for development environments.
|
|
257
|
+
*
|
|
258
|
+
* All deny statements (except DenyRootUser) exempt automation roles to prevent deployment lockout.
|
|
259
|
+
*/
|
|
260
|
+
export class ScpPreset extends Construct {
|
|
261
|
+
constructor(scope, id, props) {
|
|
262
|
+
super(scope, id);
|
|
263
|
+
this.createRootScps(props.rootId, props.allowedRegions);
|
|
264
|
+
if (props.preset === "hardened" && props.organisationalUnitIds) {
|
|
265
|
+
this.createHardenedScps(props.organisationalUnitIds);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
createRootScps(rootId, allowedRegions) {
|
|
269
|
+
const foundationPolicy = buildFoundationGuardrails(allowedRegions);
|
|
270
|
+
validateByteLimit("FoundationGuardrails", foundationPolicy);
|
|
271
|
+
new OrganisationPolicy(this, "FoundationGuardrails", {
|
|
272
|
+
name: "fjall-foundation-guardrails",
|
|
273
|
+
policyType: SCP_POLICY_TYPE,
|
|
274
|
+
content: foundationPolicy,
|
|
275
|
+
description: "Root user lockout, organisation leave prevention, region restriction",
|
|
276
|
+
targetIds: [rootId]
|
|
277
|
+
});
|
|
278
|
+
const securityPolicy = buildSecurityProtection();
|
|
279
|
+
validateByteLimit("SecurityProtection", securityPolicy);
|
|
280
|
+
new OrganisationPolicy(this, "SecurityProtection", {
|
|
281
|
+
name: "fjall-security-protection",
|
|
282
|
+
policyType: SCP_POLICY_TYPE,
|
|
283
|
+
content: securityPolicy,
|
|
284
|
+
description: "Protects CloudTrail, Config, GuardDuty, SecurityHub, VPC Flow Logs, and KMS keys",
|
|
285
|
+
targetIds: [rootId]
|
|
286
|
+
});
|
|
287
|
+
const encryptionPolicy = buildEncryptionAndAccess();
|
|
288
|
+
validateByteLimit("EncryptionAndAccess", encryptionPolicy);
|
|
289
|
+
new OrganisationPolicy(this, "EncryptionAndAccess", {
|
|
290
|
+
name: "fjall-encryption-and-access",
|
|
291
|
+
policyType: SCP_POLICY_TYPE,
|
|
292
|
+
content: encryptionPolicy,
|
|
293
|
+
description: "Enforces encryption for EBS, RDS, S3; blocks public access changes; requires IMDSv2; denies IAM user creation",
|
|
294
|
+
targetIds: [rootId]
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
createHardenedScps(organisationalUnitIds) {
|
|
298
|
+
const developmentOuId = organisationalUnitIds["development"];
|
|
299
|
+
if (developmentOuId) {
|
|
300
|
+
const costPolicy = buildCostControls();
|
|
301
|
+
validateByteLimit("CostControls", costPolicy);
|
|
302
|
+
new OrganisationPolicy(this, "CostControls", {
|
|
303
|
+
name: "fjall-cost-controls",
|
|
304
|
+
policyType: SCP_POLICY_TYPE,
|
|
305
|
+
content: costPolicy,
|
|
306
|
+
description: "Restricts instance types in development environments to prevent accidental spend",
|
|
307
|
+
targetIds: [developmentOuId]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
export interface SecurityBaselineProps {
|
|
3
|
+
/** Controls which services are instantiated. "off" creates nothing. */
|
|
4
|
+
level: "off" | "baseline" | "compliance";
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Convenience orchestrator for per-account security services.
|
|
8
|
+
* Instantiates child constructs based on the selected level.
|
|
9
|
+
*
|
|
10
|
+
* Does NOT include ConfigRulePreset -- Config Rules are applied independently
|
|
11
|
+
* at the Account stack level with environment-aware presets.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SecurityBaseline extends Construct {
|
|
14
|
+
constructor(scope: Construct, id: string, props: SecurityBaselineProps);
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import { GuardDutyDetector } from "./guardDutyDetector.js";
|
|
3
|
+
import { SecurityHubHub } from "./securityHubHub.js";
|
|
4
|
+
import { ConfigRecorder } from "./configRecorder.js";
|
|
5
|
+
import { AccountAccessAnalyser } from "./accessAnalyser.js";
|
|
6
|
+
import { InspectorEnablement } from "./inspectorEnablement.js";
|
|
7
|
+
/**
|
|
8
|
+
* Convenience orchestrator for per-account security services.
|
|
9
|
+
* Instantiates child constructs based on the selected level.
|
|
10
|
+
*
|
|
11
|
+
* Does NOT include ConfigRulePreset -- Config Rules are applied independently
|
|
12
|
+
* at the Account stack level with environment-aware presets.
|
|
13
|
+
*/
|
|
14
|
+
export class SecurityBaseline extends Construct {
|
|
15
|
+
constructor(scope, id, props) {
|
|
16
|
+
super(scope, id);
|
|
17
|
+
if (props.level === "off")
|
|
18
|
+
return;
|
|
19
|
+
new GuardDutyDetector(this, "GuardDuty");
|
|
20
|
+
new SecurityHubHub(this, "SecurityHub");
|
|
21
|
+
new ConfigRecorder(this, "Config");
|
|
22
|
+
new AccountAccessAnalyser(this, "AccessAnalyser");
|
|
23
|
+
if (props.level === "compliance") {
|
|
24
|
+
new InspectorEnablement(this, "Inspector");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CfnHub } from "aws-cdk-lib/aws-securityhub";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
export type SecurityHubStandard = "aws-foundational-security" | "cis-aws-foundations" | "pci-dss";
|
|
4
|
+
export interface SecurityHubHubProps {
|
|
5
|
+
/** Standards to enable. Default: ["aws-foundational-security"] */
|
|
6
|
+
standards?: SecurityHubStandard[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Per-account SecurityHub enablement with configurable compliance standards.
|
|
10
|
+
* Aggregates findings from GuardDuty, Inspector, Config, and IAM Access Analyser.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SecurityHubHub extends Construct {
|
|
13
|
+
readonly hub: CfnHub;
|
|
14
|
+
constructor(scope: Construct, id: string, props?: SecurityHubHubProps);
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Aws } from "aws-cdk-lib";
|
|
2
|
+
import { CfnHub, CfnStandard } from "aws-cdk-lib/aws-securityhub";
|
|
3
|
+
import { Construct } from "constructs";
|
|
4
|
+
const STANDARD_ARNS = {
|
|
5
|
+
"aws-foundational-security": `arn:aws:securityhub:${Aws.REGION}::standards/aws-foundational-security-best-practices/v/1.0.0`,
|
|
6
|
+
"cis-aws-foundations": `arn:aws:securityhub:${Aws.REGION}::standards/cis-aws-foundations-benchmark/v/3.0.0`,
|
|
7
|
+
"pci-dss": `arn:aws:securityhub:${Aws.REGION}::standards/pci-dss/v/4.0.0`
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Per-account SecurityHub enablement with configurable compliance standards.
|
|
11
|
+
* Aggregates findings from GuardDuty, Inspector, Config, and IAM Access Analyser.
|
|
12
|
+
*/
|
|
13
|
+
export class SecurityHubHub extends Construct {
|
|
14
|
+
hub;
|
|
15
|
+
constructor(scope, id, props) {
|
|
16
|
+
super(scope, id);
|
|
17
|
+
this.hub = new CfnHub(this, "Hub", {
|
|
18
|
+
enableDefaultStandards: false
|
|
19
|
+
});
|
|
20
|
+
const standards = props?.standards ?? ["aws-foundational-security"];
|
|
21
|
+
for (const standard of standards) {
|
|
22
|
+
const cfnStandard = new CfnStandard(this, `Standard-${standard}`, {
|
|
23
|
+
standardsArn: STANDARD_ARNS[standard]
|
|
24
|
+
});
|
|
25
|
+
cfnStandard.addDependency(this.hub);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
export type SecurityAdminService = "guardduty" | "securityhub" | "config";
|
|
3
|
+
export interface SecurityServicesAdminProps {
|
|
4
|
+
/** Services to configure for organisation-wide auto-enablement. */
|
|
5
|
+
services: SecurityAdminService[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Platform-level construct for org-wide security service configuration.
|
|
9
|
+
* Deployed in the delegated admin (platform) account.
|
|
10
|
+
*
|
|
11
|
+
* - GuardDuty: Custom Resource to auto-enable across the organisation
|
|
12
|
+
* - SecurityHub: Custom Resource to auto-enable with default standards
|
|
13
|
+
* - Config: Native CfnConfigurationAggregator for cross-account view
|
|
14
|
+
*/
|
|
15
|
+
export declare class SecurityServicesAdmin extends Construct {
|
|
16
|
+
constructor(scope: Construct, id: string, props: SecurityServicesAdminProps);
|
|
17
|
+
private createGuardDutyAdmin;
|
|
18
|
+
private createSecurityHubAdmin;
|
|
19
|
+
private createConfigAggregator;
|
|
20
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Duration } from "aws-cdk-lib";
|
|
2
|
+
import { CfnConfigurationAggregator } from "aws-cdk-lib/aws-config";
|
|
3
|
+
import { Role, ServicePrincipal, ManagedPolicy, PolicyStatement, Effect } from "aws-cdk-lib/aws-iam";
|
|
4
|
+
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
5
|
+
import { Construct } from "constructs";
|
|
6
|
+
import { CustomResource } from "../../resources/aws/utilities/customResource.js";
|
|
7
|
+
/**
|
|
8
|
+
* Platform-level construct for org-wide security service configuration.
|
|
9
|
+
* Deployed in the delegated admin (platform) account.
|
|
10
|
+
*
|
|
11
|
+
* - GuardDuty: Custom Resource to auto-enable across the organisation
|
|
12
|
+
* - SecurityHub: Custom Resource to auto-enable with default standards
|
|
13
|
+
* - Config: Native CfnConfigurationAggregator for cross-account view
|
|
14
|
+
*/
|
|
15
|
+
export class SecurityServicesAdmin extends Construct {
|
|
16
|
+
constructor(scope, id, props) {
|
|
17
|
+
super(scope, id);
|
|
18
|
+
for (const service of props.services) {
|
|
19
|
+
switch (service) {
|
|
20
|
+
case "guardduty":
|
|
21
|
+
this.createGuardDutyAdmin();
|
|
22
|
+
break;
|
|
23
|
+
case "securityhub":
|
|
24
|
+
this.createSecurityHubAdmin();
|
|
25
|
+
break;
|
|
26
|
+
case "config":
|
|
27
|
+
this.createConfigAggregator();
|
|
28
|
+
break;
|
|
29
|
+
default: {
|
|
30
|
+
const _exhaustive = service;
|
|
31
|
+
throw new Error(`Unsupported security admin service: ${String(_exhaustive)}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
createGuardDutyAdmin() {
|
|
37
|
+
new CustomResource(this, "GuardDutyOrgConfig", {
|
|
38
|
+
runtime: Runtime.NODEJS_22_X,
|
|
39
|
+
timeout: Duration.minutes(5),
|
|
40
|
+
lambdaDescription: "Configures GuardDuty organisation-wide auto-enablement",
|
|
41
|
+
inlinePolicy: [
|
|
42
|
+
new PolicyStatement({
|
|
43
|
+
effect: Effect.ALLOW,
|
|
44
|
+
actions: [
|
|
45
|
+
"guardduty:UpdateOrganizationConfiguration",
|
|
46
|
+
"guardduty:ListDetectors"
|
|
47
|
+
],
|
|
48
|
+
resources: ["*"]
|
|
49
|
+
})
|
|
50
|
+
],
|
|
51
|
+
inlineCode: `
|
|
52
|
+
const { GuardDutyClient, ListDetectorsCommand, UpdateOrganizationConfigurationCommand } = require('@aws-sdk/client-guardduty');
|
|
53
|
+
|
|
54
|
+
exports.handler = async (event) => {
|
|
55
|
+
const physicalResourceId = event.PhysicalResourceId || event.LogicalResourceId || 'guardduty-org-config';
|
|
56
|
+
if (event.RequestType === 'Delete') {
|
|
57
|
+
return { PhysicalResourceId: physicalResourceId };
|
|
58
|
+
}
|
|
59
|
+
const client = new GuardDutyClient({});
|
|
60
|
+
const detectors = await client.send(new ListDetectorsCommand({}));
|
|
61
|
+
const detectorId = (detectors.DetectorIds || [])[0];
|
|
62
|
+
if (!detectorId) throw new Error('No GuardDuty detector found in delegated admin account');
|
|
63
|
+
await client.send(new UpdateOrganizationConfigurationCommand({
|
|
64
|
+
DetectorId: detectorId,
|
|
65
|
+
AutoEnableOrganizationMembers: 'ALL',
|
|
66
|
+
}));
|
|
67
|
+
return { PhysicalResourceId: physicalResourceId };
|
|
68
|
+
};`
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
createSecurityHubAdmin() {
|
|
72
|
+
new CustomResource(this, "SecurityHubOrgConfig", {
|
|
73
|
+
runtime: Runtime.NODEJS_22_X,
|
|
74
|
+
timeout: Duration.minutes(5),
|
|
75
|
+
lambdaDescription: "Configures SecurityHub organisation-wide auto-enablement",
|
|
76
|
+
inlinePolicy: [
|
|
77
|
+
new PolicyStatement({
|
|
78
|
+
effect: Effect.ALLOW,
|
|
79
|
+
actions: ["securityhub:UpdateOrganizationConfiguration"],
|
|
80
|
+
resources: ["*"]
|
|
81
|
+
})
|
|
82
|
+
],
|
|
83
|
+
inlineCode: `
|
|
84
|
+
const { SecurityHubClient, UpdateOrganizationConfigurationCommand } = require('@aws-sdk/client-securityhub');
|
|
85
|
+
|
|
86
|
+
exports.handler = async (event) => {
|
|
87
|
+
const physicalResourceId = event.PhysicalResourceId || event.LogicalResourceId || 'securityhub-org-config';
|
|
88
|
+
if (event.RequestType === 'Delete') {
|
|
89
|
+
return { PhysicalResourceId: physicalResourceId };
|
|
90
|
+
}
|
|
91
|
+
const client = new SecurityHubClient({});
|
|
92
|
+
await client.send(new UpdateOrganizationConfigurationCommand({
|
|
93
|
+
AutoEnableOrganizationMembers: 'ALL',
|
|
94
|
+
AutoEnableStandards: 'NONE',
|
|
95
|
+
}));
|
|
96
|
+
return { PhysicalResourceId: physicalResourceId };
|
|
97
|
+
};`
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
createConfigAggregator() {
|
|
101
|
+
const aggregatorRole = new Role(this, "ConfigAggregatorRole", {
|
|
102
|
+
assumedBy: new ServicePrincipal("config.amazonaws.com"),
|
|
103
|
+
managedPolicies: [
|
|
104
|
+
ManagedPolicy.fromAwsManagedPolicyName("service-role/AWSConfigRoleForOrganizations")
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
new CfnConfigurationAggregator(this, "ConfigAggregator", {
|
|
108
|
+
configurationAggregatorName: "FjallOrganisationAggregator",
|
|
109
|
+
organizationAggregationSource: {
|
|
110
|
+
roleArn: aggregatorRole.roleArn,
|
|
111
|
+
allAwsRegions: true
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { FJALL_AUDIT_CONFIG } from "./audit";
|
|
2
|
-
export * from "./aws";
|
|
1
|
+
export { FJALL_AUDIT_CONFIG } from "./audit.js";
|
|
2
|
+
export * from "./aws/index.js";
|
package/dist/lib/config/index.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.FJALL_AUDIT_CONFIG = void 0;
|
|
18
|
-
var audit_1 = require("./audit");
|
|
19
|
-
Object.defineProperty(exports, "FJALL_AUDIT_CONFIG", { enumerable: true, get: function () { return audit_1.FJALL_AUDIT_CONFIG; } });
|
|
20
|
-
__exportStar(require("./aws"), exports);
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvY29uZmlnL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsaUNBQTZDO0FBQXBDLDJHQUFBLGtCQUFrQixPQUFBO0FBQzNCLHdDQUFzQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IEZKQUxMX0FVRElUX0NPTkZJRyB9IGZyb20gXCIuL2F1ZGl0XCI7XG5leHBvcnQgKiBmcm9tIFwiLi9hd3NcIjtcbiJdfQ==
|
|
1
|
+
export { FJALL_AUDIT_CONFIG } from "./audit.js";
|
|
2
|
+
export * from "./aws/index.js";
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./patterns/aws";
|
|
2
|
-
export * from "./utils";
|
|
3
|
-
export * from "./resources";
|
|
4
|
-
export * from "./app";
|
|
1
|
+
export * from "./patterns/aws/index.js";
|
|
2
|
+
export * from "./utils/index.js";
|
|
3
|
+
export * from "./resources/index.js";
|
|
4
|
+
export * from "./app.js";
|
|
5
5
|
export { Code, Runtime, FunctionUrlAuthType } from "aws-cdk-lib/aws-lambda";
|
package/dist/lib/index.js
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.FunctionUrlAuthType = exports.Runtime = exports.Code = void 0;
|
|
18
|
-
__exportStar(require("./patterns/aws"), exports);
|
|
19
|
-
__exportStar(require("./utils"), exports);
|
|
20
|
-
__exportStar(require("./resources"), exports);
|
|
21
|
-
__exportStar(require("./app"), exports);
|
|
1
|
+
export * from "./patterns/aws/index.js";
|
|
2
|
+
export * from "./utils/index.js";
|
|
3
|
+
export * from "./resources/index.js";
|
|
4
|
+
export * from "./app.js";
|
|
22
5
|
// Re-export CDK Lambda types for use in generated infrastructure code
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return aws_lambda_1.Code; } });
|
|
25
|
-
Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return aws_lambda_1.Runtime; } });
|
|
26
|
-
Object.defineProperty(exports, "FunctionUrlAuthType", { enumerable: true, get: function () { return aws_lambda_1.FunctionUrlAuthType; } });
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9saWIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxpREFBK0I7QUFDL0IsMENBQXdCO0FBQ3hCLDhDQUE0QjtBQUM1Qix3Q0FBc0I7QUFFdEIsc0VBQXNFO0FBQ3RFLHFEQUE0RTtBQUFuRSxrR0FBQSxJQUFJLE9BQUE7QUFBRSxxR0FBQSxPQUFPLE9BQUE7QUFBRSxpSEFBQSxtQkFBbUIsT0FBQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL3BhdHRlcm5zL2F3c1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vdXRpbHNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL3Jlc291cmNlc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vYXBwXCI7XG5cbi8vIFJlLWV4cG9ydCBDREsgTGFtYmRhIHR5cGVzIGZvciB1c2UgaW4gZ2VuZXJhdGVkIGluZnJhc3RydWN0dXJlIGNvZGVcbmV4cG9ydCB7IENvZGUsIFJ1bnRpbWUsIEZ1bmN0aW9uVXJsQXV0aFR5cGUgfSBmcm9tIFwiYXdzLWNkay1saWIvYXdzLWxhbWJkYVwiO1xuIl19
|
|
6
|
+
export { Code, Runtime, FunctionUrlAuthType } from "aws-cdk-lib/aws-lambda";
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Stack, type StackProps } from "aws-cdk-lib";
|
|
2
2
|
import { type Construct } from "constructs";
|
|
3
|
-
import
|
|
3
|
+
import { ConfigRulePreset } from "../../config/aws/configRulePreset.js";
|
|
4
|
+
import { GuardDutyDetector } from "../../config/aws/guardDutyDetector.js";
|
|
5
|
+
import { SecurityHubHub } from "../../config/aws/securityHubHub.js";
|
|
6
|
+
import { ConfigRecorder } from "../../config/aws/configRecorder.js";
|
|
7
|
+
import { AccountAccessAnalyser } from "../../config/aws/accessAnalyser.js";
|
|
8
|
+
import { InspectorEnablement } from "../../config/aws/inspectorEnablement.js";
|
|
9
|
+
import type { GuardDutyDetectorProps } from "../../config/aws/guardDutyDetector.js";
|
|
10
|
+
import type { SecurityHubHubProps } from "../../config/aws/securityHubHub.js";
|
|
11
|
+
import type { ConfigRecorderProps } from "../../config/aws/configRecorder.js";
|
|
12
|
+
import type { ConfigRulePresetProps } from "../../config/aws/configRulePreset.js";
|
|
13
|
+
import type { OrganisationType } from "./interfaces/organisation.js";
|
|
4
14
|
export interface AccountProps extends StackProps {
|
|
5
15
|
accountId?: string;
|
|
6
16
|
region?: string;
|
|
@@ -9,4 +19,10 @@ export declare class Account extends Stack {
|
|
|
9
19
|
readonly organisationType: OrganisationType;
|
|
10
20
|
protected readonly resolvedRegion: string;
|
|
11
21
|
constructor(scope: Construct, id: string, props: AccountProps);
|
|
22
|
+
enableGuardDuty(props?: GuardDutyDetectorProps): GuardDutyDetector;
|
|
23
|
+
enableSecurityHub(props?: SecurityHubHubProps): SecurityHubHub;
|
|
24
|
+
enableConfigRecorder(props?: ConfigRecorderProps): ConfigRecorder;
|
|
25
|
+
enableAccessAnalyser(): AccountAccessAnalyser;
|
|
26
|
+
enableInspector(): InspectorEnablement;
|
|
27
|
+
enableConfigRules(props: ConfigRulePresetProps): ConfigRulePreset;
|
|
12
28
|
}
|