simp-beaker-helpers 1.7.4 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simp/beaker_helpers/inspec.rb +1 -1
- data/lib/simp/beaker_helpers/ssg.rb +26 -15
- data/lib/simp/beaker_helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93c78d82485d85c17c4cada7add74c40af92708e
|
4
|
+
data.tar.gz: afda67f5043ec29f2b9818babf53f84ecd8be7e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b08c5c3a63797b3c2d5ad3e113fe19df75421e0cb1df029eab61a345c6c4bd9db1d93c64f5c45a1f5d1d21c61bd950728ea54a9b5e8ce9f5a3302c76d07f90bc
|
7
|
+
data.tar.gz: 7aad872f5c8ca108725c5f2a4231a06146b80df65e1e92fea2891bf80e0b0fcdae26191e545989e4f024b07bf5edce31fddd0b229694e7b93a5f1952e077bd2c
|
@@ -21,15 +21,17 @@ module Simp::BeakerHelpers
|
|
21
21
|
'6' => {
|
22
22
|
'required_packages' => EL_PACKAGES,
|
23
23
|
'ssg' => {
|
24
|
-
'
|
25
|
-
'
|
24
|
+
'profile_target' => 'rhel6',
|
25
|
+
'build_target' => 'rhel6',
|
26
|
+
'datastream' => 'ssg-rhel6-ds.xml'
|
26
27
|
}
|
27
28
|
},
|
28
29
|
'7' => {
|
29
30
|
'required_packages' => EL_PACKAGES,
|
30
31
|
'ssg' => {
|
31
|
-
'
|
32
|
-
'
|
32
|
+
'profile_target' => 'rhel7',
|
33
|
+
'build_target' => 'rhel7',
|
34
|
+
'datastream' => 'ssg-rhel7-ds.xml'
|
33
35
|
}
|
34
36
|
}
|
35
37
|
},
|
@@ -37,20 +39,24 @@ module Simp::BeakerHelpers
|
|
37
39
|
'6' => {
|
38
40
|
'required_packages' => EL_PACKAGES,
|
39
41
|
'ssg' => {
|
40
|
-
'
|
41
|
-
'
|
42
|
+
'profile_target' => 'rhel6',
|
43
|
+
'build_target' => 'rhel6',
|
44
|
+
'datastream' => 'ssg-rhel6-ds.xml'
|
42
45
|
}
|
43
46
|
},
|
44
47
|
'7' => {
|
45
48
|
'required_packages' => EL_PACKAGES,
|
46
49
|
'ssg' => {
|
47
|
-
'
|
48
|
-
'
|
50
|
+
'profile_target' => 'rhel7',
|
51
|
+
'build_target' => 'centos7',
|
52
|
+
'datastream' => 'ssg-centos7-ds.xml'
|
49
53
|
}
|
50
54
|
}
|
51
55
|
}
|
52
56
|
}
|
53
57
|
|
58
|
+
attr_accessor :scap_working_dir
|
59
|
+
|
54
60
|
# Create a new SSG helper for the specified host
|
55
61
|
#
|
56
62
|
# @param sut
|
@@ -62,6 +68,10 @@ module Simp::BeakerHelpers
|
|
62
68
|
@os = fact_on(@sut, 'operatingsystem')
|
63
69
|
@os_rel = fact_on(@sut, 'operatingsystemmajrelease')
|
64
70
|
|
71
|
+
sut.mkdir_p('scap_working_dir')
|
72
|
+
|
73
|
+
@scap_working_dir = on(sut, 'cd scap_working_dir && pwd').stdout.strip
|
74
|
+
|
65
75
|
unless OS_INFO[@os]
|
66
76
|
fail("Error: The '#{@os}' Operating System is not supported")
|
67
77
|
end
|
@@ -78,11 +88,12 @@ module Simp::BeakerHelpers
|
|
78
88
|
|
79
89
|
@result_file = "#{@sut.hostname}-ssg-#{Time.now.to_i}"
|
80
90
|
|
91
|
+
|
81
92
|
get_ssg_datastream
|
82
93
|
end
|
83
94
|
|
84
|
-
def
|
85
|
-
OS_INFO[@os][@os_rel]['ssg']['
|
95
|
+
def profile_target
|
96
|
+
OS_INFO[@os][@os_rel]['ssg']['profile_target']
|
86
97
|
end
|
87
98
|
|
88
99
|
def remediate(profile)
|
@@ -90,7 +101,7 @@ module Simp::BeakerHelpers
|
|
90
101
|
end
|
91
102
|
|
92
103
|
def evaluate(profile, remediate=false)
|
93
|
-
cmd =
|
104
|
+
cmd = "cd #{@scap_working_dir}; oscap xccdf eval"
|
94
105
|
|
95
106
|
if remediate
|
96
107
|
cmd += ' --remediate'
|
@@ -104,7 +115,7 @@ module Simp::BeakerHelpers
|
|
104
115
|
on(@sut, cmd, :accept_all_exit_codes => true)
|
105
116
|
|
106
117
|
['xml', 'html'].each do |ext|
|
107
|
-
path = "
|
118
|
+
path = "#{@scap_working_dir}/#{@result_file}.#{ext}"
|
108
119
|
scp_from(@sut, path, @output_dir)
|
109
120
|
|
110
121
|
fail("Could not retrieve #{path} from #{@sut}") unless File.exist?(File.join(@output_dir, "#{@result_file}.#{ext}"))
|
@@ -121,12 +132,12 @@ module Simp::BeakerHelpers
|
|
121
132
|
ssg_release ||= Dir.glob('spec/fixtures/ssg_releases/*.bz2').last
|
122
133
|
|
123
134
|
if ssg_release
|
124
|
-
scp_to(@sut, ssg_release)
|
135
|
+
scp_to(@sut, ssg_release, @scap_working_dir)
|
125
136
|
|
126
|
-
on(@sut, %(mkdir -p scap-security-guide && tar -xj -C scap-security-guide --strip-components 1 -f #{ssg_release} && cp scap-security-guide/*ds.xml
|
137
|
+
on(@sut, %(mkdir -p scap-security-guide && tar -xj -C scap-security-guide --strip-components 1 -f #{ssg_release} && cp scap-security-guide/*ds.xml #{@scap_working_dir}))
|
127
138
|
else
|
128
139
|
on(@sut, %(git clone #{GIT_REPO}))
|
129
|
-
on(@sut, %(cd scap-security-guide/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['
|
140
|
+
on(@sut, %(cd scap-security-guide/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['build_target']}-content && cp *ds.xml #{@scap_working_dir}))
|
130
141
|
end
|
131
142
|
end
|
132
143
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-beaker-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-07-
|
12
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaker
|