3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v3.49.0 - 2016-10-25
* Add support for PermitTunnel in sshd_config

### v3.48.0 - 2016-10-20
* Add support for ProxyCommand

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,18 @@ network goes down or the client host crashes. This avoids infinitely hanging se

- *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
-------------------
Array of ciphers for the Ciphers setting in sshd_config.
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
$manage_root_ssh_config = false,
$root_ssh_config_content = "# This file is being maintained by Puppet.\n# DO NOT EDIT\n",
$sshd_config_tcp_keepalive = 'yes',
$sshd_config_permittunnel = 'no',
) {

case $::osfamily {
Expand Down Expand Up @@ -781,6 +782,9 @@
}

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:
ensure => installed,
source => $ssh_package_source_real,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ghoneycutt-ssh",
"version": "3.48.0",
"version": "3.49.0",
"author": "ghoneycutt",
"summary": "Manages SSH",
"license": "Apache-2.0",
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@
'2001:db8::dead:f00d',
],
:sshd_config_tcp_keepalive => 'yes',
:sshd_config_permittunnel => 'no',
}
end

Expand Down Expand Up @@ -520,6 +521,7 @@
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(/^TCPKeepAlive yes$/) }
it { should contain_file('sshd_config').with_content(/^PermitTunnel no$/) }

it {
should contain_file('sshd_banner').with({
Expand Down Expand Up @@ -968,6 +970,26 @@
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
let(:params) { { :manage_root_ssh_config => 'invalid' } }

Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_debian
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_rhel
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_sles_12_x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_solaris
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ ClientAliveCountMax 3
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_suse_i386
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_suse_x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ UseDNS yes
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/sshd_config_ubuntu1604
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ UseDNS yes
#MaxSessions 10

#PermitTunnel no
PermitTunnel no
#ChrootDirectory none

# no default banner path
Expand Down
1 change: 1 addition & 0 deletions templates/sshd_config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ MaxSessions <%= @sshd_config_maxsessions %>
<% end -%>

#PermitTunnel no
PermitTunnel <%= @sshd_config_permittunnel %>
<% if @sshd_config_chrootdirectory -%>
ChrootDirectory <%= @sshd_config_chrootdirectory %>
<% else -%>
Expand Down