File tree Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change 6666 client [ 'send_env' ] = [ 'LANG' , 'LC_*' , 'LANGUAGE' ]
6767
6868 # extra client configuration options
69- client [ 'extras' ] . tap = { }
69+ client [ 'extras' ] = { }
7070end
7171
7272# sshd
Original file line number Diff line number Diff line change 191191 end
192192 end
193193
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+
194220 context 'chef-solo' do
195221 cached ( :chef_run ) do
196222 ChefSpec ::SoloRunner . new . converge ( described_recipe )
Original file line number Diff line number Diff line change 403403 end
404404 end
405405
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+
406432 it 'disables the challenge response authentication' do
407433 expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
408434 with_content ( /ChallengeResponseAuthentication no/ )
You can’t perform that action at this time.
0 commit comments