|
123 | 123 | impact 1.0
|
124 | 124 |
|
125 | 125 | tag cis: 'distribution-independent-linux:1.1.1.8'
|
126 |
| - tag level: 1 |
| 126 | + tag level: 2 |
127 | 127 |
|
128 | 128 | describe kernel_module('vfat') do
|
129 | 129 | it { should_not be_loaded }
|
130 | 130 | it { should be_disabled }
|
131 | 131 | end
|
| 132 | + |
| 133 | + only_if { cis_level == 2 } |
132 | 134 | end
|
133 | 135 |
|
134 | 136 | control 'cis-dil-benchmark-1.1.2' do
|
|
153 | 155 | tag level: 1
|
154 | 156 |
|
155 | 157 | describe mount('/tmp') do
|
156 |
| - its(:options) { should include 'nodev' } |
| 158 | + its('options') { should include 'nodev' } |
157 | 159 | end
|
158 | 160 | end
|
159 | 161 |
|
|
166 | 168 | tag level: 1
|
167 | 169 |
|
168 | 170 | describe mount('/tmp') do
|
169 |
| - its(:options) { should include 'nosuid' } |
| 171 | + its('options') { should include 'nosuid' } |
170 | 172 | end
|
171 | 173 | end
|
172 | 174 |
|
|
179 | 181 | tag level: 1
|
180 | 182 |
|
181 | 183 | describe mount('/tmp') do
|
182 |
| - its(:options) { should include 'noexec' } |
| 184 | + its('options') { should include 'noexec' } |
183 | 185 | end
|
184 | 186 | end
|
185 | 187 |
|
|
219 | 221 | tag cis: 'distribution-independent-linux:1.1.8'
|
220 | 222 | tag level: 1
|
221 | 223 |
|
| 224 | + only_if('/var/tmp is mounted') do |
| 225 | + mount('/var/tmp').mounted? |
| 226 | + end |
| 227 | + |
222 | 228 | describe mount('/var/tmp') do
|
223 |
| - its(:options) { should include 'nodev' } |
| 229 | + its('options') { should include 'nodev' } |
224 | 230 | end
|
| 231 | + |
225 | 232 | end
|
226 | 233 |
|
227 | 234 | control 'cis-dil-benchmark-1.1.9' do
|
|
232 | 239 | tag cis: 'distribution-independent-linux:1.1.9'
|
233 | 240 | tag level: 1
|
234 | 241 |
|
| 242 | + only_if('/var/tmp is mounted') do |
| 243 | + mount('/var/tmp').mounted? |
| 244 | + end |
| 245 | + |
235 | 246 | describe mount('/var/tmp') do
|
236 |
| - its(:options) { should include 'nosuid' } |
| 247 | + its('options') { should include 'nosuid' } |
237 | 248 | end
|
| 249 | + |
238 | 250 | end
|
239 | 251 |
|
240 | 252 | control 'cis-dil-benchmark-1.1.10' do
|
|
245 | 257 | tag cis: 'distribution-independent-linux:1.1.10'
|
246 | 258 | tag level: 1
|
247 | 259 |
|
| 260 | + only_if('/var/tmp is mounted') do |
| 261 | + mount('/var/tmp').mounted? |
| 262 | + end |
| 263 | + |
248 | 264 | describe mount('/var/tmp') do
|
249 |
| - its(:options) { should include 'noexec' } |
| 265 | + its('options') { should include 'noexec' } |
250 | 266 | end
|
| 267 | + |
251 | 268 | end
|
252 | 269 |
|
253 | 270 | control 'cis-dil-benchmark-1.1.11' do
|
|
302 | 319 | tag cis: 'distribution-independent-linux:1.1.14'
|
303 | 320 | tag level: 1
|
304 | 321 |
|
| 322 | + only_if('/home is mounted') do |
| 323 | + mount('/home').mounted? |
| 324 | + end |
| 325 | + |
305 | 326 | describe mount('/home') do
|
306 |
| - its(:options) { should include 'nodev' } |
| 327 | + its('options') { should include 'nodev' } |
307 | 328 | end
|
308 | 329 | end
|
309 | 330 |
|
|
315 | 336 | tag cis: 'distribution-independent-linux:1.1.15'
|
316 | 337 | tag level: 1
|
317 | 338 |
|
| 339 | + only_if('/dev/shm is mounted') do |
| 340 | + mount('/dev/shm').mounted? |
| 341 | + end |
| 342 | + |
318 | 343 | describe mount('/dev/shm') do
|
319 |
| - its(:options) { should include 'nodev' } |
| 344 | + its('options') { should include 'nodev' } |
320 | 345 | end
|
321 | 346 | end
|
322 | 347 |
|
|
328 | 353 | tag cis: 'distribution-independent-linux:1.1.16'
|
329 | 354 | tag level: 1
|
330 | 355 |
|
| 356 | + only_if('/dev/shm is mounted') do |
| 357 | + mount('/dev/shm').mounted? |
| 358 | + end |
| 359 | + |
331 | 360 | describe mount('/dev/shm') do
|
332 |
| - its(:options) { should include 'nosuid' } |
| 361 | + its('options') { should include 'nosuid' } |
333 | 362 | end
|
334 | 363 | end
|
335 | 364 |
|
|
342 | 371 | tag level: 1
|
343 | 372 |
|
344 | 373 | describe mount('/dev/shm') do
|
345 |
| - its(:options) { should include 'noexec' } |
| 374 | + its('options') { should include 'noexec' } |
| 375 | + end |
| 376 | + |
| 377 | + only_if('/dev/shm is mounted') do |
| 378 | + mount('/dev/shm').mounted? |
346 | 379 | end
|
347 | 380 | end
|
348 | 381 |
|
|
394 | 427 | tag level: 1
|
395 | 428 |
|
396 | 429 | describe command("df --local -P | awk '{ if (NR!=1) print $6 }' | xargs -I '{}' find '{}' -xdev -type d \( -perm -0002 -a ! -perm -1000 \)") do
|
397 |
| - its(:stdout) { should eq '' } |
| 430 | + its('stdout') { should cmp '' } |
398 | 431 | end
|
399 | 432 | end
|
400 | 433 |
|
|
418 | 451 | end
|
419 | 452 | end
|
420 | 453 | end
|
| 454 | + |
| 455 | +control 'cis-dil-benchmark-1.1.23' do |
| 456 | + title 'Disable USB Storage' |
| 457 | + desc ' |
| 458 | + USB storage provides a means to transfer and store files insuring persistence and availability of the files independent of network connection status. |
| 459 | + Its popularity and utility has led to USB-based malware being a simple and common means for network infiltration and a first step to establishing |
| 460 | + a persistent threat within a networked environment. |
| 461 | + ' |
| 462 | + impact 1.0 |
| 463 | + |
| 464 | + tag cis: 'distribution-independent-linux:1.1.23' |
| 465 | + tag level: 1 |
| 466 | + |
| 467 | + # kernel modules need to use underscores |
| 468 | + # ref: https://github.com/inspec/inspec/issues/5190 |
| 469 | + describe kernel_module('usb_storage') do |
| 470 | + it { should_not be_loaded } |
| 471 | + it { should be_disabled } |
| 472 | + end |
| 473 | +end |
0 commit comments