Skip to content

Commit e6ee33f

Browse files
feat(CG-1287): add aws cis 2.3.2 support
1 parent 0934441 commit e6ee33f

4 files changed

Lines changed: 123 additions & 1 deletion

File tree

src/aws/cis-1.5.0/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ Policy Pack based on the [AWS Foundations 1.5.0](https://drive.google.com/file/d
6464
| AWS CIS 2.1.5 | Ensure that S3 Buckets are configured with 'Block public access (bucket settings)' |
6565
| AWS CIS 2.2.1 | Ensure EBS volume encryption is enabled |
6666
| AWS CIS 2.3.1 | Ensure that encryption is enabled for RDS Instances |
67+
| AWS CIS 2.3.2 | Ensure Auto Minor Version Upgrade feature is Enabled for RDS Instances |
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
export default {
2+
id: 'aws-cis-1.5.0-2.3.2',
3+
title: 'AWS CIS 2.3.2 Ensure Auto Minor Version Upgrade feature is Enabled for RDS Instances',
4+
5+
description: 'Ensure that RDS database instances have the Auto Minor Version Upgrade flag enabled in order to receive automatically minor engine upgrades during the specified maintenance window. So, RDS instances can get the new features, bug fixes, and security patches for their database engines.',
6+
7+
audit: `**From Console:**
8+
9+
1. Log in to the AWS management console and navigate to the RDS dashboard at https://console.aws.amazon.com/rds/.
10+
2. In the left navigation panel, click on Databases.
11+
3. Select the RDS instance that wants to examine.
12+
4. Click on the Maintenance and backups panel.
13+
5. Under the Maintenance section, search for the Auto Minor Version Upgrade status.
14+
15+
• If the current status is set to Disabled, means the feature is not set and the minor engine upgrades released will not be applied to the selected RDS instance
16+
17+
**From Command Line:**
18+
19+
1. Run *describe-db-instances* command to list all RDS database names, available in the selected AWS region:
20+
21+
aws rds describe-db-instances --region <regionName> --query 'DBInstances[*].DBInstanceIdentifier'
22+
23+
2. The command output should return each database instance identifier.
24+
3. Run again *describe-db-instances* command using the RDS instance identifier returned earlier to determine the Auto Minor Version Upgrade status for the selected instance:
25+
26+
aws rds describe-db-instances --region <regionName> --db-instance-identifier <dbInstanceIdentifier> --query 'DBInstances[*].AutoMinorVersionUpgrade'
27+
28+
4. The command output should return the feature current status. If the current status is set to true, the feature is enabled and the minor engine upgrades will be applied to the selected RDS instance.`,
29+
30+
rationale: 'AWS RDS will occasionally deprecate minor engine versions and provide new ones for an upgrade. When the last version number within the release is replaced, the version changed is considered minor. With Auto Minor Version Upgrade feature enabled, the version upgrades will occur automatically during the specified maintenance window so your RDS instances can get the new features, bug fixes, and security patches for their database engines.',
31+
32+
remediation: `**From Console:**
33+
34+
1. Log in to the AWS management console and navigate to the RDS dashboard at https://console.aws.amazon.com/rds/.
35+
2. In the left navigation panel, click on Databases.
36+
3. Select the RDS instance that wants to update.
37+
4. Click on the *Modify* button placed on the top right side.
38+
5. On the *Modify DB Instance: <instance identifier>* page, In the *Maintenance* section, select *Auto minor version upgrade* click on the *Yes* radio button.
39+
6. At the bottom of the page click on *Continue*, check to Apply Immediately to apply the changes immediately, or select *Apply during the next scheduled maintenance window* to avoid any downtime.
40+
7. Review the changes and click on *Modify DB Instance*. The instance status should change from available to modifying and back to available. Once the feature is enabled, the *Auto Minor Version Upgrade* status should change to *Yes*.
41+
42+
**From Command Line:**
43+
44+
1. Run *describe-db-instances* command to list all RDS database instance names, available in the selected AWS region:
45+
46+
aws rds describe-db-instances --region <regionName> --query 'DBInstances[*].DBInstanceIdentifier'
47+
2. The command output should return each database instance identifier.
48+
3. Run the *modify-db-instance* command to modify the selected RDS instance configuration this command will apply the changes immediately, Remove -- *apply-immediately* to apply changes during the next scheduled maintenance window and avoid any downtime:
49+
50+
aws rds modify-db-instance --region <regionName> --db-instance-identifier <dbInstanceIdentifier> --auto-minor-version-upgrade --apply-immediately
51+
52+
4. The command output should reveal the new configuration metadata for the RDS instance and check *AutoMinorVersionUpgrade* parameter value.
53+
5. Run *describe-db-instances* command to check if the Auto Minor Version Upgrade feature has been successfully enable:
54+
55+
aws rds describe-db-instances --region <regionName> --db-instance-identifier <dbInstanceIdentifier> --query 'DBInstances[*].AutoMinorVersionUpgrade'
56+
57+
6. The command output should return the feature current status set to *true*, the feature is *enabled* and the minor engine upgrades will be applied to the selected RDS instance.`,
58+
59+
references: [
60+
'https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_RDS_Managing.html',
61+
'https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Upgrading.html',
62+
'https://aws.amazon.com/rds/faqs/',
63+
],
64+
gql: `{
65+
queryawsRdsDbInstance {
66+
id
67+
arn
68+
accountId
69+
__typename
70+
autoMinorVersionUpgrade
71+
}
72+
}`,
73+
resource: 'queryawsRdsDbInstance[*]',
74+
severity: 'high',
75+
conditions: {
76+
path: '@.autoMinorVersionUpgrade',
77+
equal: true,
78+
},
79+
}

src/aws/cis-1.5.0/rules/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Aws_CIS_150_214 from './aws-cis-1.5.0-2.1.4'
66
import Aws_CIS_150_215 from './aws-cis-1.5.0-2.1.5'
77
import Aws_CIS_150_221 from './aws-cis-1.5.0-2.2.1'
88
import Aws_CIS_150_231 from './aws-cis-1.5.0-2.3.1'
9+
import Aws_CIS_150_232 from './aws-cis-1.5.0-2.3.2'
910

1011
export default [
1112
Aws_CIS_150_211,
@@ -15,4 +16,5 @@ export default [
1516
Aws_CIS_150_215,
1617
Aws_CIS_150_221,
1718
Aws_CIS_150_231,
19+
Aws_CIS_150_232,
1820
]

src/aws/cis-1.5.0/tests/aws-cis-1.5.0-2.x.test.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import Aws_CIS_150_211 from '../rules/aws-cis-1.5.0-2.1.1'
66
import Aws_CIS_150_213 from '../rules/aws-cis-1.5.0-2.1.3'
77
import Aws_CIS_150_215 from '../rules/aws-cis-1.5.0-2.1.5'
88
import Aws_CIS_150_231 from '../rules/aws-cis-1.5.0-2.3.1'
9+
import Aws_CIS_150_232 from '../rules/aws-cis-1.5.0-2.3.2'
910

1011
export interface QueryawsRdsDbInstance {
1112
id: string
12-
encrypted: boolean
13+
encrypted?: boolean
14+
autoMinorVersionUpgrade?: boolean
1315
}
1416

1517
export interface EncryptionRule {
@@ -276,4 +278,42 @@ describe('CIS Amazon Web Services Foundations: 1.4.0', () => {
276278
await testRule(data, Result.FAIL)
277279
})
278280
})
281+
282+
describe('AWS CIS 2.3.2 Ensure Auto Minor Version Upgrade feature is Enabled for RDS Instances', () => {
283+
const getTestRuleFixture = (autoMinorVersionUpgrade: boolean): CIS2xQueryResponse => {
284+
return {
285+
queryawsRdsDbInstance: [
286+
{
287+
id: cuid(),
288+
autoMinorVersionUpgrade,
289+
},
290+
],
291+
}
292+
}
293+
294+
// Act
295+
const testRule = async (
296+
data: CIS2xQueryResponse,
297+
expectedResult: Result
298+
): Promise<void> => {
299+
// Act
300+
const [processedRule] = await rulesEngine.processRule(
301+
Aws_CIS_150_232 as Rule,
302+
{ ...data }
303+
)
304+
305+
// Asserts
306+
expect(processedRule.result).toBe(expectedResult)
307+
}
308+
309+
test('No Security Issue when RDS instances autoMinorVersionUpgrade are enabled', async () => {
310+
const data: CIS2xQueryResponse = getTestRuleFixture(true)
311+
await testRule(data, Result.PASS)
312+
})
313+
314+
test('Security Issue when RDS instances autoMinorVersionUpgrade are not enabled', async () => {
315+
const data: CIS2xQueryResponse = getTestRuleFixture(false)
316+
await testRule(data, Result.FAIL)
317+
})
318+
})
279319
})

0 commit comments

Comments
 (0)