cloudsploit
cloudsploit copied to clipboard
plugins/iam/passwordExpiration.js fails even when passwords are set to expire
L34-58 treat data.PasswordPolicy.ExpirePasswords as an integer when it is actually a boolean.
Here's what I see in my account using the AWS CLI:
[cchalfant:~]$ aws iam get-account-password-policy
{
"PasswordPolicy": {
"AllowUsersToChangePassword": true,
"RequireLowercaseCharacters": true,
"RequireUppercaseCharacters": true,
"MinimumPasswordLength": 10,
"RequireNumbers": true,
"PasswordReusePrevention": 24,
"HardExpiry": false,
"RequireSymbols": true,
"MaxPasswordAge": 90,
"ExpirePasswords": true
}
}
But 1.11 fails in our account with the following output:
IAM Password Expiration N/A global FAIL Password expiration of: true days is less than 90
Relevant code snippet:
if (!data.PasswordPolicy.ExpirePasswords) {
results.push({
status: 2,
message: 'Password expiration policy is not set to expire passwords',
region: 'global'
});
} else if (data.PasswordPolicy.ExpirePasswords < 90) {
results.push({
status: 2,
message: 'Password expiration of: ' + data.PasswordPolicy.ExpirePasswords + ' days is less than 90',
region: 'global'
});
} else if (data.PasswordPolicy.ExpirePasswords < 24) {
results.push({
status: 1,
message: 'Password expiration of: ' + data.PasswordPolicy.ExpirePasswords + ' days is less than 180',
region: 'global'
});
} else {
results.push({
status: 0,
message: 'Password expiration of: ' + data.PasswordPolicy.ExpirePasswords + ' passwords is suitable',
region: 'global'
});
}
How does this plugin relate to plugins/iam/maxPasswordAge.js? Aren't they more or less checking the same thing now, but with different thresholds?
@chalfant you're correct, these two plugins are essentially duplicates on one another. We'll look at removing one based on which is closest to the CIS requirements. Thanks for pointing this out.