File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 248
248
end
249
249
end
250
250
251
+ it 'disables the challenge response authentication' do
252
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
253
+ with_content ( /ChallengeResponseAuthentication no/ )
254
+ end
255
+
256
+ context 'with challenge response authentication enabled' do
257
+ cached ( :chef_run ) do
258
+ ChefSpec ::ServerRunner . new do |node |
259
+ node . normal [ 'ssh-hardening' ] [ 'ssh' ] [ 'server' ] [ 'challenge_response_authentication' ] = true
260
+ end . converge ( described_recipe )
261
+ end
262
+
263
+ it 'enables the challenge response authentication' do
264
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
265
+ with_content ( /ChallengeResponseAuthentication yes/ )
266
+ end
267
+ end
268
+
269
+ it 'sets the login grace time to 30s' do
270
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
271
+ with_content ( /LoginGraceTime 30s/ )
272
+ end
273
+
274
+ context 'with configured login grace time to 60s' do
275
+ cached ( :chef_run ) do
276
+ ChefSpec ::ServerRunner . new do |node |
277
+ node . normal [ 'ssh-hardening' ] [ 'ssh' ] [ 'server' ] [ 'login_grace_time' ] = '60s'
278
+ end . converge ( described_recipe )
279
+ end
280
+
281
+ it 'sets the login grace time to 60s' do
282
+ expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
283
+ with_content ( /LoginGraceTime 60s/ )
284
+ end
285
+ end
286
+
251
287
it 'leaves deny users commented' do
252
288
expect ( chef_run ) . to render_file ( '/etc/ssh/sshd_config' ) .
253
289
with_content ( /#DenyUsers */ )
You can’t perform that action at this time.
0 commit comments