|
23 | 23 | title 'Container Runtime' |
24 | 24 |
|
25 | 25 | # attributes |
26 | | -CONTAINER_CAPADD = attribute('container_capadd') |
27 | | -APP_ARMOR_PROFILE = attribute('app_armor_profile') |
28 | | -SELINUX_PROFILE = attribute('selinux_profile') |
| 26 | +CONTAINER_CAPADD = input('container_capadd') |
| 27 | +APP_ARMOR_PROFILE = input('app_armor_profile') |
| 28 | +SELINUX_PROFILE = input('selinux_profile') |
29 | 29 |
|
30 | 30 | # check if docker exists |
31 | 31 | only_if('docker not found') do |
|
153 | 153 | info['Mounts'].each do |mounts| |
154 | 154 | describe mounts['Source'] do |
155 | 155 | it { should_not eq '/' } |
156 | | - it { should_not match(%r{\/boot}) } |
157 | | - it { should_not match(%r{\/dev}) } |
158 | | - it { should_not match(%r{\/etc}) } |
159 | | - it { should_not match(%r{\/lib}) } |
160 | | - it { should_not match(%r{\/proc}) } |
161 | | - it { should_not match(%r{\/sys}) } |
162 | | - it { should_not match(%r{\/usr}) } |
| 156 | + it { should_not match(%r{/boot}) } |
| 157 | + it { should_not match(%r{/dev}) } |
| 158 | + it { should_not match(%r{/etc}) } |
| 159 | + it { should_not match(%r{/lib}) } |
| 160 | + it { should_not match(%r{/proc}) } |
| 161 | + it { should_not match(%r{/sys}) } |
| 162 | + it { should_not match(%r{/usr}) } |
163 | 163 | end |
164 | 164 | end |
165 | 165 | end |
|
185 | 185 | ref 'Why you don\'t need to run SSHd in your Docker containers', url: 'https://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/' |
186 | 186 |
|
187 | 187 | docker.containers.running?.ids.each do |id| |
188 | | - execute_command = 'docker exec ' + id + ' ps -e' |
| 188 | + execute_command = "docker exec #{id} ps -e" |
189 | 189 | describe command(execute_command) do |
190 | 190 | its('stdout') { should_not match(/ssh/) } |
191 | 191 | end |
|
209 | 209 | docker.containers.running?.ids.each do |id| |
210 | 210 | container_info = docker.object(id) |
211 | 211 | next if container_info['NetworkSettings']['Ports'].nil? |
| 212 | + |
212 | 213 | container_info['NetworkSettings']['Ports'].each do |_, hosts| |
213 | 214 | next if hosts.nil? |
| 215 | + |
214 | 216 | hosts.each do |host| |
215 | 217 | describe host['HostPort'].to_i.between?(1, 1024) do |
216 | 218 | it { should eq false } |
|
341 | 343 | docker.containers.running?.ids.each do |id| |
342 | 344 | container_info = docker.object(id) |
343 | 345 | next if container_info['NetworkSettings']['Ports'].nil? |
| 346 | + |
344 | 347 | container_info['NetworkSettings']['Ports'].each do |_, hosts| |
345 | 348 | next if hosts.nil? |
| 349 | + |
346 | 350 | hosts.each do |host| |
347 | 351 | describe host['HostIp'].to_i.between?(1, 1024) do |
348 | 352 | it { should_not eq '0.0.0.0' } |
|
0 commit comments