Skip to content

Commit 5fafd0a

Browse files
ssh privilege separation for a non root user
It should be 'no' Signed-off-by: Michée Lengronne <michee.lengronne@coppint.com>
1 parent 365f2f9 commit 5fafd0a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

controls/sshd_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
sshd_custom_user = attribute('custom_user', value: 'root', description: 'The SSH user is not always root. It must be an unprivileged user in a container')
3232
sshd_custom_path = attribute('custom_path', value: '/etc/ssh', description: 'Sometimes ssh configuration files are present in another location and ssh use them with the -f flag')
3333

34+
sshd_valid_privseparation = ssh_crypto.valid_privseparation
35+
36+
unless sshd_custom_user == 'root' do
37+
sshd_valid_privseparation = 'no'
38+
end
39+
3440
only_if do
3541
command('sshd').exist?
3642
end
@@ -196,7 +202,7 @@
196202
title 'Server: Use privilege separation'
197203
desc 'UsePrivilegeSeparation is an option, when enabled will allow the OpenSSH server to run a small (necessary) amount of code as root and the of the code in a chroot jail environment. This enables ssh to deal incoming network traffic in an unprivileged child process to avoid privilege escalation by an attacker.'
198204
describe sshd_config do
199-
its('UsePrivilegeSeparation') { should eq(ssh_crypto.valid_privseparation) }
205+
its('UsePrivilegeSeparation') { should eq(sshd_valid_privseparation) }
200206
end
201207
end
202208

0 commit comments

Comments
 (0)