|
| 1 | +# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"). |
| 4 | +# You may not use this file except in compliance with the License. A copy of the License is located at |
| 5 | +# |
| 6 | +# http://aws.amazon.com/apache2.0/ |
| 7 | +# |
| 8 | +# or in the "LICENSE.txt" file accompanying this file. |
| 9 | +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. |
| 10 | +# See the License for the specific language governing permissions and limitations under the License. |
| 11 | + |
| 12 | +control 'tag:config_cfn_hup_conf_files_created' do |
| 13 | + title "cfn_hup configuration files and directories should be created" |
| 14 | + |
| 15 | + %w(/etc/cfn /etc/cfn/hooks.d).each do |dir| |
| 16 | + describe directory(dir) do |
| 17 | + it { should exist } |
| 18 | + its('mode') { should cmp '0770' } |
| 19 | + its('owner') { should eq 'root' } |
| 20 | + its('group') { should eq 'root' } |
| 21 | + end |
| 22 | + end |
| 23 | + |
| 24 | + %w(/etc/cfn/cfn-hup.conf /etc/cfn/hooks.d/pcluster-update.conf).each do |conf_file| |
| 25 | + describe file(conf_file) do |
| 26 | + it { should exist } |
| 27 | + its('mode') { should cmp '0400' } |
| 28 | + its('owner') { should eq 'root' } |
| 29 | + its('group') { should eq 'root' } |
| 30 | + end |
| 31 | + end |
| 32 | +end |
| 33 | + |
| 34 | +control 'tag:config_cfn_hup_head_node_configuration' do |
| 35 | + title "cfn_hup configuration files and directories for HeadNode should be created" |
| 36 | + only_if { instance.head_node? } |
| 37 | + |
| 38 | + describe file("#{node['cluster']['scripts_dir']}/get_compute_user_data.py") do |
| 39 | + it { should exist } |
| 40 | + its('mode') { should cmp '0400' } |
| 41 | + its('owner') { should eq 'root' } |
| 42 | + its('group') { should eq 'root' } |
| 43 | + end |
| 44 | + |
| 45 | + describe directory("#{node['cluster']['base_dir']}/dna") do |
| 46 | + it { should exist } |
| 47 | + end |
| 48 | +end |
| 49 | + |
| 50 | +control 'tag:config_cfn_hup_compute_configuration' do |
| 51 | + title "cfn_hup configuration files and directories for ComputeFleet should be created" |
| 52 | + only_if { instance.compute_node? } |
| 53 | + |
| 54 | + describe file("#{node['cluster']['scripts_dir']}/cfn-hup-update-action.sh") do |
| 55 | + it { should exist } |
| 56 | + its('mode') { should cmp '0744' } |
| 57 | + its('owner') { should eq 'root' } |
| 58 | + its('group') { should eq 'root' } |
| 59 | + end |
| 60 | +end |
0 commit comments