603e337fe1fe60236bcf8ec1ea975623fdecd80a
[arvados-formula.git] / test / integration / shell / controls / config_spec.rb
1 # frozen_string_literal: true
2
3 control 'shellinabox configuration' do
4   title 'should match desired lines'
5
6   case os[:name]
7   when 'centos'
8     file = '/etc/sysconfig/shellinaboxd'
9     tpl = 'RedHat'
10     siab_stanza = <<~SIAB_STANZA
11       PORT=4200
12       # SSL is disabled because it is terminated in Nginx. Adjust as needed.
13       OPTS="--disable-ssl --no-beep --service=/shell.fixme.example.net:SSH"
14     SIAB_STANZA
15   when 'debian', 'ubuntu'
16     file = '/etc/default/shellinabox'
17     tpl = 'default'
18     siab_stanza = <<~SIAB_STANZA
19       SHELLINABOX_PORT=4200
20       # SSL is disabled because it is terminated in Nginx. Adjust as needed.
21       SHELLINABOX_ARGS="--disable-ssl --no-beep --service=/shell.fixme.example.net:AUTH:HOME:SHELL"
22     SIAB_STANZA
23   end
24   describe file(file) do
25     it { should be_file }
26     it { should be_owned_by 'root' }
27     it { should be_grouped_into 'root' }
28     its('mode') { should cmp '0644' }
29     its('content') do
30       should include(
31         # rubocop:disable Layout/LineLength
32         "File managed by Salt at <salt://arvados/shell/config/files/#{tpl}/shell-shellinabox.tmpl.jinja>."
33         # rubocop:enable Layout/LineLength
34       )
35     end
36     its('content') { should include(siab_stanza) }
37   end
38 end
39
40 control 'libpam-arvados configuration' do
41   title 'should match desired lines'
42
43   libpam_stanza = <<~LIBPAM_STANZA
44     auth [success=1 default=ignore] /usr/lib/pam_arvados.so fixme.example.net shell.fixme.example.net
45   LIBPAM_STANZA
46
47   describe file('/etc/pam.d/arvados') do
48     it { should be_file }
49     it { should be_owned_by 'root' }
50     it { should be_grouped_into 'root' }
51     its('mode') { should cmp '0644' }
52     its('content') do
53       should include(
54         # rubocop:disable Layout/LineLength
55         'File managed by Salt at <salt://arvados/shell/config/files/default/shell-libpam-arvados.tmpl.jinja>.'
56         # rubocop:enable Layout/LineLength
57       )
58     end
59     its('content') { should include(libpam_stanza) }
60   end
61 end