aws_iam_server_certificate Resource
Use the aws_iam_server_certificate
InSpec audit resource to test the properties of a single IAM server certificate.
This resource retrieves information about the specified server certificate, including the server certificate’s path, GUID, ARN, and role.
For additional information, including details on parameters and properties, see the AWS documentation on IAM Instance Profile.
Installation
This resource is available in the Chef InSpec AWS resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.
Syntax
Ensure that a server certificate name exists.
describe aws_iam_server_certificate(server_certificate_name: 'CERTIFICATE_NAME') do
it { should exist }
end
Parameters
server_certificate_name
(required)
Properties
path
- The path to the server certificate.
server_certificate_name
- The name that identifies the server certificate.
server_certificate_id
- The stable and unique string identifying the server certificate.
arn
- The Amazon Resource Name (ARN) specifying the server certificate.
upload_date
- The date when the server certificate is uploaded.
expiration
- The date on which the certificate is set to expire.
Examples
Ensure a server certificate name is available.
describe aws_iam_server_certificate(server_certificate_name: 'CERTIFICATE_NAME') do
its('server_certificate_name') { should eq 'PROFILE_NAME' }
end
Ensure that an arn is available.
describe aws_iam_server_certificate(server_certificate_name: 'CERTIFICATE_NAME') do
its('arn') { should eq 'INSTANCE_PROFILE_NAME_ARN' }
end
Matchers
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.
The controls will pass if the get
method returns at least one result.
exist
Use should
to test that the entity exists.
describe aws_iam_server_certificate(server_certificate_name: 'CERTIFICATE_NAME') do
it { should exist }
end
Use should_not
to test the entity does not exist.
describe aws_iam_server_certificate(server_certificate_name: 'CERTIFICATE_NAME') do
it { should_not exist }
end
be_available
Use should
to check if the server certificate is available.
describe aws_iam_server_certificate(server_certificate_name: 'CERTIFICATE_NAME') do
it { should be_available }
end
AWS Permissions
Your Principal will need the IAM:Client:GetServerCertificateResponse
action with Effect
set to Allow
.
Was this page helpful?