|
| 1 | +# encoding: utf-8 |
1 | 2 | # All checks from http://docs.openstack.org/security-guide/block-storage/checklist.html |
2 | 3 |
|
3 | 4 | cinder_conf_dir = '/etc/cinder' |
4 | 5 | cinder_conf_file = "#{cinder_conf_dir}/cinder.conf" |
5 | 6 |
|
6 | 7 | control 'check-block-01' do |
7 | | - |
8 | 8 | title 'Cinder config files should be owned by root user and cinder group.' |
9 | | - |
10 | 9 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-01-is-user-group-ownership-of-config-files-set-to-root-cinder' |
11 | 10 |
|
12 | 11 | describe file(cinder_conf_file) do |
|
25 | 24 | it { should be_owned_by 'root' } |
26 | 25 | its('group') { should eq 'cinder' } |
27 | 26 | end |
28 | | - |
29 | 27 | end |
30 | 28 |
|
31 | 29 | control 'check-block-02' do |
32 | | - |
33 | 30 | title 'Strict permissions should be set for all Cinder config files.' |
34 | | - |
35 | 31 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-02-are-strict-permissions-set-for-configuration-files' |
36 | 32 |
|
37 | 33 | describe file(cinder_conf_file) do |
|
46 | 42 | describe file("#{cinder_conf_dir}/rootwrap.conf") do |
47 | 43 | its('mode') { should cmp '0640' } |
48 | 44 | end |
49 | | - |
50 | 45 | end |
51 | 46 |
|
52 | 47 | control 'check-block-03' do |
53 | | - |
54 | 48 | title 'Cinder should use Keystone for authentication.' |
55 | | - |
56 | 49 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-03-is-keystone-used-for-authentication' |
57 | 50 |
|
58 | 51 | # nil is acceptable as keystone is default value |
59 | 52 | describe ini(cinder_conf_file) do |
60 | | - its(['DEFAULT','auth_strategy']) { should be_nil.or eq "keystone" } |
| 53 | + its(['DEFAULT', 'auth_strategy']) { should be_nil.or eq 'keystone' } |
61 | 54 | end |
62 | | - |
63 | 55 | end |
64 | 56 |
|
65 | 57 | control 'check-block-04' do |
66 | | - |
67 | 58 | title 'Cinder should communicate with Keystone using TLS.' |
68 | | - |
69 | 59 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-04-is-tls-enabled-for-authentication' |
70 | 60 |
|
71 | 61 | describe ini(cinder_conf_file) do |
72 | | - its(['keystone_authtoken','auth_uri']) { should match /^https:/ } |
73 | | - |
| 62 | + its(['keystone_authtoken', 'auth_uri']) { should match(/^https:/) } |
74 | 63 | # nil is acceptable as false is the default value |
75 | | - its(['keystone_authtoken','insecure']) { should be_nil.or eq "False" } |
| 64 | + its(['keystone_authtoken', 'insecure']) { should be_nil.or eq 'False' } |
76 | 65 | end |
77 | | - |
78 | 66 | end |
79 | 67 |
|
80 | 68 | control 'check-block-05' do |
81 | | - |
82 | 69 | title 'Cinder should communicate with Nova using TLS.' |
83 | | - |
84 | 70 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-05-does-cinder-communicate-with-nova-over-tls' |
85 | 71 |
|
86 | 72 | # nil is acceptable as false is the default value |
87 | 73 | describe ini(cinder_conf_file) do |
88 | | - its(['DEFAULT','nova_api_insecure']) { should be_nil.or eq "False" } |
| 74 | + its(['DEFAULT', 'nova_api_insecure']) { should be_nil.or eq 'False' } |
89 | 75 | end |
90 | | - |
91 | 76 | end |
92 | 77 |
|
93 | 78 | control 'check-block-06' do |
94 | | - |
95 | 79 | title 'Cinder should communicate with Glance using TLS.' |
96 | | - |
97 | 80 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-06-does-cinder-communicate-with-glance-over-tls' |
98 | 81 |
|
99 | 82 | describe ini(cinder_conf_file) do |
100 | 83 | # nil is acceptable as the glance endpoint may be sourced from Keystone based on the value of glance_catalog_info |
101 | | - its(['DEFAULT','glance_api_servers']) { should be_nil.or match /^https:/ } |
102 | | - |
| 84 | + its(['DEFAULT', 'glance_api_servers']) { should be_nil.or match(/^https:/) } |
103 | 85 | # nil is acceptable as false is the default value |
104 | | - its(['DEFAULT','glance_api_insecure']) { should be_nil.or eq "False" } |
| 86 | + its(['DEFAULT', 'glance_api_insecure']) { should be_nil.or eq 'False' } |
105 | 87 | end |
106 | 88 | end |
107 | 89 |
|
108 | 90 | control 'check-block-07' do |
109 | | - |
110 | 91 | title 'Cinder should use secure NAS permissions.' |
111 | | - |
112 | 92 | ref 'http://docs.openstack.org/security-guide/block-storage/checklist.html#check-block-07-is-nas-operating-in-a-secure-environment' |
113 | 93 |
|
114 | 94 | cinder_conf = ini(cinder_conf_file) |
115 | 95 |
|
116 | 96 | only_if do |
117 | | - cinder_conf.value(['DEFAULT','nas_host']) != nil |
| 97 | + cinder_conf.value(['DEFAULT', 'nas_host']).nil? |
118 | 98 | end |
119 | 99 |
|
120 | 100 | describe ini(cinder_conf_file) do |
121 | 101 | # nil is acceptable as auto is the default value |
122 | | - its(['DEFAULT','nas_secure_file_permissions']) { should be_nil.or eq("True").or eq("auto") } |
123 | | - |
| 102 | + its(['DEFAULT', 'nas_secure_file_permissions']) { should be_nil.or eq('True').or eq('auto') } |
124 | 103 | # nil is acceptable as auto is the default value |
125 | | - its(['DEFAULT','nas_secure_file_operations']) { should be_nil.or eq("True").or eq("auto") } |
| 104 | + its(['DEFAULT', 'nas_secure_file_operations']) { should be_nil.or eq('True').or eq('auto') } |
126 | 105 | end |
127 | | - |
128 | 106 | end |
129 | 107 |
|
130 | 108 | control 'check-block-08' do |
|
135 | 113 |
|
136 | 114 | describe ini(cinder_conf_file) do |
137 | 115 | # nil is acceptable as 114688 is the default value |
138 | | - its(['DEFAULT','osapi_max_request_body_size']) { should be_nil.or be >= 114688 } |
| 116 | + its(['DEFAULT', 'osapi_max_request_body_size']) { should be_nil.or be >= 114688 } |
139 | 117 | end |
140 | 118 | end |
0 commit comments