Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion container.inputs.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
is_system_networked: true
is_system_networked: true
disable_fips: true
sudo_accounts: [""]
25 changes: 16 additions & 9 deletions controls/SV-238197.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,25 @@
tag fix_id: 'F-41366r653765_fix '
tag cci: ['CCI-000048']
tag nist: ['AC-8 a']
tag 'host', 'container'
tag 'host'

xorg_status = command('which Xorg').exit_status

if xorg_status == 0
describe 'banner-message-enable must be set to true' do
subject { command('grep banner-message-enable /etc/dconf/db/local.d/*') }
its('stdout') { should match(/(banner-message-enable).+=.+(true)/) }
if virtualization.system.eql?('docker')
impact 0.0
describe 'This control is Not Applicable inside a container' do
skip 'This control is Not Applicable inside a container'
end
else
describe command('which Xorg').exit_status do
skip("GUI not installed.\nwhich Xorg exit_status: " + command('which Xorg').exit_status.to_s)
xorg_status = command('which Xorg').exit_status

if xorg_status == 0
describe 'banner-message-enable must be set to true' do
subject { command('grep banner-message-enable /etc/dconf/db/local.d/*') }
its('stdout') { should match(/(banner-message-enable).+=.+(true)/) }
end
else
describe command('which Xorg').exit_status do
skip("GUI not installed.\nwhich Xorg exit_status: " + command('which Xorg').exit_status.to_s)
end
end
end
end
31 changes: 19 additions & 12 deletions controls/SV-238198.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,28 @@
tag fix_id: 'F-41367r653768_fix '
tag cci: ['CCI-000048']
tag nist: ['AC-8 a']
tag 'host', 'container'
tag 'host'

banner_text = input('banner_text')
clean_banner = banner_text.gsub(/[\r\n\s]/, '')
gdm3_defaults_file = input('gdm3_config_file')

if package('gdm3').installed?
describe 'The SSHD Banner is set to the standard banner and has the correct text' do
subject { file(gdm3_defaults_file).content.gsub(/[\r\n\s]/, '') }
it { should cmp clean_banner }
if virtualization.system.eql?('docker')
impact 0.0
describe 'This control is Not Applicable inside a container' do
skip 'This control is Not Applicable inside a container'
end
else
impact 0.0
describe 'Package gdm3 not installed' do
skip 'Package gdm3 not installed, this control Not Applicable'
banner_text = input('banner_text')
clean_banner = banner_text.gsub(/[\r\n\s]/, '')
gdm3_defaults_file = input('gdm3_config_file')

if package('gdm3').installed?
describe 'The SSHD Banner is set to the standard banner and has the correct text' do
subject { file(gdm3_defaults_file).content.gsub(/[\r\n\s]/, '') }
it { should cmp clean_banner }
end
else
impact 0.0
describe 'Package gdm3 not installed' do
skip 'Package gdm3 not installed, this control Not Applicable'
end
end
end
end
43 changes: 25 additions & 18 deletions controls/SV-238215.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,30 @@
tag fix_id: 'F-41384r653819_fix '
tag cci: %w(CCI-002418 CCI-002420 CCI-002422)
tag nist: ['SC-8', 'SC-8 (2)']
tag 'host', 'container'

describe package('openssh-client') do
it { should be_installed }
end

describe package('openssh-server') do
it { should be_installed }
end

describe package('openssh-sftp-server') do
it { should be_installed }
end

describe service('sshd') do
it { should be_enabled }
it { should be_installed }
it { should be_running }
tag 'host'

if virtualization.system.eql?('docker')
impact 0.0
describe 'This control is Not Applicable inside a container' do
skip 'This control is Not Applicable inside a container'
end
else
describe package('openssh-client') do
it { should be_installed }
end

describe package('openssh-server') do
it { should be_installed }
end

describe package('openssh-sftp-server') do
it { should be_installed }
end

describe service('sshd') do
it { should be_enabled }
it { should be_installed }
it { should be_running }
end
end
end
Loading