6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v3.46.0 - 2016-10-04
* Add sshd_x11_use_localhost parameter

### v3.45.0 - 2016-08-30
* Add support for Ubuntu 16.04 LTS

### v3.44.0 - 2016-08-28
* Add support for TCPKeepAlive in sshd_config

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ X11Forwarding in sshd_config. Specifies whether X11 forwarding is permitted.

- *Default*: 'yes'

sshd_x11_use_localhost
----------------------
X11UseLocalhost in sshd_config. Specifies if sshd should bind the X11 forwarding server
to the loopback address or to the wildcard address.

- *Default*: 'yes'

sshd_use_pam
------------
UsePam in sshd_config.
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
$sshd_password_authentication = 'yes',
$sshd_allow_tcp_forwarding = 'yes',
$sshd_x11_forwarding = 'yes',
$sshd_x11_use_localhost = 'yes',
$sshd_use_pam = 'USE_DEFAULTS',
$sshd_client_alive_count_max = '3',
$sshd_client_alive_interval = '0',
Expand Down Expand Up @@ -502,6 +503,7 @@
validate_re($sshd_password_authentication, '^(yes|no)$', "ssh::sshd_password_authentication may be either 'yes' or 'no' and is set to <${sshd_password_authentication}>.")
validate_re($sshd_allow_tcp_forwarding, '^(yes|no)$', "ssh::sshd_allow_tcp_forwarding may be either 'yes' or 'no' and is set to <${sshd_allow_tcp_forwarding}>.")
validate_re($sshd_x11_forwarding, '^(yes|no)$', "ssh::sshd_x11_forwarding may be either 'yes' or 'no' and is set to <${sshd_x11_forwarding}>.")
validate_re($sshd_x11_use_localhost, '^(yes|no)$', "ssh::sshd_x11_use_localhost may be either 'yes' or 'no' and is set to <${sshd_x11_use_localhost}>.")
if $sshd_use_pam_real != undef {
validate_re($sshd_use_pam_real, '^(yes|no)$', "ssh::sshd_use_pam may be either 'yes' or 'no' and is set to <${sshd_use_pam_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.45.0",
"version": "3.46.0",
"author": "ghoneycutt",
"summary": "Manages SSH",
"license": "Apache-2.0",
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
:sshd_pubkeyauthentication => 'no',
:sshd_allow_tcp_forwarding => 'no',
:sshd_x11_forwarding => 'no',
:sshd_x11_use_localhost => 'no',
:sshd_use_pam => 'no',
:sshd_client_alive_interval => '242',
:sshd_config_serverkeybits => '1024',
Expand Down Expand Up @@ -461,6 +462,7 @@
it { should contain_file('sshd_config').with_content(/^KerberosAuthentication no$/) }
it { should contain_file('sshd_config').with_content(/^AllowTcpForwarding no$/) }
it { should contain_file('sshd_config').with_content(/^X11Forwarding no$/) }
it { should contain_file('sshd_config').with_content(/^X11UseLocalhost no$/) }
it { should contain_file('sshd_config').with_content(/^UsePAM no$/) }
it { should contain_file('sshd_config').with_content(/^ClientAliveInterval 242$/) }
it { should contain_file('sshd_config').with_content(/^ServerKeyBits 1024$/) }
Expand Down Expand Up @@ -948,6 +950,16 @@
end
end

context 'with sshd_x11_use_localhost set to invalid value on valid osfamily' do
let(:params) { { :sshd_x11_use_localhost => 'invalid' } }

it 'should fail' do
expect {
should contain_class('ssh')
}.to raise_error(Puppet::Error,/ssh::sshd_x11_use_localhost may be either \'yes\' or \'no\' and is set to <invalid>\./)
end
end

context 'with sshd_use_pam set to invalid value on valid osfamily' do
let(:params) { { :sshd_use_pam => '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 @@ -107,6 +107,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
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 @@ -107,6 +107,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
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 @@ -107,6 +107,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
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 @@ -96,6 +96,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
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 @@ -107,6 +107,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
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 @@ -107,6 +107,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
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 @@ -110,6 +110,7 @@ AllowTcpForwarding yes
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost yes
#PrintMotd yes
PrintMotd yes
#PrintLastLog yes
Expand Down
1 change: 1 addition & 0 deletions templates/sshd_config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ AllowTcpForwarding <%= @sshd_allow_tcp_forwarding %>
X11Forwarding <%= @sshd_x11_forwarding %>
#X11DisplayOffset 10
#X11UseLocalhost yes
X11UseLocalhost <%= @sshd_x11_use_localhost %>
#PrintMotd yes
PrintMotd <%= @sshd_config_print_motd %>
#PrintLastLog yes
Expand Down