inspec 0.27.1 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -2
- data/README.md +2 -0
- data/lib/inspec/plugins/resource.rb +0 -2
- data/lib/inspec/resource.rb +1 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/mssql_session.rb +33 -0
- data/lib/resources/port.rb +25 -9
- data/test/bench/startup.flat.txt +998 -0
- data/test/bench/startup.graph.html +71420 -0
- data/test/bench/startup.grind.dat +103554 -0
- data/test/bench/startup.stack.html +25015 -0
- data/test/bench/startup/startup.flat.txt +1005 -0
- data/test/bench/startup/startup.graph.html +71958 -0
- data/test/bench/startup/startup.grind.dat +101602 -0
- data/test/bench/startup/startup.stack.html +24516 -0
- data/test/helper.rb +1 -0
- data/test/unit/mock/cmd/netstat-an.utf8 +13 -0
- data/test/unit/resources/port_test.rb +28 -1
- metadata +21 -2
data/test/helper.rb
CHANGED
@@ -164,6 +164,7 @@ class MockLoader
|
|
164
164
|
'/sbin/sysctl -q -n net.ipv4.conf.all.forwarding' => cmd.call('sbin_sysctl'),
|
165
165
|
# ports on windows
|
166
166
|
'Get-NetTCPConnection | Select-Object -Property State, Caption, Description, LocalAddress, LocalPort, RemoteAddress, RemotePort, DisplayName, Status | ConvertTo-Json' => cmd.call('get-net-tcpconnection'),
|
167
|
+
'netstat -an' => cmd.call('netstat-an.utf8'),
|
167
168
|
# lsof formatted list of ports (should be quite cross platform)
|
168
169
|
'lsof -nP -i -FpctPn' => cmd.call('lsof-nP-i-FpctPn'),
|
169
170
|
# ports on linux
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
Active Connections
|
3
|
+
|
4
|
+
Proto Local Address Foreign Address State
|
5
|
+
TCP 0.0.0.0:22 0.0.0.0:0 LISTENING
|
6
|
+
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
|
7
|
+
TCP 10.209.66.139:3389 10.209.88.35:60413 ESTABLISHED
|
8
|
+
TCP 10.209.66.139:53843 10.209.10.18:80 CLOSE_WAIT
|
9
|
+
TCP [::]:135 [::]:0 LISTENING
|
10
|
+
TCP [::]:445 [::]:0 LISTENING
|
11
|
+
UDP 0.0.0.0:123 *:*
|
12
|
+
UDP 0.0.0.0:161 *:*
|
13
|
+
UDP [::]:123 *:*
|
@@ -52,7 +52,7 @@ describe 'Inspec::Resources::Port' do
|
|
52
52
|
_(resource.addresses).must_equal ["127.0.0.1"]
|
53
53
|
end
|
54
54
|
|
55
|
-
it 'verify port on Windows' do
|
55
|
+
it 'verify port on Windows 2012' do
|
56
56
|
resource = MockLoader.new(:windows).load_resource('port', 135)
|
57
57
|
_(resource.listening?).must_equal true
|
58
58
|
_(resource.protocols).must_equal ['tcp']
|
@@ -60,6 +60,33 @@ describe 'Inspec::Resources::Port' do
|
|
60
60
|
_(resource.addresses).must_equal ["::", "192.168.10.157"]
|
61
61
|
end
|
62
62
|
|
63
|
+
it 'verify port on Windows 2008 (unpriviledged)' do
|
64
|
+
ml = MockLoader.new(:windows)
|
65
|
+
# kill windows 2012 shell commands
|
66
|
+
ml.backend.backend.commands
|
67
|
+
.select { |k, _| k.start_with? 'Get-NetTCPConnection' }
|
68
|
+
.values.each { |r| r.stdout = '' }
|
69
|
+
|
70
|
+
resource = ml.load_resource('port', 135)
|
71
|
+
_(resource.listening?).must_equal true
|
72
|
+
_(resource.protocols).must_equal ['tcp']
|
73
|
+
_(resource.processes).must_equal []
|
74
|
+
_(resource.addresses).must_equal %w{0.0.0.0 ::}
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'verify port list on Windows 2008 (unpriviledged)' do
|
78
|
+
ml = MockLoader.new(:windows)
|
79
|
+
# kill windows 2012 shell commands
|
80
|
+
ml.backend.backend.commands
|
81
|
+
.select { |k, _| k.start_with? 'Get-NetTCPConnection' }
|
82
|
+
.values.each { |r| r.stdout = '' }
|
83
|
+
|
84
|
+
resource = ml.load_resource('port')
|
85
|
+
resource.entries.length.must_equal 9
|
86
|
+
resource.protocols('tcp').entries.length.must_equal 6
|
87
|
+
resource.protocols('udp').entries.length.must_equal 3
|
88
|
+
end
|
89
|
+
|
63
90
|
it 'verify port on FreeBSD' do
|
64
91
|
resource = MockLoader.new(:freebsd10).load_resource('port', 22)
|
65
92
|
_(resource.listening?).must_equal true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -338,6 +338,7 @@ files:
|
|
338
338
|
- lib/resources/limits_conf.rb
|
339
339
|
- lib/resources/login_def.rb
|
340
340
|
- lib/resources/mount.rb
|
341
|
+
- lib/resources/mssql_session.rb
|
341
342
|
- lib/resources/mysql.rb
|
342
343
|
- lib/resources/mysql_conf.rb
|
343
344
|
- lib/resources/mysql_session.rb
|
@@ -385,6 +386,14 @@ files:
|
|
385
386
|
- lib/utils/plugin_registry.rb
|
386
387
|
- lib/utils/simpleconfig.rb
|
387
388
|
- tasks/maintainers.rb
|
389
|
+
- test/bench/startup.flat.txt
|
390
|
+
- test/bench/startup.graph.html
|
391
|
+
- test/bench/startup.grind.dat
|
392
|
+
- test/bench/startup.stack.html
|
393
|
+
- test/bench/startup/startup.flat.txt
|
394
|
+
- test/bench/startup/startup.graph.html
|
395
|
+
- test/bench/startup/startup.grind.dat
|
396
|
+
- test/bench/startup/startup.stack.html
|
388
397
|
- test/cookbooks/os_prepare/attributes/default.rb
|
389
398
|
- test/cookbooks/os_prepare/files/empty.iso
|
390
399
|
- test/cookbooks/os_prepare/files/example.csv
|
@@ -510,6 +519,7 @@ files:
|
|
510
519
|
- test/unit/mock/cmd/lsof-nP-i-FpctPn
|
511
520
|
- test/unit/mock/cmd/mount
|
512
521
|
- test/unit/mock/cmd/mount-multiple
|
522
|
+
- test/unit/mock/cmd/netstat-an.utf8
|
513
523
|
- test/unit/mock/cmd/netstat-tulpen
|
514
524
|
- test/unit/mock/cmd/npm-ls-g--json-bower
|
515
525
|
- test/unit/mock/cmd/pacman-qi-curl
|
@@ -671,6 +681,14 @@ signing_key:
|
|
671
681
|
specification_version: 4
|
672
682
|
summary: Infrastructure and compliance testing.
|
673
683
|
test_files:
|
684
|
+
- test/bench/startup.flat.txt
|
685
|
+
- test/bench/startup.graph.html
|
686
|
+
- test/bench/startup.grind.dat
|
687
|
+
- test/bench/startup.stack.html
|
688
|
+
- test/bench/startup/startup.flat.txt
|
689
|
+
- test/bench/startup/startup.graph.html
|
690
|
+
- test/bench/startup/startup.grind.dat
|
691
|
+
- test/bench/startup/startup.stack.html
|
674
692
|
- test/cookbooks/os_prepare/attributes/default.rb
|
675
693
|
- test/cookbooks/os_prepare/files/empty.iso
|
676
694
|
- test/cookbooks/os_prepare/files/example.csv
|
@@ -796,6 +814,7 @@ test_files:
|
|
796
814
|
- test/unit/mock/cmd/lsof-nP-i-FpctPn
|
797
815
|
- test/unit/mock/cmd/mount
|
798
816
|
- test/unit/mock/cmd/mount-multiple
|
817
|
+
- test/unit/mock/cmd/netstat-an.utf8
|
799
818
|
- test/unit/mock/cmd/netstat-tulpen
|
800
819
|
- test/unit/mock/cmd/npm-ls-g--json-bower
|
801
820
|
- test/unit/mock/cmd/pacman-qi-curl
|