mirror of
https://github.com/inspec/inspec
synced 2024-12-18 17:14:33 +00:00
cdbe8c1016
* Rewrite of Inspec Azure Resource pack to allow the testing of _any_ value Azure reosurce. Closes #36 Closes #37 This fixes #56 so that it works with the latest version of the SDK. In fact it will only work to version >= 0.15 Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
47 lines
2 KiB
Ruby
47 lines
2 KiB
Ruby
|
|
title 'External Virtual Machine Properties'
|
|
|
|
control 'azure-generic-vm-linux-external-2.0' do
|
|
|
|
impact 1.0
|
|
title 'Ensure External VM was built with the correct Image and has the correct properties'
|
|
|
|
# Ensure that the virtual machine has been created with the correct attributes
|
|
describe azure_generic_resource(group_name: 'Inspec-Azure',
|
|
name: 'Linux-External-VM') do
|
|
|
|
its('location') { should cmp 'westeurope' }
|
|
|
|
# check the storage profile for the machine
|
|
its('properties.storageProfile.imageReference.publisher') { should cmp 'Canonical' }
|
|
its('properties.storageProfile.imageReference.offer') { should cmp 'UbuntuServer' }
|
|
its('properties.storageProfile.imageReference.sku') { should cmp '16.04.0-LTS' }
|
|
|
|
# Check the disk for the machine
|
|
its('properties.storageProfile.osDisk.osType') { should cmp 'Linux' }
|
|
its('properties.storageProfile.osDisk.createOption') { should cmp 'FromImage' }
|
|
its('properties.storageProfile.osDisk.name') { should cmp 'linux-external-osdisk' }
|
|
its('properties.storageProfile.osDisk.caching') { should cmp 'ReadWrite' }
|
|
|
|
# Esnure that the machine has no data disks attached
|
|
its('properties.storageProfile.dataDisks.count') { should eq 1 }
|
|
|
|
# Check the hardwareProfile
|
|
its('properties.hardwareProfile.vmSize') { should cmp 'Standard_DS2_v2' }
|
|
|
|
# Check the network interfaces
|
|
its('properties.networkProfile.networkInterfaces.count') { should eq 1 }
|
|
|
|
# Determine the authentication and OS type
|
|
its('properties.osProfile.computerName') { should eq 'linux-external-1' }
|
|
its('properties.osProfile.adminUsername') { should eq 'azure' }
|
|
its('properties.osProfile.linuxConfiguration.disablePasswordAuthentication') { should be true }
|
|
|
|
# Check that the tags have been set properly
|
|
it { should have_tags }
|
|
its('tag_count') { should be 1 }
|
|
its('tags') { should include 'Description' }
|
|
its('Description_tag') { should match 'Externally facing' }
|
|
end
|
|
|
|
end
|