dev-sec / ssh-baseline

DevSec SSH Baseline - InSpec Profile
https://dev-sec.io/baselines/ssh/
Apache License 2.0
283 stars 78 forks source link

'sshd-39' - the value for AllowTcpForwarding parameter should be limited to either 'no' or 'local' #216

Open MikhailAseev opened 3 months ago

MikhailAseev commented 3 months ago

Description

The title for the rule 'sshd-39' is 'Server: Disable TCP forwarding'. The description is 'If you use TCP forwarding in an uncontrolled manner then you can bypass the firewalls'. I suggest that the value for AllowTcpForwarding SSH server parameter in this particular rule (with such title and description) should be limited to the following:

This will suite the title and the description more than it is now.

Solution

I suggest removing input for AllowTcpForwarding SSH server parameter:

sshd_tcpforwarding = input('sshd_tcpforwarding', value: 'no')

And replace the line:

    its('AllowTcpForwarding') { should eq(sshd_tcpforwarding) }

with:

    its('AllowTcpForwarding') { should match(/^no|local$/) }