Skip to content

Commit 8dbf83d

Browse files
sshd_config custom path (#161)
* sshd_config custom path Signed-off-by: Michée Lengronne <michee.lengronne@coppint.com> * ssh config custom path Signed-off-by: Michée Lengronne <michee.lengronne@coppint.com> * custom user for sshd_config file and folder Signed-off-by: Michée Lengronne <michee.lengronne@coppint.com>
1 parent bd27a62 commit 8dbf83d

2 files changed

Lines changed: 69 additions & 69 deletions

File tree

controls/ssh_spec.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
impact 1.0
5050
title 'Client: Specify the AddressFamily to your need'
5151
desc 'OpenSSH should be configured to the network family. Set it to inet if you use IPv4 only. For IPv6 only set it to inet6.'
52-
describe ssh_config do
52+
describe ssh_config(ssh_custom_path + '/ssh_config') do
5353
its('AddressFamily') { should match(/inet|inet6|any/) }
5454
end
5555
end
@@ -58,7 +58,7 @@
5858
impact 1.0
5959
title 'Client: Specify expected ssh port'
6060
desc 'Always specify which port the SSH client should connect. Prevent unexpected settings.'
61-
describe ssh_config do
61+
describe ssh_config(ssh_custom_path + '/ssh_config') do
6262
its('Port') { should eq('22') }
6363
end
6464
end
@@ -67,7 +67,7 @@
6767
impact 1.0
6868
title 'Client: Specify protocol version 2'
6969
desc "Only SSH protocol version 2 connections should be permitted. Version 1 of the protocol contains security vulnerabilities. Don't use legacy insecure SSHv1 connections anymore."
70-
describe ssh_config do
70+
describe ssh_config(ssh_custom_path + '/ssh_config') do
7171
its('Protocol') { should eq('2') }
7272
end
7373
end
@@ -76,7 +76,7 @@
7676
impact 1.0
7777
title 'Client: Disable batch mode'
7878
desc 'Avoid batch mode in the default configuration.'
79-
describe ssh_config do
79+
describe ssh_config(ssh_custom_path + '/ssh_config') do
8080
its('BatchMode') { should eq('no') }
8181
end
8282
end
@@ -85,7 +85,7 @@
8585
impact 1.0
8686
title 'Client: Check Host IPs'
8787
desc 'Make sure that SSH checks the host IP address in the known_hosts file, to avoid DNS spoofing effects.'
88-
describe ssh_config do
88+
describe ssh_config(ssh_custom_path + '/ssh_config') do
8989
its('CheckHostIP') { should eq('yes') }
9090
end
9191
end
@@ -94,7 +94,7 @@
9494
impact 1.0
9595
title 'Client: Ask when checking host keys'
9696
desc "Don't automatically add new hosts keys to the list of known hosts."
97-
describe ssh_config do
97+
describe ssh_config(ssh_custom_path + '/ssh_config') do
9898
its('StrictHostKeyChecking') { should match(/ask|yes/) }
9999
end
100100
end
@@ -103,7 +103,7 @@
103103
impact 1.0
104104
title 'Client: Check for secure ssh ciphers'
105105
desc 'Configure a list of ciphers to the best secure ciphers (avoid older and weaker ciphers)'
106-
describe ssh_config do
106+
describe ssh_config(ssh_custom_path + '/ssh_config') do
107107
its('Ciphers') { should eq(ssh_crypto.valid_ciphers) }
108108
end
109109
end
@@ -112,7 +112,7 @@
112112
impact 1.0
113113
title 'Client: Check for secure ssh Key-Exchange Algorithm'
114114
desc 'Configure a list of Key-Exchange Algorithms (Kexs) to the best secure Kexs (avoid older and weaker Key-Exchange Algorithm)'
115-
describe ssh_config do
115+
describe ssh_config(ssh_custom_path + '/ssh_config') do
116116
its('KexAlgorithms') { should eq(ssh_crypto.valid_kexs) }
117117
end
118118
end
@@ -121,7 +121,7 @@
121121
impact 1.0
122122
title 'Client: Check for secure ssh Message Authentication Codes'
123123
desc 'Configure a list of Message Authentication Codes (MACs) to the best secure MACs (avoid older and weaker Message Authentication Codes)'
124-
describe ssh_config do
124+
describe ssh_config(ssh_custom_path + '/ssh_config') do
125125
its('MACs') { should eq(ssh_crypto.valid_macs) }
126126
end
127127
end
@@ -130,7 +130,7 @@
130130
impact 1.0
131131
title 'Client: Disable agent forwarding'
132132
desc 'Prevent agent forwarding by default, as it can be used in a limited way to enable attacks.'
133-
describe ssh_config do
133+
describe ssh_config(ssh_custom_path + '/ssh_config') do
134134
its('ForwardAgent') { should eq('no') }
135135
end
136136
end
@@ -139,7 +139,7 @@
139139
impact 1.0
140140
title 'Client: Disable X11Forwarding'
141141
desc 'Prevent X11 forwarding by default, as it can be used in a limited way to enable attacks.'
142-
describe ssh_config do
142+
describe ssh_config(ssh_custom_path + '/ssh_config') do
143143
its('ForwardX11') { should eq('no') }
144144
end
145145
end
@@ -148,7 +148,7 @@
148148
impact 1.0
149149
title 'Client: Disable HostbasedAuthentication'
150150
desc 'This option is a weak way for authentication and provide attacker more ways to enter the system.'
151-
describe ssh_config do
151+
describe ssh_config(ssh_custom_path + '/ssh_config') do
152152
its('HostbasedAuthentication') { should eq('no') }
153153
end
154154
end
@@ -158,7 +158,7 @@
158158
title 'Client: Disable rhosts-based authentication'
159159
desc 'Avoid rhosts-based authentication, as it opens more ways for an attacker to enter a system.'
160160
only_if { ssh_crypto.ssh_version < 7.6 }
161-
describe ssh_config do
161+
describe ssh_config(ssh_custom_path + '/ssh_config') do
162162
its('RhostsRSAAuthentication') { should eq('no') }
163163
end
164164
end
@@ -168,7 +168,7 @@
168168
title 'Client: Enable RSA authentication'
169169
desc 'Make sure RSA authentication is used by default.'
170170
only_if { ssh_crypto.ssh_version < 7.6 }
171-
describe ssh_config do
171+
describe ssh_config(ssh_custom_path + '/ssh_config') do
172172
its('RSAAuthentication') { should eq('yes') }
173173
end
174174
end
@@ -177,7 +177,7 @@
177177
impact 1.0
178178
title 'Client: Disable password-based authentication'
179179
desc 'Avoid password-based authentications.'
180-
describe ssh_config do
180+
describe ssh_config(ssh_custom_path + '/ssh_config') do
181181
its('PasswordAuthentication') { should eq('no') }
182182
end
183183
end
@@ -186,7 +186,7 @@
186186
impact 1.0
187187
title 'Client: Disable GSSAPIAuthentication'
188188
desc 'If you do not use GSSAPI authentication then disable it.'
189-
describe ssh_config do
189+
describe ssh_config(ssh_custom_path + '/ssh_config') do
190190
its('GSSAPIAuthentication') { should eq('no') }
191191
end
192192
end
@@ -195,7 +195,7 @@
195195
impact 1.0
196196
title 'Client: Disable GSSAPIDelegateCredentials'
197197
desc 'If you do not use GSSAPI authentication then disable it.'
198-
describe ssh_config do
198+
describe ssh_config(ssh_custom_path + '/ssh_config') do
199199
its('GSSAPIDelegateCredentials') { should eq('no') }
200200
end
201201
end
@@ -204,7 +204,7 @@
204204
impact 1.0
205205
title 'Client: Disable tunnels'
206206
desc 'Avoid using SSH tunnels.'
207-
describe ssh_config do
207+
describe ssh_config(ssh_custom_path + '/ssh_config') do
208208
its('Tunnel') { should eq('no') }
209209
end
210210
end
@@ -213,7 +213,7 @@
213213
impact 1.0
214214
title 'Client: Do not permit local commands'
215215
desc 'Do not permit any local command execution.'
216-
describe ssh_config do
216+
describe ssh_config(ssh_custom_path + '/ssh_config') do
217217
its('PermitLocalCommand') { should eq('no') }
218218
end
219219
end
@@ -223,7 +223,7 @@
223223
title 'Client: Do not allow Roaming'
224224
desc 'Workaround for SSH Client Bug CVE-2016-0777 and CVE-2016-0778'
225225
only_if { ssh_crypto.ssh_version < 7.2 }
226-
describe ssh_config do
226+
describe ssh_config(ssh_custom_path + '/ssh_config') do
227227
its('UseRoaming') { should eq('no') }
228228
end
229229
end

0 commit comments

Comments
 (0)