Skip to content

Commit 96c392f

Browse files
committed
Base. Added cdk-nag to app.ts and more run commends to package.json
1 parent a031ef7 commit 96c392f

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

lib/base/app.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import 'dotenv/config'
33
import 'source-map-support/register';
44
import * as cdk from 'aws-cdk-lib';
5+
import * as nag from "cdk-nag";
56
import * as config from "./lib/config/baseConfig";
67
import {BaseCommonStack} from "./lib/common-stack";
78
import {BaseSingleNodeStack} from "./lib/single-node-stack";
@@ -48,3 +49,12 @@ new BaseHANodesStack(app, "base-ha-nodes", {
4849
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
4950
numberOfNodes: config.haNodeConfig.numberOfNodes
5051
});
52+
53+
// Security Check
54+
cdk.Aspects.of(app).add(
55+
new nag.AwsSolutionsChecks({
56+
verbose: false,
57+
reports: true,
58+
logIgnores: false,
59+
})
60+
);

lib/base/lib/constructs/base-node-security-group.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as cdk from "aws-cdk-lib";
22
import * as cdkConstructs from 'constructs';
33
import * as ec2 from "aws-cdk-lib/aws-ec2";
4+
import * as nag from "cdk-nag";
45

56
export interface BaseNodeSecurityGroupConstructProps {
67
vpc: cdk.aws_ec2.IVpc;
@@ -35,5 +36,20 @@ export interface BaseNodeSecurityGroupConstructProps {
3536
sg.addEgressRule(ec2.Peer.anyIpv4(), ec2.Port.udpRange(13001, 65535), "All outbound connections except 13000");
3637

3738
this.securityGroup = sg
39+
40+
/**
41+
* cdk-nag suppressions
42+
*/
43+
44+
nag.NagSuppressions.addResourceSuppressions(
45+
this,
46+
[
47+
{
48+
id: "AwsSolutions-EC23",
49+
reason: "Ethereum requires wildcard inbound for specific ports",
50+
},
51+
],
52+
true
53+
);
3854
}
3955
}

lib/base/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"cdk_deploy_common": "cdk deploy base-common",
1010
"cdk_synth_single_node": "cdk synth base-single-node",
1111
"cdk_deploy_single_node": "cdk deploy base-single-node",
12-
"cdk_destroy_single_node": "cdk destroy base-single-node"
12+
"cdk_destroy_single_node": "cdk destroy base-single-node",
13+
"cdk_synth_ha_nodes": "cdk synth base-ha-nodes",
14+
"cdk_deploy_ha_nodes": "cdk deploy base-ha-nodes",
15+
"cdk_destroy_ha_nodes": "cdk destroy base-ha-nodes"
1316
},
1417
"dependencies": {
1518
"@types/node": "^20.10.0"

0 commit comments

Comments
 (0)