Skip to content

Commit 1191289

Browse files
kiwivogelchris-rock
authored andcommitted
Move atribute to spec as local var (#142)
* Move attribute to local vars. Move to local variable to avoid breaking test when passing additional attributes file without max_auth_tries. Also refactored variable to sshd_max_auth_retries for clarity Signed-off-by: kiwivogel <cruncniemuchie@hotmail.com> * fix reference to sshd_max_auth_tries attribute Signed-off-by: kiwivogel <cruncniemuchie@hotmail.com>
1 parent f78c60e commit 1191289

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

controls/sshd_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
sshd_gatewayports = attribute('sshd_gatewayports', value: 'no', description: 'Expected value for sshd_config GatewayPorts')
2828
sshd_x11forwarding = attribute('sshd_x11forwarding', value: 'no', description: 'Expected value for sshd_config X11Forwarding')
2929
sshd_banner = attribute('sshd_banner', value: 'none', description: 'Expected value for sshd_config Banner')
30+
sshd_max_auth_tries = attribute('sshd_max_auth_tries', value: 2, description: 'Expected value for max_auth_retries')
3031

3132
only_if do
3233
command('sshd').exist?
@@ -222,7 +223,7 @@
222223
tag 'CIS Red Hat Enterprise Linux 7 Benchmark version 01-31-2017': '2.1.1'
223224
ref 'Center for Internet Security', url: 'https://www.cisecurity.org/'
224225
describe sshd_config do
225-
its('MaxAuthTries') { should cmp == attribute('max_auth_tries') }
226+
its('MaxAuthTries') { should cmp(sshd_max_auth_tries) }
226227
end
227228
end
228229

inspec.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@ license: Apache-2.0
77
summary: Test-suite for best-practice SSH hardening
88
version: 2.4.1
99
supports:
10-
- os-family: unix
11-
attributes:
12-
- name: max_auth_tries
13-
required: false
14-
description: 'define MaxAuthTries'
15-
value: 2
16-
type: numeric
10+
- os-family: unix

0 commit comments

Comments
 (0)