Skip to content

Commit 941f1e7

Browse files
authored
Merge pull request #155 from artem-sidorenko/challenge-reponse-test
Tests for GH-131 and GH-132
2 parents 9ce895e + 9ebc9de commit 941f1e7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

spec/recipes/server_spec.rb

+36
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,42 @@
248248
end
249249
end
250250

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+
251287
it 'leaves deny users commented' do
252288
expect(chef_run).to render_file('/etc/ssh/sshd_config').
253289
with_content(/#DenyUsers */)

0 commit comments

Comments
 (0)