mirror of
https://github.com/inspec/inspec
synced 2025-02-26 04:17:26 +00:00
* Adding resource aws_iam_root_user Signed-off-by: Miles Tjandrawidjaja <miles@tjandrawidjaja.com> * Adding to_s method to class aws_iam_root_user Signed-off-by: Miles Tjandrawidjaja <miles@tjandrawidjaja.com> * Cleaner to_s result for aws_iam_root_user Signed-off-by: Miles Tjandrawidjaja <miles@tjandrawidjaja.com>
28 lines
557 B
Ruby
28 lines
557 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 to_s
|
|
'AWS Root-User'
|
|
end
|
|
|
|
private
|
|
|
|
def summary_account
|
|
@summary_account ||= @client.get_account_summary.summary_map
|
|
end
|
|
end
|