File tree 3 files changed +53
-1
lines changed
3 files changed +53
-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
+ without_content ( /^# Extra Configuration Options/ )
203
+ end
204
+ end
205
+
206
+ context 'with custom extra config value' do
207
+ cached ( :chef_run ) do
208
+ ChefSpec ::ServerRunner . new do |node |
209
+ node . normal [ 'ssh-hardening' ] [ 'ssh' ] [ 'client' ] [ 'extras' ] [ '#ExtraConfig' ] = 'Value'
210
+ end . converge ( described_recipe )
211
+ end
212
+
213
+ it 'uses the extra config attributes' do
214
+ expect ( chef_run ) . to render_file ( '/etc/ssh/ssh_config' ) . with_content ( /^# Extra Configuration Options/ )
215
+ expect ( chef_run ) . to render_file ( '/etc/ssh/ssh_config' ) . with_content ( /^#ExtraConfig Value/ )
216
+ end
217
+ end
218
+ end
219
+
194
220
context 'chef-solo' do
195
221
cached ( :chef_run ) do
196
222
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
+ without_content ( /^# Extra Configuration Options/ )
415
+ end
416
+ end
417
+
418
+ context 'with custom extra config value' do
419
+ cached ( :chef_run ) do
420
+ ChefSpec ::ServerRunner . new do |node |
421
+ node . normal [ 'ssh-hardening' ] [ 'ssh' ] [ 'server' ] [ 'extras' ] [ '#ExtraConfig' ] = 'Value'
422
+ end . converge ( described_recipe )
423
+ end
424
+
425
+ it 'uses the extra config attributes' do
426
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) . with_content ( /^# Extra Configuration Options/ )
427
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) . with_content ( /^#ExtraConfig Value/ )
428
+ end
429
+ end
430
+ end
431
+
406
432
it 'disables the challenge response authentication' do
407
433
expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
408
434
with_content ( /ChallengeResponseAuthentication no/ )
You can’t perform that action at this time.
0 commit comments