summaryrefslogtreecommitdiff
path: root/puppet/modules/sshd/manifests/base.pp
diff options
context:
space:
mode:
authorMicah <micah@leap.se>2016-05-24 10:19:22 -0400
committerMicah <micah@leap.se>2016-05-24 10:19:22 -0400
commit8166111831b79d426964440cd355d57ee33878f7 (patch)
treec51b0abbc9f5136c6ad8439a1423dfb88f61a0a2 /puppet/modules/sshd/manifests/base.pp
parent991f91c5cd53524b09d2d880569178cb455392f1 (diff)
parent823e83dfb47af1d023f5e4ca46078bbc4df72006 (diff)
Merge commit '823e83dfb47af1d023f5e4ca46078bbc4df72006' as 'puppet/modules/sshd'
Diffstat (limited to 'puppet/modules/sshd/manifests/base.pp')
-rw-r--r--puppet/modules/sshd/manifests/base.pp41
1 files changed, 41 insertions, 0 deletions
diff --git a/puppet/modules/sshd/manifests/base.pp b/puppet/modules/sshd/manifests/base.pp
new file mode 100644
index 00000000..dda9f26c
--- /dev/null
+++ b/puppet/modules/sshd/manifests/base.pp
@@ -0,0 +1,41 @@
+# The base class to setup the common things.
+# This is a private class and will always be used
+# throught the sshd class itself.
+class sshd::base {
+
+ $sshd_config_content = $::operatingsystem ? {
+ 'CentOS' => template("sshd/sshd_config/${::operatingsystem}_${::operatingsystemmajrelease}.erb"),
+ default => $::lsbdistcodename ? {
+ '' => template("sshd/sshd_config/${::operatingsystem}.erb"),
+ default => template("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb")
+ }
+ }
+
+ file { 'sshd_config':
+ ensure => present,
+ path => '/etc/ssh/sshd_config',
+ content => $sshd_config_content,
+ notify => Service[sshd],
+ owner => root,
+ group => 0,
+ mode => '0600';
+ }
+
+ # Now add the key, if we've got one
+ case $::sshrsakey {
+ '': { info("no sshrsakey on ${::fqdn}") }
+ default: {
+ # only export sshkey when storedconfigs is enabled
+ if $::sshd::use_storedconfigs {
+ include ::sshd::sshkey
+ }
+ }
+ }
+ service{'sshd':
+ ensure => running,
+ name => 'sshd',
+ enable => true,
+ hasstatus => true,
+ require => File[sshd_config],
+ }
+}