Showing with 35 additions and 22 deletions.
  1. +1 −1 Modulefile
  2. +29 −16 manifests/init.pp
  3. +1 −1 metadata.json
  4. +4 −4 templates/sshd_config.erb
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'ghoneycutt-ssh'
version '3.16.0'
version '3.17.0'
source 'git://github.com/ghoneycutt/puppet-module-ssh.git'
author 'ghoneycutt'
license 'Apache License, Version 2.0'
Expand Down
45 changes: 29 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -366,22 +366,6 @@
validate_array($sshd_config_macs)
}

if $sshd_config_denyusers != undef {
validate_array($sshd_config_denyusers)
}

if $sshd_config_denygroups != undef {
validate_array($sshd_config_denygroups)
}

if $sshd_config_allowusers != undef {
validate_array($sshd_config_allowusers)
}

if $sshd_config_allowgroups != undef {
validate_array($sshd_config_allowgroups)
}

if $ssh_config_hash_known_hosts_real != undef {
validate_re($ssh_config_hash_known_hosts_real, '^(yes|no)$', "ssh::ssh_config_hash_known_hosts may be either 'yes' or 'no' and is set to <${ssh_config_hash_known_hosts_real}>.")
}
Expand Down Expand Up @@ -499,6 +483,35 @@
$supported_loglevel_vals=['QUIET', 'FATAL', 'ERROR', 'INFO', 'VERBOSE']
validate_re($sshd_config_loglevel, $supported_loglevel_vals)

#enable hiera merging for allow groups and allow users
if $hiera_merge_real == true {
$sshd_config_denygroups_real = hiera_array('ssh::sshd_config_denygroups', undef)
$sshd_config_denyusers_real = hiera_array('ssh::sshd_config_denyusers', undef)
$sshd_config_allowgroups_real = hiera_array('ssh::sshd_config_allowgroups', undef)
$sshd_config_allowusers_real = hiera_array('ssh::sshd_config_allowusers', undef)
} else {
$sshd_config_denygroups_real = $sshd_config_denygroups
$sshd_config_denyusers_real = $sshd_config_denyusers
$sshd_config_allowgroups_real = $sshd_config_allowgroups
$sshd_config_allowusers_real = $sshd_config_allowusers
}

if $real_sshd_config_denyusers != undef {
validate_array($real_sshd_config_denyusers)
}

if $real_sshd_config_denygroups != undef {
validate_array($real_sshd_config_denygroups)
}

if $real_sshd_config_allowusers != undef {
validate_array($real_sshd_config_allowusers)
}

if $real_sshd_config_allowgroups != undef {
validate_array($real_sshd_config_allowgroups)
}

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.16.0",
"version": "3.17.0",
"author": "ghoneycutt",
"summary": "Manages SSH",
"license": "Apache License, Version 2.0",
Expand Down
8 changes: 4 additions & 4 deletions templates/sshd_config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ Ciphers <%= @sshd_config_ciphers.join(',') %>
MACs <%= @sshd_config_macs.join(',') %>
<% end -%>
<% if @sshd_config_denyusers -%>
DenyUsers <%= @sshd_config_denyusers.join(' ') %>
DenyUsers <%= @sshd_config_denyusers_real.join(' ') %>
<% end -%>
<% if @sshd_config_denygroups -%>
DenyGroups <%= @sshd_config_denygroups.join(' ') %>
DenyGroups <%= @sshd_config_denygroups_real.join(' ') %>
<% end -%>
<% if @sshd_config_allowusers -%>
AllowUsers <%= @sshd_config_allowusers.join(' ') %>
AllowUsers <%= @sshd_config_allowusers_real.join(' ') %>
<% end -%>
<% if @sshd_config_allowgroups -%>
AllowGroups <%= @sshd_config_allowgroups.join(' ') %>
AllowGroups <%= @sshd_config_allowgroups_real.join(' ') %>
<% end -%>