Skip to content

Instantly share code, notes, and snippets.

@chris-rock
Created April 9, 2017 18:28
Show Gist options
  • Save chris-rock/a079adf369c88ac671b2b0f96f9bb229 to your computer and use it in GitHub Desktop.
Save chris-rock/a079adf369c88ac671b2b0f96f9bb229 to your computer and use it in GitHub Desktop.
Verify Windows IIS with InSpec
# Author: Christoph Hartmann
# Target OS: Windows 2012 R2
# Check that IIS is installed via Windows Features
describe windows_feature('Webserver') do
it { should be_installed }
end
# Ensure IIS Service is running
describe service('W3SVC') do
it { should be_installed }
it { should be_running }
end
# Verify the `Default Web Site`
describe iis_site('Default Web Site') do
it { should exist }
it { should be_running }
it { should have_app_pool('DefaultAppPool') }
its('app_pool') { should eq 'DefaultAppPool' }
it { should have_binding('http *:80:') }
its('bindings') { should include 'http *:80:' }
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
its('path') { should eq '%SystemDrive%\\inetpub\\wwwroot' }
end
# Ensure the WebServer is running on port 80
describe port(80) do
it { should be_listening }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment