mirror of
https://github.com/inspec/inspec
synced 2024-11-27 23:20:33 +00:00
c77d442007
Signed-off-by: Chris Redekop <chris.redekop@d2l.com>
32 lines
633 B
Ruby
32 lines
633 B
Ruby
# author: Miles Tjandrawidjaja
|
|
class AwsIamRootUser < Inspec.resource(1)
|
|
name 'aws_iam_root_user'
|
|
desc 'Verifies settings for AWS root account'
|
|
example "
|
|
describe aws_iam_root_user do
|
|
its('access_key_count') { should eq 0 }
|
|
end
|
|
"
|
|
|
|
def initialize(conn = AWSConnection.new)
|
|
@client = conn.iam_client
|
|
end
|
|
|
|
def access_key_count
|
|
summary_account['AccountAccessKeysPresent']
|
|
end
|
|
|
|
def has_mfa_enabled?
|
|
summary_account['AccountMFAEnabled'] == 1
|
|
end
|
|
|
|
def to_s
|
|
'AWS Root-User'
|
|
end
|
|
|
|
private
|
|
|
|
def summary_account
|
|
@summary_account ||= @client.get_account_summary.summary_map
|
|
end
|
|
end
|