turbot/steampipe-mod-terraform-aws-compliance

Control: Ensure IAM password policy prevents password reuse

Description

This control checks whether the number of passwords to remember is set to 24. The control fails if the value is not 24. IAM password policies can prevent the reuse of a given password by the same user.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.iam_account_password_policy_reuse_24

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_aws_compliance.control.iam_account_password_policy_reuse_24 --share

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'password_reuse_prevention') is null then 'alarm'
when (attributes_std -> 'password_reuse_prevention')::integer >= 24 then 'ok'
else 'alarm'
end as status,
split_part(address, '.', 2) || case
when (attributes_std -> 'password_reuse_prevention') is null then ' password reuse prevention not set'
when (attributes_std -> 'password_reuse_prevention')::integer >= 24 then ' password reuse prevention set to ' || (attributes_std ->> 'password_reuse_prevention') || ' days'
else ' password reuse prevention set to ' || (attributes_std ->> 'password_reuse_prevention') || ' days'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_iam_account_password_policy';

Tags