diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-04-25 22:16:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-04-25 22:16:43 +0000 |
commit | 56c91af646662dbe146e83b93ee617e742b65ffc (patch) | |
tree | 8ba589b2dece48f2923d8d35926625109659e497 /manifests | |
parent | 076e0a071459d9fe8f27858849f4481f50746968 (diff) | |
parent | 7d13719ab09a148aec7fac2930a0209c04611d8d (diff) |
Merge "Refactor SSHD config to allow both SSHD options and banner/motd to be set" into stable/ocata
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/profile/base/sshd.pp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/manifests/profile/base/sshd.pp b/manifests/profile/base/sshd.pp index 2b86032..3f0245d 100644 --- a/manifests/profile/base/sshd.pp +++ b/manifests/profile/base/sshd.pp @@ -27,14 +27,19 @@ # The text used within SSH Banner # Defaults to hiera('MOTD') # +# [*options*] +# Hash of SSHD options to set. See the puppet-ssh module documentation for +# details. +# Defaults to {} + class tripleo::profile::base::sshd ( $bannertext = hiera('BannerText', undef), $motd = hiera('MOTD', undef), + $options = {} ) { - include ::ssh::server - - if $bannertext { + if $bannertext and $bannertext != '' { + $sshd_options_banner = {'Banner' => '/etc/issue.net'} $filelist = [ '/etc/issue', '/etc/issue.net', ] file { $filelist: ensure => file, @@ -44,9 +49,12 @@ class tripleo::profile::base::sshd ( group => 'root', mode => '0644' } + } else { + $sshd_options_banner = {} } - if $motd { + if $motd and $motd != '' { + $sshd_options_motd = {'PrintMotd' => 'yes'} file { '/etc/motd': ensure => file, backup => false, @@ -55,5 +63,23 @@ class tripleo::profile::base::sshd ( group => 'root', mode => '0644' } + } else { + $sshd_options_motd = {} + } + + $sshd_options = merge( + $options, + $sshd_options_banner, + $sshd_options_motd + ) + + # NB (owalsh) in puppet-ssh hiera takes precedence over the class param + # we need to control this, so error if it's set in hiera + if hiera('ssh:server::options', undef) { + err('ssh:server::options must not be set, use tripleo::profile::base::sshd::options') + } + class { '::ssh::server': + storeconfigs_enabled => false, + options => $sshd_options } } |