2020-07-18 18:23:58 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
control 'apache server_status configuration' do
|
|
|
|
title 'should match desired lines'
|
|
|
|
|
2020-07-18 18:26:39 +02:00
|
|
|
server_status_stanza = <<~SS_STANZA
|
|
|
|
<Location "/server-status">
|
|
|
|
SetHandler server-status
|
|
|
|
Require local
|
|
|
|
Require host foo.example.com
|
|
|
|
Require ip 10.8.8.0/24
|
|
|
|
</Location>
|
|
|
|
SS_STANZA
|
2020-07-18 18:23:58 +02:00
|
|
|
|
|
|
|
confdir =
|
2021-04-03 23:39:56 +02:00
|
|
|
case system.platform[:family]
|
2020-07-18 18:23:58 +02:00
|
|
|
when 'debian'
|
|
|
|
'/etc/apache2/conf-available'
|
|
|
|
when 'redhat', 'fedora'
|
|
|
|
'/etc/httpd/conf.d'
|
|
|
|
when 'suse'
|
|
|
|
'/etc/apache2/conf.d'
|
2021-04-03 23:39:56 +02:00
|
|
|
when 'arch'
|
2020-07-18 18:23:58 +02:00
|
|
|
'/etc/httpd/conf/extra'
|
2021-04-03 23:39:56 +02:00
|
|
|
when 'bsd'
|
|
|
|
'/usr/local/etc/apache24/extra'
|
2020-07-18 18:23:58 +02:00
|
|
|
end
|
|
|
|
|
2021-04-03 23:39:56 +02:00
|
|
|
conffile, conffile_group =
|
|
|
|
case system.platform[:family]
|
|
|
|
when 'bsd'
|
|
|
|
%W[#{confdir}/server-status wheel]
|
|
|
|
else
|
|
|
|
%W[#{confdir}/server-status.conf root]
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file(conffile) do
|
2020-07-18 18:23:58 +02:00
|
|
|
it { should be_file }
|
|
|
|
it { should be_owned_by 'root' }
|
2021-04-03 23:39:56 +02:00
|
|
|
it { should be_grouped_into conffile_group }
|
2020-07-18 18:23:58 +02:00
|
|
|
its('mode') { should cmp '0644' }
|
|
|
|
its('content') { should include '# File managed by Salt' }
|
|
|
|
its('content') { should include server_status_stanza }
|
|
|
|
end
|
|
|
|
end
|