Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CheckEnforceMFA = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0123", Provider: providers.AWSProvider, Service: "iam", ShortCode: "enforce-mfa", Summary: "IAM Groups should have MFA enforcement activated.", Impact: "User accounts are more vulnerable to compromise without multi factor authentication activated", Resolution: "Use terraform-module/enforce-mfa/aws to ensure that MFA is enforced", Explanation: ` IAM user accounts should be protected with multi factor authentication to add safe guards to password compromise. `, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformEnforceMfaGoodExamples, BadExamples: terraformEnforceMfaBadExamples, Links: terraformEnforceMfaLinks, RemediationMarkdown: terraformEnforceMfaRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { for _, group := range s.AWS.IAM.Groups { var mfaEnforced bool for _, policy := range group.Policies { document := policy.Document.Parsed statements, _ := document.Statements() for _, statement := range statements { conditions, _ := statement.Conditions() for _, condition := range conditions { key, _ := condition.Key() if strings.EqualFold(key, "aws:MultiFactorAuthPresent") { mfaEnforced = true break } } } } if !mfaEnforced { results.Add("Multi-Factor authentication is not enforced for group", &group) } } return }, )
View Source
var CheckNoPasswordReuse = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0056", Provider: providers.AWSProvider, Service: "iam", ShortCode: "no-password-reuse", Summary: "IAM Password policy should prevent password reuse.", Impact: "Password reuse increase the risk of compromised passwords being abused", Resolution: "Prevent password reuse in the policy", Explanation: `IAM account password policies should prevent the reuse of passwords. The account password policy should be set to prevent using any of the last five used passwords.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformNoPasswordReuseGoodExamples, BadExamples: terraformNoPasswordReuseBadExamples, Links: terraformNoPasswordReuseLinks, RemediationMarkdown: terraformNoPasswordReuseRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.ReusePreventionCount.LessThan(5) { results.Add( "Password policy allows reuse of recent passwords.", policy.ReusePreventionCount, ) } else { results.AddPassed(&policy) } return }, )
View Source
var CheckNoPolicyWildcards = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0057", Provider: providers.AWSProvider, Service: "iam", ShortCode: "no-policy-wildcards", Summary: "IAM policy should avoid use of wildcards and instead apply the principle of least privilege", Impact: "Overly permissive policies may grant access to sensitive resources", Resolution: "Specify the exact permissions required, and to which resources they should apply instead of using wildcards.", Explanation: `You should use the principle of least privilege when defining your IAM policies. This means you should specify each exact permission required without using wildcards, as this could cause the granting of access to certain undesired actions, resources and principals.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformNoPolicyWildcardsGoodExamples, BadExamples: terraformNoPolicyWildcardsBadExamples, Links: terraformNoPolicyWildcardsLinks, RemediationMarkdown: terraformNoPolicyWildcardsRemediationMarkdown, }, CloudFormation: &rules.EngineMetadata{ GoodExamples: cloudFormationNoPolicyWildcardsGoodExamples, BadExamples: cloudFormationNoPolicyWildcardsBadExamples, Links: cloudFormationNoPolicyWildcardsLinks, RemediationMarkdown: cloudFormationNoPolicyWildcardsRemediationMarkdown, }, Severity: severity.High, }, func(s *state.State) (results rules.Results) { for _, policy := range s.AWS.IAM.Policies { results = checkPolicy(policy.Document, results) } for _, group := range s.AWS.IAM.Groups { for _, policy := range group.Policies { results = checkPolicy(policy.Document, results) } } for _, user := range s.AWS.IAM.Users { for _, policy := range user.Policies { results = checkPolicy(policy.Document, results) } } for _, role := range s.AWS.IAM.Roles { for _, policy := range role.Policies { results = checkPolicy(policy.Document, results) } } return results }, )
View Source
var CheckRequireLowercaseInPasswords = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0058", Provider: providers.AWSProvider, Service: "iam", ShortCode: "require-lowercase-in-passwords", Summary: "IAM Password policy should have requirement for at least one lowercase character.", Impact: "Short, simple passwords are easier to compromise", Resolution: "Enforce longer, more complex passwords in the policy", Explanation: `IAM account password policies should ensure that passwords content including at least one lowercase character.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformRequireLowercaseInPasswordsGoodExamples, BadExamples: terraformRequireLowercaseInPasswordsBadExamples, Links: terraformRequireLowercaseInPasswordsLinks, RemediationMarkdown: terraformRequireLowercaseInPasswordsRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.RequireLowercase.IsFalse() { results.Add( "Password policy does not require lowercase characters.", policy.RequireLowercase, ) } else { results.AddPassed(&policy) } return }, )
View Source
var CheckRequireNumbersInPasswords = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0059", Provider: providers.AWSProvider, Service: "iam", ShortCode: "require-numbers-in-passwords", Summary: "IAM Password policy should have requirement for at least one number in the password.", Impact: "Short, simple passwords are easier to compromise", Resolution: "Enforce longer, more complex passwords in the policy", Explanation: `IAM account password policies should ensure that passwords content including at least one number.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformRequireNumbersInPasswordsGoodExamples, BadExamples: terraformRequireNumbersInPasswordsBadExamples, Links: terraformRequireNumbersInPasswordsLinks, RemediationMarkdown: terraformRequireNumbersInPasswordsRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.RequireNumbers.IsFalse() { results.Add( "Password policy does not require numbers.", policy.RequireNumbers, ) } else { results.AddPassed(&policy) } return }, )
View Source
var CheckRequireSymbolsInPasswords = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0060", Provider: providers.AWSProvider, Service: "iam", ShortCode: "require-symbols-in-passwords", Summary: "IAM Password policy should have requirement for at least one symbol in the password.", Impact: "Short, simple passwords are easier to compromise", Resolution: "Enforce longer, more complex passwords in the policy", Explanation: `IAM account password policies should ensure that passwords content including a symbol.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformRequireSymbolsInPasswordsGoodExamples, BadExamples: terraformRequireSymbolsInPasswordsBadExamples, Links: terraformRequireSymbolsInPasswordsLinks, RemediationMarkdown: terraformRequireSymbolsInPasswordsRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.RequireSymbols.IsFalse() { results.Add( "Password policy does not require symbols.", policy.RequireSymbols, ) } else { results.AddPassed(&policy) } return }, )
View Source
var CheckRequireUppercaseInPasswords = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0061", Provider: providers.AWSProvider, Service: "iam", ShortCode: "require-uppercase-in-passwords", Summary: "IAM Password policy should have requirement for at least one uppercase character.", Impact: "Short, simple passwords are easier to compromise", Resolution: "Enforce longer, more complex passwords in the policy", Explanation: `, IAM account password policies should ensure that passwords content including at least one uppercase character.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformRequireUppercaseInPasswordsGoodExamples, BadExamples: terraformRequireUppercaseInPasswordsBadExamples, Links: terraformRequireUppercaseInPasswordsLinks, RemediationMarkdown: terraformRequireUppercaseInPasswordsRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.RequireUppercase.IsFalse() { results.Add( "Password policy does not require uppercase characters.", policy.RequireUppercase, ) } else { results.AddPassed(&policy) } return }, )
View Source
var CheckSetMaxPasswordAge = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0062", Provider: providers.AWSProvider, Service: "iam", ShortCode: "set-max-password-age", Summary: "IAM Password policy should have expiry less than or equal to 90 days.", Impact: "Long life password increase the likelihood of a password eventually being compromised", Resolution: "Limit the password duration with an expiry in the policy", Explanation: `IAM account password policies should have a maximum age specified. The account password policy should be set to expire passwords after 90 days or less.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformSetMaxPasswordAgeGoodExamples, BadExamples: terraformSetMaxPasswordAgeBadExamples, Links: terraformSetMaxPasswordAgeLinks, RemediationMarkdown: terraformSetMaxPasswordAgeRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.MaxAgeDays.GreaterThan(90) { results.Add( "Password policy allows a maximum password age of greater than 90 days.", policy.MaxAgeDays, ) } else { results.AddPassed(&policy) } return }, )
View Source
var CheckSetMinimumPasswordLength = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0063", Provider: providers.AWSProvider, Service: "iam", ShortCode: "set-minimum-password-length", Summary: "IAM Password policy should have minimum password length of 14 or more characters.", Impact: "Short, simple passwords are easier to compromise", Resolution: "Enforce longer, more complex passwords in the policy", Explanation: `IAM account password policies should ensure that passwords have a minimum length. The account password policy should be set to enforce minimum password length of at least 14 characters.`, Links: []string{ "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html#password-policy-details", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformSetMinimumPasswordLengthGoodExamples, BadExamples: terraformSetMinimumPasswordLengthBadExamples, Links: terraformSetMinimumPasswordLengthLinks, RemediationMarkdown: terraformSetMinimumPasswordLengthRemediationMarkdown, }, Severity: severity.Medium, }, func(s *state.State) (results rules.Results) { policy := s.AWS.IAM.PasswordPolicy if policy.IsUnmanaged() { return } if policy.MinimumLength.LessThan(14) { results.Add( "Password policy has a minimum password length of less than 14 characters.", policy.MinimumLength, ) } else { results.AddPassed(&policy) } return }, )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
- enforce_mfa.go
- enforce_mfa.tf.go
- no_password_reuse.go
- no_password_reuse.tf.go
- no_policy_wildcards.cf.go
- no_policy_wildcards.go
- no_policy_wildcards.tf.go
- require_lowercase_in_passwords.go
- require_lowercase_in_passwords.tf.go
- require_numbers_in_passwords.go
- require_numbers_in_passwords.tf.go
- require_symbols_in_passwords.go
- require_symbols_in_passwords.tf.go
- require_uppercase_in_passwords.go
- require_uppercase_in_passwords.tf.go
- set_max_password_age.go
- set_max_password_age.tf.go
- set_minimum_password_length.go
- set_minimum_password_length.tf.go
Click to show internal directories.
Click to hide internal directories.