|
334 | 334 | it { should_not be_readable.by('other') }
|
335 | 335 | end
|
336 | 336 | end
|
| 337 | + |
| 338 | +control 'os-17' do |
| 339 | + impact 1.0 |
| 340 | + title 'Check owner and permissions for /etc/group' |
| 341 | + desc 'Check periodically the owner and permissions for /etc/group' |
| 342 | + describe file('/etc/group') do |
| 343 | + it { should exist } |
| 344 | + it { should be_file } |
| 345 | + it { should be_owned_by 'root' } |
| 346 | + its('group') { should eq 'root' } |
| 347 | + it { should_not be_executable } |
| 348 | + it { should be_writable.by('owner') } |
| 349 | + it { should be_readable.by('owner') } |
| 350 | + it { should_not be_writable.by('group') } |
| 351 | + it { should be_readable.by('group') } |
| 352 | + it { should_not be_writable.by('other') } |
| 353 | + it { should be_readable.by('other') } |
| 354 | + end |
| 355 | +end |
| 356 | + |
| 357 | +control 'os-18' do |
| 358 | + impact 1.0 |
| 359 | + title 'Check owner and permissions for /etc/passwd-' |
| 360 | + desc 'Check periodically the owner and permissions for /etc/passwd-' |
| 361 | + only_if('/etc/passwd- exists') do |
| 362 | + file('/etc/passwd-').exist? |
| 363 | + end |
| 364 | + describe file('/etc/passwd-') do |
| 365 | + it { should be_file } |
| 366 | + it { should be_owned_by 'root' } |
| 367 | + its('group') { should eq 'root' } |
| 368 | + it { should_not be_executable } |
| 369 | + it { should be_writable.by('owner') } |
| 370 | + it { should be_readable.by('owner') } |
| 371 | + it { should_not be_writable.by('group') } |
| 372 | + it { should be_readable.by('group') } |
| 373 | + it { should_not be_writable.by('other') } |
| 374 | + it { should be_readable.by('other') } |
| 375 | + end |
| 376 | +end |
| 377 | + |
| 378 | +control 'os-19' do |
| 379 | + impact 1.0 |
| 380 | + title 'Check owner and permissions for /etc/group-' |
| 381 | + desc 'Check periodically the owner and permissions for /etc/group-' |
| 382 | + only_if('/etc/group- exists') do |
| 383 | + file('/etc/group-').exist? |
| 384 | + end |
| 385 | + describe file('/etc/group-') do |
| 386 | + it { should be_owned_by 'root' } |
| 387 | + its('group') { should eq 'root' } |
| 388 | + it { should_not be_executable } |
| 389 | + it { should be_writable.by('owner') } |
| 390 | + it { should be_readable.by('owner') } |
| 391 | + it { should_not be_writable.by('group') } |
| 392 | + it { should be_readable.by('group') } |
| 393 | + it { should_not be_writable.by('other') } |
| 394 | + it { should be_readable.by('other') } |
| 395 | + end |
| 396 | +end |
0 commit comments