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