Merge pull request #186 from andrei693/Expose_PermitTunnel_from_sshd_config

Expose PermitTunnel from sshd_config
This commit is contained in:
Garrett Honeycutt 2016-10-25 11:25:37 -04:00 committed by GitHub
commit 00829437ba
11 changed files with 46 additions and 0 deletions

View File

@ -453,6 +453,18 @@ network goes down or the client host crashes. This avoids infinitely hanging se
- *Default*: 'yes' - *Default*: 'yes'
sshd_config_permittunnel
-----------------------
PermitTunnel in sshd_config.
Specifies whether tun(4) device forwarding is allowed. The argument must be
'yes', 'point-to-point' (layer 3), 'ethernet' (layer 2), or 'no'.
Specifying 'yes' permits both 'point-to-point' and 'ethernet'. The
default is 'no'.
Independent of this setting, the permissions of the selected tun(4) device must
allow access to the user.
- *Default*: 'no'
sshd_config_ciphers sshd_config_ciphers
------------------- -------------------
Array of ciphers for the Ciphers setting in sshd_config. Array of ciphers for the Ciphers setting in sshd_config.

View File

@ -110,6 +110,7 @@ class ssh (
$manage_root_ssh_config = false, $manage_root_ssh_config = false,
$root_ssh_config_content = "# This file is being maintained by Puppet.\n# DO NOT EDIT\n", $root_ssh_config_content = "# This file is being maintained by Puppet.\n# DO NOT EDIT\n",
$sshd_config_tcp_keepalive = 'yes', $sshd_config_tcp_keepalive = 'yes',
$sshd_config_permittunnel = 'no',
) { ) {
case $::osfamily { case $::osfamily {
@ -781,6 +782,9 @@ class ssh (
} }
validate_re($sshd_config_tcp_keepalive, '^(yes|no)$', "ssh::sshd_config_tcp_keepalive may be either 'yes' or 'no' and is set to <${sshd_config_tcp_keepalive}>.") validate_re($sshd_config_tcp_keepalive, '^(yes|no)$', "ssh::sshd_config_tcp_keepalive may be either 'yes' or 'no' and is set to <${sshd_config_tcp_keepalive}>.")
validate_re($sshd_config_permittunnel, '^(yes|no|point-to-point|ethernet)$', "ssh::sshd_config_permittunnel may be either 'yes', 'point-to-point', 'ethernet' or 'no' and is set to <${sshd_config_permittunnel}>.")
package { $packages_real: package { $packages_real:
ensure => installed, ensure => installed,
source => $ssh_package_source_real, source => $ssh_package_source_real,

View File

@ -452,6 +452,7 @@ describe 'ssh' do
'2001:db8::dead:f00d', '2001:db8::dead:f00d',
], ],
:sshd_config_tcp_keepalive => 'yes', :sshd_config_tcp_keepalive => 'yes',
:sshd_config_permittunnel => 'no',
} }
end end
@ -520,6 +521,7 @@ describe 'ssh' do
it { should contain_file('sshd_config').with_content(/^\s*AllowGroups ssh security$/) } it { should contain_file('sshd_config').with_content(/^\s*AllowGroups ssh security$/) }
it { should contain_file('sshd_config').with_content(/^ListenAddress 192.168.1.1\nListenAddress 2001:db8::dead:f00d$/) } it { should contain_file('sshd_config').with_content(/^ListenAddress 192.168.1.1\nListenAddress 2001:db8::dead:f00d$/) }
it { should contain_file('sshd_config').with_content(/^TCPKeepAlive yes$/) } it { should contain_file('sshd_config').with_content(/^TCPKeepAlive yes$/) }
it { should contain_file('sshd_config').with_content(/^PermitTunnel no$/) }
it { it {
should contain_file('sshd_banner').with({ should contain_file('sshd_banner').with({
@ -968,6 +970,26 @@ describe 'ssh' do
end end
end end
describe 'sshd_config_permittunnel param' do
['yes','point-to-point','ethernet','no'].each do |value|
context "set to #{value}" do
let (:params) { { :sshd_config_permittunnel => value } }
it { should contain_file('sshd_config').with_content(/^PermitTunnel #{value}$/) }
end
end
context 'when set to an invalid value' do
let (:params) { { :sshd_config_permittunnel => 'invalid' } }
it 'should fail' do
expect {
should contain_class('ssh')
}.to raise_error(Puppet::Error,/ssh::sshd_config_permittunnel may be either \'yes\', \'point-to-point\', \'ethernet\' or \'no\' and is set to <invalid>\./)
end
end
end
context 'with manage_root_ssh_config set to invalid value on valid osfamily' do context 'with manage_root_ssh_config set to invalid value on valid osfamily' do
let(:params) { { :manage_root_ssh_config => 'invalid' } } let(:params) { { :manage_root_ssh_config => 'invalid' } }

View File

@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -115,6 +115,7 @@ ClientAliveCountMax 3
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -131,6 +131,7 @@ UseDNS yes
#MaxSessions 10 #MaxSessions 10
#PermitTunnel no #PermitTunnel no
PermitTunnel no
#ChrootDirectory none #ChrootDirectory none
# no default banner path # no default banner path

View File

@ -195,6 +195,7 @@ MaxSessions <%= @sshd_config_maxsessions %>
<% end -%> <% end -%>
#PermitTunnel no #PermitTunnel no
PermitTunnel <%= @sshd_config_permittunnel %>
<% if @sshd_config_chrootdirectory -%> <% if @sshd_config_chrootdirectory -%>
ChrootDirectory <%= @sshd_config_chrootdirectory %> ChrootDirectory <%= @sshd_config_chrootdirectory %>
<% else -%> <% else -%>