]> khamidou — GitHub mirrors - kite.git/commitdiff
added puppet module for sshd
authorkarim hamidou <khamidou@gmail.com>
Tue, 24 Dec 2013 14:52:49 +0000 (15:52 +0100)
committerkarim hamidou <khamidou@gmail.com>
Tue, 24 Dec 2013 14:52:49 +0000 (15:52 +0100)
bootstrap.rb
manifests/default.pp
manifests/server.pp
puppet_modules/sshd/manifests/init.pp [new file with mode: 0644]
puppet_modules/sshd/templates/sshd_config.erb [new file with mode: 0644]

index a451989a0f4cbba627c2505e15dbd1109e41a99a..ea8548a1b1a507be0f657bc662400ac5916f937f 100644 (file)
@@ -28,6 +28,16 @@ printf "Getting the sources from #{srcrepo} "
 `ssh root@#{hostname} bash -c "\
 apt-get update;\
 apt-get install -y git puppet;\
-git clone #{srcrepo} /root/kite;"`
+if [ ! -d /root/kite ]; then\
+    git clone #{srcrepo} /root/kite;\
+else\
+    cd /root/kite; git pull;\
+fi
+"`
 
 puts "OK"
+
+puts "Applying Puppet configuration "
+`ssh root@#{hostname} bash -c "\
+    puppet apply /root/kite/manifests/server.pp --modulepath=/root/kite/puppet_modules/\"`
+puts "OK"
index a59384d2702d13152dcb77863669ee0c8f99712e..ae7d262540318ff98cbf1e1694e00d46154fd929 100644 (file)
@@ -6,7 +6,7 @@ exec {"apt-get update":
         path =>  ["/usr/bin/", "/usr/sbin"],
 }
 
-$packages = ["python", "python-pip", "bpython", 
+$packages = ["python", "python-pip", "bpython", "fail2ban",
              "mutt", "python-pyinotify", "mailutils"]
 
 $python_packages = ["python-dateutil"]
index 2a18b81c147d789f65addbdbba717992a02f5544..c415381cd6063d38a82d6bd0c8cb2a8b4a01051a 100644 (file)
@@ -1,5 +1,15 @@
 # Puppet manifest for setting up kite on a server
- 
 import "settings.pp"
 import "default.pp"
-import "puppetlabs/vcsrepo"
+
+file {'/home/kite/app':
+    ensure => 'directory',
+    require => User['kite'],
+    source => "/root/kite/src",
+    recurse => true,
+    owner => 'kite',
+}
+
+class {'sshd':
+
+}
diff --git a/puppet_modules/sshd/manifests/init.pp b/puppet_modules/sshd/manifests/init.pp
new file mode 100644 (file)
index 0000000..8811468
--- /dev/null
@@ -0,0 +1,24 @@
+# a class for installing and configuring a basic nginx setup
+
+class sshd ($server_name) {
+    $packages = ["openssh-server"]
+
+    package { $packages:
+        ensure => present,
+    }
+
+    file {"/etc/ssh/sshd_config":
+        owner => "root",
+        group => "root",
+        content => template('sshd/sshd_config.erb')  
+        notify => Service['ssh']
+    }
+
+    service {'ssh':
+        ensure => running,
+        enable => true,
+        hasstatus => true,
+        hasrestart => true,
+        require => Package["openssh-server"]
+    }
+}
diff --git a/puppet_modules/sshd/templates/sshd_config.erb b/puppet_modules/sshd/templates/sshd_config.erb
new file mode 100644 (file)
index 0000000..5a670d0
--- /dev/null
@@ -0,0 +1,88 @@
+# Package generated configuration file
+# See the sshd_config(5) manpage for details
+
+# What ports, IPs and protocols we listen for
+Port 22
+# Use these options to restrict which interfaces/protocols sshd will bind to
+#ListenAddress ::
+#ListenAddress 0.0.0.0
+Protocol 2
+# HostKeys for protocol version 2
+HostKey /etc/ssh/ssh_host_rsa_key
+HostKey /etc/ssh/ssh_host_dsa_key
+HostKey /etc/ssh/ssh_host_ecdsa_key
+#Privilege Separation is turned on for security
+UsePrivilegeSeparation yes
+
+# Lifetime and size of ephemeral version 1 server key
+KeyRegenerationInterval 3600
+ServerKeyBits 768
+
+# Logging
+SyslogFacility AUTH
+LogLevel INFO
+
+# Authentication:
+LoginGraceTime 120
+PermitRootLogin no
+StrictModes yes
+
+RSAAuthentication yes
+PubkeyAuthentication yes
+#AuthorizedKeysFile    %h/.ssh/authorized_keys
+
+# Don't read the user's ~/.rhosts and ~/.shosts files
+IgnoreRhosts yes
+# For this to work you will also need host keys in /etc/ssh_known_hosts
+RhostsRSAAuthentication no
+# similar for protocol version 2
+HostbasedAuthentication no
+# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
+#IgnoreUserKnownHosts yes
+
+# To enable empty passwords, change to yes (NOT RECOMMENDED)
+PermitEmptyPasswords no
+
+# Change to yes to enable challenge-response passwords (beware issues with
+# some PAM modules and threads)
+ChallengeResponseAuthentication no
+
+# Change to no to disable tunnelled clear text passwords
+PasswordAuthentication no
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosGetAFSToken no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+
+# GSSAPI options
+#GSSAPIAuthentication no
+#GSSAPICleanupCredentials yes
+
+X11Forwarding no
+X11DisplayOffset 10
+PrintMotd no
+PrintLastLog yes
+TCPKeepAlive yes
+#UseLogin no
+
+MaxStartups 4:10:12
+#Banner /etc/issue.net
+
+# Allow client to pass locale environment variables
+AcceptEnv LANG LC_*
+
+Subsystem sftp /usr/lib/openssh/sftp-server
+
+# Set this to 'yes' to enable PAM authentication, account processing,
+# and session processing. If this is enabled, PAM authentication will
+# be allowed through the ChallengeResponseAuthentication and
+# PasswordAuthentication.  Depending on your PAM configuration,
+# PAM authentication via ChallengeResponseAuthentication may bypass
+# the setting of "PermitRootLogin without-password".
+# If you just want the PAM account and session checks to run without
+# PAM authentication, then enable this but set PasswordAuthentication
+# and ChallengeResponseAuthentication to 'no'.
+UsePAM yes
+