mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
Merge branch 'master' into cw/bundler-v2
This commit is contained in:
commit
ecf0ab640f
7 changed files with 35 additions and 26 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,10 +1,10 @@
|
|||
# Change Log
|
||||
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
|
||||
<!-- latest_release 3.3.10 -->
|
||||
## [v3.3.10](https://github.com/inspec/inspec/tree/v3.3.10) (2019-01-25)
|
||||
<!-- latest_release 3.3.12 -->
|
||||
## [v3.3.12](https://github.com/inspec/inspec/tree/v3.3.12) (2019-01-25)
|
||||
|
||||
#### Merged Pull Requests
|
||||
- Clean up unit test output [#3743](https://github.com/inspec/inspec/pull/3743) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
|
||||
#### Bug Fixes
|
||||
- iis_app_pool: Fixes error with 'should not exist' [#3740](https://github.com/inspec/inspec/pull/3740) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
|
||||
<!-- latest_release -->
|
||||
|
||||
<!-- release_rollup since=3.2.6 -->
|
||||
|
@ -22,11 +22,13 @@
|
|||
- Add resources for aws_billing_report and aws_billing_reports. [#2838](https://github.com/inspec/inspec/pull/2838) ([miah](https://github.com/miah)) <!-- 3.3.0 -->
|
||||
|
||||
#### Merged Pull Requests
|
||||
- allow bundler 2.x and bump integration gems [#3723](https://github.com/inspec/inspec/pull/3723) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 3.3.11 -->
|
||||
- Clean up unit test output [#3743](https://github.com/inspec/inspec/pull/3743) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 3.3.10 -->
|
||||
- Document additional usage of json resource [#3737](https://github.com/inspec/inspec/pull/3737) ([webframp](https://github.com/webframp)) <!-- 3.3.9 -->
|
||||
- Stabilize profile export functional test [#3696](https://github.com/inspec/inspec/pull/3696) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 3.2.7 -->
|
||||
|
||||
#### Bug Fixes
|
||||
- iis_app_pool: Fixes error with 'should not exist' [#3740](https://github.com/inspec/inspec/pull/3740) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 3.3.12 -->
|
||||
- habitat package: Prevent world-writable files in gems [#3736](https://github.com/inspec/inspec/pull/3736) ([jaym](https://github.com/jaym)) <!-- 3.3.8 -->
|
||||
- Fix SSL tests by allowing multiple cipher counts [#3744](https://github.com/inspec/inspec/pull/3744) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 3.3.6 -->
|
||||
- Fix AWS tests found during ChefStyle spike [#3739](https://github.com/inspec/inspec/pull/3739) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 3.3.5 -->
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -23,7 +23,7 @@ end
|
|||
|
||||
group :integration do
|
||||
gem 'berkshelf', '~> 5.2'
|
||||
gem 'test-kitchen', '~> 1.6'
|
||||
gem 'test-kitchen', '>= 1.24'
|
||||
gem 'kitchen-vagrant'
|
||||
# we need winrm v2 support >= 0.15.1
|
||||
gem 'kitchen-inspec', '>= 0.15.1'
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.3.10
|
||||
3.3.12
|
|
@ -4,5 +4,5 @@
|
|||
# author: Christoph Hartmann
|
||||
|
||||
module Inspec
|
||||
VERSION = '3.3.10'
|
||||
VERSION = '3.3.12'
|
||||
end
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
class IisAppPool < Inspec.resource(1)
|
||||
name 'iis_app_pool'
|
||||
desc 'Tests IIS application pool configuration on windows.'
|
||||
example "
|
||||
supports platform: 'windows'
|
||||
example <<~EOH
|
||||
describe iis_app_pool('DefaultAppPool') do
|
||||
it { should exist }
|
||||
its('enable32bit') { should cmp 'True' }
|
||||
its('runtime_version') { should eq 'v4.0' }
|
||||
its('pipeline_mode') { should eq 'Integrated' }
|
||||
end
|
||||
"
|
||||
EOH
|
||||
|
||||
def initialize(pool_name)
|
||||
@pool_name = pool_name
|
||||
|
@ -77,18 +78,23 @@ class IisAppPool < Inspec.resource(1)
|
|||
end
|
||||
|
||||
def to_s
|
||||
"iis_app_pool '#{@pool_name}'"
|
||||
"IIS App Pool '#{@pool_name}'"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# I cannot think of a way to shorten this method
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def iis_app_pool
|
||||
return @cache unless @cache.nil?
|
||||
|
||||
command = "Import-Module WebAdministration; Get-Item '#{@pool_path}' | Select-Object * | ConvertTo-Json"
|
||||
cmd = inspec.command(command)
|
||||
script = <<~EOH
|
||||
Import-Module WebAdministration
|
||||
If (Test-Path '#{@pool_path}') {
|
||||
Get-Item '#{@pool_path}' | Select-Object * | ConvertTo-Json
|
||||
} Else {
|
||||
Write-Host '{}'
|
||||
}
|
||||
EOH
|
||||
cmd = inspec.powershell(script)
|
||||
|
||||
begin
|
||||
pool = JSON.parse(cmd.stdout)
|
||||
|
@ -96,21 +102,23 @@ class IisAppPool < Inspec.resource(1)
|
|||
raise Inspec::Exceptions::ResourceFailed, 'Unable to parse app pool JSON'
|
||||
end
|
||||
|
||||
process_model = pool.fetch('processModel', {})
|
||||
idle_timeout = process_model.fetch('idleTimeout', {})
|
||||
|
||||
# map our values to a hash table
|
||||
@cache = {
|
||||
pool_name: pool['name'],
|
||||
version: pool['managedRuntimeVersion'],
|
||||
e32b: pool['enable32BitAppOnWin64'],
|
||||
mode: pool['managedPipelineMode'],
|
||||
processes: pool['processModel']['maxProcesses'],
|
||||
timeout: "#{pool['processModel']['idleTimeout']['Hours']}:#{pool['processModel']['idleTimeout']['Minutes']}:#{pool['processModel']['idleTimeout']['Seconds']}",
|
||||
timeout_days: pool['processModel']['idleTimeout']['Days'],
|
||||
timeout_hours: pool['processModel']['idleTimeout']['Hours'],
|
||||
timeout_minutes: pool['processModel']['idleTimeout']['Minutes'],
|
||||
timeout_seconds: pool['processModel']['idleTimeout']['Seconds'],
|
||||
user_identity_type: pool['processModel']['identityType'],
|
||||
username: pool['processModel']['userName'],
|
||||
processes: process_model['maxProcesses'],
|
||||
timeout: "#{idle_timeout['Hours']}:#{idle_timeout['Minutes']}:#{idle_timeout['Seconds']}",
|
||||
timeout_days: idle_timeout['Days'],
|
||||
timeout_hours: idle_timeout['Hours'],
|
||||
timeout_minutes: idle_timeout['Minutes'],
|
||||
timeout_seconds: idle_timeout['Seconds'],
|
||||
user_identity_type: process_model['identityType'],
|
||||
username: process_model['userName'],
|
||||
}
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
end
|
||||
|
|
|
@ -527,8 +527,7 @@ class MockLoader
|
|||
"curl -H 'Content-Type: application/json' -u es_admin:password http://localhost:9200/_nodes" => cmd.call('elasticsearch-cluster-auth'),
|
||||
"curl -H 'Content-Type: application/json' http://elasticsearch.mycompany.biz:1234/_nodes" => cmd.call('elasticsearch-cluster-url'),
|
||||
# iis_app_pool resource
|
||||
"Import-Module WebAdministration; Get-Item 'IIS:\\AppPools\\DefaultAppPool' | Select-Object name,managedruntimeversion,enable32bitapponwin64,managedpipelinemode,processmodel | ConvertTo-Json" => cmd.call('iis-default-app-pool'),
|
||||
"Import-Module WebAdministration; Get-Item 'IIS:\\AppPools\\DefaultAppPool' | Select-Object * | ConvertTo-Json" => cmd.call('iis-default-app-pool'),
|
||||
"Import-Module WebAdministration\nIf (Test-Path 'IIS:\\AppPools\\DefaultAppPool') {\n Get-Item 'IIS:\\AppPools\\DefaultAppPool' | Select-Object * | ConvertTo-Json\n} Else {\n Write-Host '{}'\n}\n" => cmd.call('iis-default-app-pool'),
|
||||
|
||||
# iis_site resource
|
||||
"Get-Website 'Default Web Site' | Select-Object -Property Name,State,PhysicalPath,bindings,ApplicationPool | ConvertTo-Json" => cmd.call('iis-default-web-site'),
|
||||
|
|
|
@ -7,7 +7,7 @@ require 'inspec/resource'
|
|||
describe 'Inspec::Resources::IisAppPool' do
|
||||
it 'verify default app pool settings' do
|
||||
resource = MockLoader.new(:windows).load_resource('iis_app_pool', 'DefaultAppPool')
|
||||
_(resource.send('to_s')).must_equal 'iis_app_pool \'DefaultAppPool\''
|
||||
_(resource.send('to_s')).must_equal 'IIS App Pool \'DefaultAppPool\''
|
||||
_(resource.send('pool_name')).must_equal 'DefaultAppPool'
|
||||
_(resource.send('runtime_version')).must_equal 'v4.0'
|
||||
_(resource.send('enable32bit')).must_equal true
|
||||
|
|
Loading…
Reference in a new issue