Skip to content

Commit b8de577

Browse files
authored
(enhancement): Frequency for updated findings for GuardDuty (#1057)
* add frequency for GuardDuty * update sample config files with new config option
1 parent b32f217 commit b8de577

File tree

15 files changed

+59
-4
lines changed

15 files changed

+59
-4
lines changed

reference-artifacts/SAMPLE_CONFIGS/config.example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"guardduty-excl-regions": [],
6262
"guardduty-s3": true,
6363
"guardduty-s3-excl-regions": [],
64+
"guardduty-frequency": "FIFTEEN_MINUTES",
6465
"cwl": true,
6566
"access-analyzer": true,
6667
"config-excl-regions": [],

reference-artifacts/SAMPLE_CONFIGS/config.lite-CTNFW-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"guardduty-excl-regions": [],
7575
"guardduty-s3": true,
7676
"guardduty-s3-excl-regions": [],
77+
"guardduty-frequency": "FIFTEEN_MINUTES",
7778
"cwl": true,
7879
"access-analyzer": true,
7980
"config-excl-regions": [],

reference-artifacts/SAMPLE_CONFIGS/config.lite-GWLB-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"guardduty-excl-regions": [],
6262
"guardduty-s3": true,
6363
"guardduty-s3-excl-regions": [],
64+
"guardduty-frequency": "FIFTEEN_MINUTES",
6465
"cwl": true,
6566
"access-analyzer": true,
6667
"config-excl-regions": [],

reference-artifacts/SAMPLE_CONFIGS/config.lite-NFW-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"guardduty-excl-regions": [],
5757
"guardduty-s3": true,
5858
"guardduty-s3-excl-regions": [],
59+
"guardduty-frequency": "FIFTEEN_MINUTES",
5960
"cwl": true,
6061
"access-analyzer": true,
6162
"config-excl-regions": [],

reference-artifacts/SAMPLE_CONFIGS/config.lite-VPN-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"guardduty-excl-regions": [],
6262
"guardduty-s3": true,
6363
"guardduty-s3-excl-regions": [],
64+
"guardduty-frequency": "FIFTEEN_MINUTES",
6465
"cwl": true,
6566
"access-analyzer": true,
6667
"config-excl-regions": [],

reference-artifacts/SAMPLE_CONFIGS/config.multi-region-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"guardduty-excl-regions": [],
6262
"guardduty-s3": true,
6363
"guardduty-s3-excl-regions": [],
64+
"guardduty-frequency": "FIFTEEN_MINUTES",
6465
"cwl": true,
6566
"access-analyzer": true,
6667
"config-excl-regions": [],

reference-artifacts/SAMPLE_CONFIGS/config.test-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"guardduty-excl-regions": [],
7474
"guardduty-s3": true,
7575
"guardduty-s3-excl-regions": [],
76+
"guardduty-frequency": "FIFTEEN_MINUTES",
7677
"cwl": true,
7778
"access-analyzer": true,
7879
"config-excl-regions": [

reference-artifacts/SAMPLE_CONFIGS/config.ultralite-CT-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"guardduty-excl-regions": [],
3838
"guardduty-s3": true,
3939
"guardduty-s3-excl-regions": [],
40+
"guardduty-frequency": "FIFTEEN_MINUTES",
4041
"cwl": true,
4142
"cwl-access-level": "full",
4243
"access-analyzer": true,

reference-artifacts/SAMPLE_CONFIGS/config.ultralite-example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"guardduty-excl-regions": [],
3636
"guardduty-s3": true,
3737
"guardduty-s3-excl-regions": [],
38+
"guardduty-frequency": "FIFTEEN_MINUTES",
3839
"cwl": true,
3940
"cwl-access-level": "full",
4041
"access-analyzer": true,

src/deployments/cdk/src/deployments/guardduty/guardduty.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import { GuardDutyAdminSetup } from '@aws-accelerator/custom-resource-guardduty-
2323
import { IamRoleOutputFinder } from '@aws-accelerator/common-outputs/src/iam-role';
2424
import { StackOutput } from '@aws-accelerator/common-outputs/src/stack-output';
2525

26+
export enum GuardDutyFrequency {
27+
FIFTEEN_MINUTES = 'FIFTEEN_MINUTES',
28+
ONE_HOUR = 'ONE_HOUR',
29+
SIX_HOURS = 'SIX_HOURS',
30+
}
31+
2632
export interface GuardDutyStepProps {
2733
accountStacks: AccountStacks;
2834
config: AcceleratorConfig;
@@ -110,12 +116,14 @@ export async function step2(props: GuardDutyStepProps) {
110116
}));
111117
const centralServiceConfig = props.config['global-options']['central-security-services'];
112118
const s3ProtectionExclRegions = centralServiceConfig['guardduty-s3-excl-regions'] || [];
119+
const frequency = await getFrequency(props.config);
113120
regions?.map(region => {
114121
const masterAccountStack = props.accountStacks.getOrCreateAccountStack(masterAccountKey, region);
115122
new GuardDutyAdminSetup(masterAccountStack, 'GuardDutyAdminSetup', {
116123
memberAccounts: accountDetails,
117124
roleArn: adminSetupRoleOutput.roleArn,
118125
s3Protection: centralServiceConfig['guardduty-s3'] && !s3ProtectionExclRegions.includes(region),
126+
frequency,
119127
});
120128
});
121129
}
@@ -197,3 +205,16 @@ export async function getValidRegions(config: AcceleratorConfig) {
197205
const validRegions = regions.filter(x => !excl?.includes(x));
198206
return validRegions;
199207
}
208+
209+
export async function getFrequency(config: AcceleratorConfig) {
210+
const frequency = config['global-options']['central-security-services']['guardduty-frequency'];
211+
if (frequency === GuardDutyFrequency.SIX_HOURS) {
212+
return GuardDutyFrequency.SIX_HOURS;
213+
} else if (frequency === GuardDutyFrequency.ONE_HOUR) {
214+
return GuardDutyFrequency.ONE_HOUR;
215+
} else if (frequency === GuardDutyFrequency.FIFTEEN_MINUTES) {
216+
return GuardDutyFrequency.FIFTEEN_MINUTES;
217+
} else {
218+
return GuardDutyFrequency.SIX_HOURS;
219+
}
220+
}

0 commit comments

Comments
 (0)