File tree 3 files changed +55
-1
lines changed
3 files changed +55
-1
lines changed Original file line number Diff line number Diff line change 66
66
client [ 'send_env' ] = [ 'LANG' , 'LC_*' , 'LANGUAGE' ]
67
67
68
68
# extra client configuration options
69
- client [ 'extras' ] . tap = { }
69
+ client [ 'extras' ] = { }
70
70
end
71
71
72
72
# sshd
Original file line number Diff line number Diff line change 191
191
end
192
192
end
193
193
194
+ describe 'extra configuration values' do
195
+ context 'without custom extra config value' do
196
+ cached ( :chef_run ) do
197
+ ChefSpec ::ServerRunner . new . converge ( described_recipe )
198
+ end
199
+
200
+ it 'does not have any extra config options' do
201
+ expect ( chef_run ) . to render_file ( '/etc/ssh/ssh_config' )
202
+ expect ( chef_run ) . not_to render_file ( '/etc/ssh/ssh_config' ) .
203
+ with_content ( /^# Extra Configuration Options/ )
204
+ end
205
+ end
206
+
207
+ context 'with custom extra config value' do
208
+ cached ( :chef_run ) do
209
+ ChefSpec ::ServerRunner . new do |node |
210
+ node . normal [ 'ssh-hardening' ] [ 'ssh' ] [ 'client' ] [ 'extras' ] [ '#ExtraConfig' ] = 'Value'
211
+ end . converge ( described_recipe )
212
+ end
213
+
214
+ it 'uses the extra config attributes' do
215
+ expect ( chef_run ) . to render_file ( '/etc/ssh/ssh_config' ) . with_content ( /^# Extra Configuration Options/ )
216
+ expect ( chef_run ) . to render_file ( '/etc/ssh/ssh_config' ) . with_content ( /^#ExtraConfig Value/ )
217
+ end
218
+ end
219
+ end
220
+
194
221
context 'chef-solo' do
195
222
cached ( :chef_run ) do
196
223
ChefSpec ::SoloRunner . new . converge ( described_recipe )
Original file line number Diff line number Diff line change 403
403
end
404
404
end
405
405
406
+ describe 'extra configuration values' do
407
+ context 'without custom extra config value' do
408
+ cached ( :chef_run ) do
409
+ ChefSpec ::ServerRunner . new . converge ( described_recipe )
410
+ end
411
+
412
+ it 'does not have any extra config options' do
413
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' )
414
+ expect ( chef_run ) . not_to render_file ( '/etc/ssh/sshd_config' ) .
415
+ with_content ( /^# Extra Configuration Options/ )
416
+ end
417
+ end
418
+
419
+ context 'with custom extra config value' do
420
+ cached ( :chef_run ) do
421
+ ChefSpec ::ServerRunner . new do |node |
422
+ node . normal [ 'ssh-hardening' ] [ 'ssh' ] [ 'server' ] [ 'extras' ] [ '#ExtraConfig' ] = 'Value'
423
+ end . converge ( described_recipe )
424
+ end
425
+
426
+ it 'uses the extra config attributes' do
427
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) . with_content ( /^# Extra Configuration Options/ )
428
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) . with_content ( /^#ExtraConfig Value/ )
429
+ end
430
+ end
431
+ end
432
+
406
433
it 'disables the challenge response authentication' do
407
434
expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
408
435
with_content ( /ChallengeResponseAuthentication no/ )
You can’t perform that action at this time.
0 commit comments