provizioning 0.1.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/README.md +29 -0
  4. data/Rakefile +2 -0
  5. data/bootstrap/bootstrap.sh +71 -0
  6. data/{lib/templates/sources.list → bootstrap/lucid.sources.list} +2 -1
  7. data/bootstrap/natty.sources.list +14 -0
  8. data/lib/provizioning/puppet.rb +94 -0
  9. data/lib/provizioning/version.rb +3 -0
  10. data/lib/provizioning.rb +1 -3
  11. data/provizioning.gemspec +20 -0
  12. data/puppet/classes/apache/centos.conf +978 -0
  13. data/puppet/classes/apache/ssl.conf +75 -0
  14. data/puppet/classes/apache.pp +152 -0
  15. data/puppet/classes/apt.pp +5 -0
  16. data/puppet/classes/base/ntp/ntpd-sysconfig +13 -0
  17. data/puppet/classes/base.pp +79 -0
  18. data/puppet/classes/freerange.pp +53 -0
  19. data/puppet/classes/gemrc/gemrc +9 -0
  20. data/puppet/classes/gemrc.pp +10 -0
  21. data/puppet/classes/imagemagick.pp +19 -0
  22. data/puppet/classes/iptables/load-iptables +3 -0
  23. data/puppet/classes/iptables/post-iptables +2 -0
  24. data/puppet/classes/iptables/pre-iptables +2 -0
  25. data/puppet/classes/iptables.pp +59 -0
  26. data/puppet/classes/logrotate/logrotate.erb +15 -0
  27. data/puppet/classes/logrotate.pp +37 -0
  28. data/puppet/classes/mongo/mongodb.conf +89 -0
  29. data/puppet/classes/mongo.pp +86 -0
  30. data/puppet/classes/monit/monit.conf +242 -0
  31. data/puppet/classes/monit.pp +39 -0
  32. data/puppet/classes/munin/plugins/passenger_memory_stats +123 -0
  33. data/puppet/classes/munin/plugins/passenger_status +130 -0
  34. data/puppet/classes/munin/plugins/rails_database_time +174 -0
  35. data/puppet/classes/munin/plugins/rails_request_duration +173 -0
  36. data/puppet/classes/munin/plugins/rails_request_error +169 -0
  37. data/puppet/classes/munin/plugins/rails_requests +175 -0
  38. data/puppet/classes/munin/plugins/rails_view_render_time +173 -0
  39. data/puppet/classes/munin/rails-plugin-config +4 -0
  40. data/puppet/classes/munin.pp +60 -0
  41. data/puppet/classes/mysql/password.erb +1 -0
  42. data/puppet/classes/mysql.pp +71 -0
  43. data/puppet/classes/openswan/ipsec.conf +17 -0
  44. data/puppet/classes/openswan/ipsec.secrets +1 -0
  45. data/puppet/classes/openswan/patched_ipsec_initd_script +223 -0
  46. data/puppet/classes/openswan/secret.erb +1 -0
  47. data/puppet/classes/openswan.pp +71 -0
  48. data/puppet/classes/post-flight.pp +17 -0
  49. data/puppet/classes/postfix/main.cf +39 -0
  50. data/puppet/classes/postfix.pp +16 -0
  51. data/puppet/classes/rack/centos/passenger.load.erb +5 -0
  52. data/puppet/classes/rack/ubuntu/passenger.conf.erb +6 -0
  53. data/puppet/classes/rack.pp +66 -0
  54. data/puppet/classes/redis/redis.conf.erb +187 -0
  55. data/puppet/classes/redis.pp +20 -0
  56. data/puppet/classes/sudo/sudoers +6 -0
  57. data/puppet/classes/sudo.pp +24 -0
  58. data/puppet/classes/syslogng/CentOS.cnf +61 -0
  59. data/puppet/classes/syslogng/Ubuntu.cnf +347 -0
  60. data/puppet/classes/syslogng.pp +146 -0
  61. data/puppet/classes/xml.pp +23 -0
  62. data/puppet/classes/yum.pp +6 -0
  63. data/puppet/classes/zsh.pp +5 -0
  64. data/puppet/modules/README +74 -0
  65. data/puppet/modules/cron/README +4 -0
  66. data/puppet/modules/cron/manifests/base.pp +26 -0
  67. data/puppet/modules/cron/manifests/crontabs.pp +11 -0
  68. data/puppet/modules/cron/manifests/init.pp +18 -0
  69. data/puppet/modules/drupal/Modulefile +7 -0
  70. data/puppet/modules/drupal/README +110 -0
  71. data/puppet/modules/drupal/manifests/absent.pp +25 -0
  72. data/puppet/modules/drupal/manifests/backup/absent.pp +23 -0
  73. data/puppet/modules/drupal/manifests/backup.pp +49 -0
  74. data/puppet/modules/drupal/manifests/conf.pp +23 -0
  75. data/puppet/modules/drupal/manifests/debug.pp +26 -0
  76. data/puppet/modules/drupal/manifests/disable.pp +22 -0
  77. data/puppet/modules/drupal/manifests/disableboot.pp +13 -0
  78. data/puppet/modules/drupal/manifests/drush.pp +20 -0
  79. data/puppet/modules/drupal/manifests/example42/backup.pp +8 -0
  80. data/puppet/modules/drupal/manifests/example42/monitor.pp +8 -0
  81. data/puppet/modules/drupal/manifests/example42.pp +25 -0
  82. data/puppet/modules/drupal/manifests/extra.pp +30 -0
  83. data/puppet/modules/drupal/manifests/firewall/absent.pp +19 -0
  84. data/puppet/modules/drupal/manifests/firewall.pp +24 -0
  85. data/puppet/modules/drupal/manifests/init.pp +54 -0
  86. data/puppet/modules/drupal/manifests/install.pp +20 -0
  87. data/puppet/modules/drupal/manifests/module.pp +37 -0
  88. data/puppet/modules/drupal/manifests/monitor/absent.pp +42 -0
  89. data/puppet/modules/drupal/manifests/monitor.pp +77 -0
  90. data/puppet/modules/drupal/manifests/package.pp +20 -0
  91. data/puppet/modules/drupal/manifests/params.pp +277 -0
  92. data/puppet/modules/drupal/manifests/site.pp +63 -0
  93. data/puppet/modules/drupal/manifests/theme.pp +33 -0
  94. data/puppet/modules/drupal/templates/variables_drupal.erb +62 -0
  95. data/puppet/modules/drupal/tests/absent.pp +1 -0
  96. data/puppet/modules/drupal/tests/backup.pp +1 -0
  97. data/puppet/modules/drupal/tests/debug.pp +1 -0
  98. data/puppet/modules/drupal/tests/disable.pp +1 -0
  99. data/puppet/modules/drupal/tests/disableboot.pp +1 -0
  100. data/puppet/modules/drupal/tests/firewall.pp +1 -0
  101. data/puppet/modules/drupal/tests/init.pp +1 -0
  102. data/puppet/modules/drupal/tests/monitor.pp +1 -0
  103. data/puppet/modules/hosts/README +0 -0
  104. data/puppet/modules/hosts/manifests/example42.pp +5 -0
  105. data/puppet/modules/hosts/manifests/init.pp +16 -0
  106. data/puppet/modules/hosts/templates/hosts.erb +11 -0
  107. data/puppet/modules/iptables/README +4 -0
  108. data/puppet/modules/iptables/files/iptables +19 -0
  109. data/puppet/modules/iptables/manifests/disable.pp +15 -0
  110. data/puppet/modules/iptables/manifests/init.pp +9 -0
  111. data/puppet/modules/iptables/manifests/redhat.pp +24 -0
  112. data/puppet/modules/mysql/Modulefile +7 -0
  113. data/puppet/modules/mysql/README +56 -0
  114. data/puppet/modules/mysql/manifests/absent.pp +12 -0
  115. data/puppet/modules/mysql/manifests/backup/example42.pp +8 -0
  116. data/puppet/modules/mysql/manifests/backup.pp +49 -0
  117. data/puppet/modules/mysql/manifests/client.pp +18 -0
  118. data/puppet/modules/mysql/manifests/conf.pp +23 -0
  119. data/puppet/modules/mysql/manifests/debug.pp +25 -0
  120. data/puppet/modules/mysql/manifests/disable.pp +13 -0
  121. data/puppet/modules/mysql/manifests/disableboot.pp +13 -0
  122. data/puppet/modules/mysql/manifests/example42.pp +25 -0
  123. data/puppet/modules/mysql/manifests/firewall.pp +23 -0
  124. data/puppet/modules/mysql/manifests/grant.pp +29 -0
  125. data/puppet/modules/mysql/manifests/init.pp +67 -0
  126. data/puppet/modules/mysql/manifests/monitor/example42.pp +8 -0
  127. data/puppet/modules/mysql/manifests/monitor.pp +77 -0
  128. data/puppet/modules/mysql/manifests/params.pp +240 -0
  129. data/puppet/modules/mysql/manifests/query.pp +30 -0
  130. data/puppet/modules/mysql/templates/grant.erb +6 -0
  131. data/puppet/modules/mysql/templates/query.erb +5 -0
  132. data/puppet/modules/mysql/templates/variables_mysql.erb +42 -0
  133. data/puppet/modules/network/README +4 -0
  134. data/puppet/modules/network/manifests/init.pp +13 -0
  135. data/puppet/modules/nginx/manifests/fcgi.pp +87 -0
  136. data/puppet/modules/nginx/manifests/init.pp +205 -0
  137. data/puppet/modules/nginx/templates/fcgi_site.erb +38 -0
  138. data/puppet/modules/nginx/templates/includes/fastcgi_params.erb +23 -0
  139. data/puppet/modules/nginx/templates/nginx.conf.erb +31 -0
  140. data/puppet/modules/passenger/manifests/init.pp +12 -0
  141. data/puppet/modules/passenger/templates/myapp +39 -0
  142. data/puppet/modules/php/README +26 -0
  143. data/puppet/modules/php/manifests/init.pp +42 -0
  144. data/puppet/modules/php/manifests/module.pp +22 -0
  145. data/puppet/modules/php/manifests/pear/module.pp +21 -0
  146. data/puppet/modules/php/manifests/pear.pp +20 -0
  147. data/puppet/modules/php/manifests/pecl/config.pp +19 -0
  148. data/puppet/modules/php/manifests/pecl/module.pp +44 -0
  149. data/puppet/modules/php/manifests/pecl.pp +8 -0
  150. data/puppet/modules/php/manifests/soap.pp +20 -0
  151. data/puppet/modules/postgres/Copyright +13 -0
  152. data/puppet/modules/postgres/manifests/database.pp +40 -0
  153. data/puppet/modules/postgres/manifests/init.pp +25 -0
  154. data/puppet/modules/postgres/manifests/role.pp +40 -0
  155. data/puppet/modules/ruby/files/install-ruby-stow +43 -0
  156. data/puppet/modules/ruby/manifests/init.pp +18 -0
  157. data/puppet/modules/rvm/files/install-system-rvm +2 -0
  158. data/puppet/modules/rvm/manifests/classes/dependencies.pp +24 -0
  159. data/puppet/modules/rvm/manifests/classes/passenger.pp +166 -0
  160. data/puppet/modules/rvm/manifests/classes/system.pp +33 -0
  161. data/puppet/modules/rvm/manifests/definitions/system_user.pp +13 -0
  162. data/puppet/modules/rvm/manifests/init.pp +2 -0
  163. data/puppet/modules/rvm/templates/passenger-apache.conf.erb +9 -0
  164. data/puppet/modules/ssh/README +4 -0
  165. data/puppet/modules/ssh/manifests/auth.pp +39 -0
  166. data/puppet/modules/ssh/manifests/auth.pp.good +340 -0
  167. data/puppet/modules/ssh/manifests/eal4.pp +69 -0
  168. data/puppet/modules/ssh/manifests/init.pp +74 -0
  169. data/puppet/modules/stow/manifests/init.pp +5 -0
  170. data/puppet/modules/sudo/files/sudoers +25 -0
  171. data/puppet/modules/sudo/manifests/init.pp +1 -0
  172. data/puppet/modules/sudo/manifests/install.pp +5 -0
  173. data/puppet/modules/sudo/manifests/sudoers.pp +14 -0
  174. data/puppet/modules/ufw/manifests/init.pp +12 -0
  175. data/puppet/modules/users/README +28 -0
  176. data/puppet/modules/users/manifests/adduser.pp +16 -0
  177. data/puppet/modules/users/manifests/admin.pp +11 -0
  178. data/puppet/modules/users/manifests/automount.pp +34 -0
  179. data/puppet/modules/users/manifests/deluser.pp +8 -0
  180. data/puppet/modules/users/manifests/example42.pp +16 -0
  181. data/puppet/modules/users/manifests/init.pp +31 -0
  182. data/puppet/modules/users/manifests/ldap.pp +114 -0
  183. data/puppet/modules/users/manifests/params.pp +84 -0
  184. data/puppet/modules/users/templates/ldap/ldap.conf.erb +13 -0
  185. data/puppet/modules/users/templates/ldap/nsswitch.conf.erb +23 -0
  186. data/puppet/modules/users/templates/ldap/openldap-ldap.conf.erb +8 -0
  187. data/puppet/modules/webmin/manifests/init.pp +31 -0
  188. data/puppet/roles/blank.pp +1 -0
  189. data/puppet/site.pp +8 -0
  190. metadata +235 -81
  191. data/README +0 -3
  192. data/bin/provizion +0 -52
  193. data/lib/policies/chef-client.rb +0 -37
  194. data/lib/policies/lamp.rb +0 -42
  195. data/lib/policies/passenger.rb +0 -44
  196. data/lib/recipes/apache.rb +0 -70
  197. data/lib/recipes/apache_conf.rb +0 -3
  198. data/lib/recipes/bundler.rb +0 -4
  199. data/lib/recipes/chef_client.rb +0 -11
  200. data/lib/recipes/curl.rb +0 -8
  201. data/lib/recipes/essential.rb +0 -4
  202. data/lib/recipes/git.rb +0 -15
  203. data/lib/recipes/imagemagick.rb +0 -8
  204. data/lib/recipes/mailserver.rb +0 -9
  205. data/lib/recipes/memcached.rb +0 -16
  206. data/lib/recipes/mysql.rb +0 -21
  207. data/lib/recipes/nginx/init.d +0 -63
  208. data/lib/recipes/nginx.rb +0 -25
  209. data/lib/recipes/passenger.rb +0 -67
  210. data/lib/recipes/php.rb +0 -8
  211. data/lib/recipes/postgresql.rb +0 -21
  212. data/lib/recipes/ruby_enterprise.rb +0 -24
  213. data/lib/recipes/rvm.rb +0 -25
  214. data/lib/recipes/sources.rb +0 -5
  215. data/lib/recipes/subversion.rb +0 -8
  216. data/lib/recipes/syslog.rb +0 -7
  217. data/lib/recipes/ufw.rb +0 -12
  218. data/lib/recipes/vim.rb +0 -8
  219. data/lib/recipes/webmin.rb +0 -17
  220. data/lib/templates/apache.conf.erb +0 -12
  221. data/lib/templates/my.cnf +0 -132
  222. data/lib/templates/passenger.conf +0 -11
  223. data/lib/templates/passenger.load +0 -1
@@ -0,0 +1,74 @@
1
+ import "*.pp"
2
+
3
+ class ssh {
4
+
5
+ package { ssh:
6
+ name => $operatingsystem ? {
7
+ default => "openssh",
8
+ },
9
+ ensure => present,
10
+ }
11
+
12
+ package { ssh-client:
13
+ name => $operatingsystem ? {
14
+ default => "openssh-clients",
15
+ },
16
+ ensure => present,
17
+ }
18
+
19
+ }
20
+
21
+ class ssh::server {
22
+
23
+ include ssh
24
+
25
+ package { sshd:
26
+ name => $operatingsystem ? {
27
+ default => "openssh-server",
28
+ },
29
+ ensure => present,
30
+ }
31
+
32
+ service { sshd:
33
+ name => $operatingsystem ? {
34
+ default => "sshd",
35
+ },
36
+ ensure => running,
37
+ enable => true,
38
+ hasrestart => true,
39
+ hasstatus => true,
40
+ require => Package["sshd"],
41
+ subscribe => File["sshd.conf"],
42
+ }
43
+
44
+ file {
45
+ "sshd_config":
46
+ mode => 600, owner => root, group => root,
47
+ require => Package[ssh-server],
48
+ ensure => present,
49
+ path => $operatingsystem ?{
50
+ default => "/etc/ssh/sshd_config",
51
+ },
52
+ }
53
+
54
+ }
55
+
56
+ define ssh::config ($value) {
57
+
58
+ # Augeas version.
59
+ augeas {
60
+ "sshd_config_$name":
61
+ context => "/files/etc/ssh/sshd_config",
62
+ changes => "set $name $value",
63
+ onlyif => "get $name != $value",
64
+ # onlyif => "match $name/*[.='$value'] size == 0",
65
+ }
66
+
67
+ # Davids' replaceline version (to fix)
68
+ # replaceline {
69
+ # "sshd_config_$name":
70
+ # file => "/etc/ssh/sshd_config",
71
+ # pattern => "$name",
72
+ # replacement => "^$name $value",
73
+ # }
74
+ }
@@ -0,0 +1,5 @@
1
+ class stow {
2
+ package{ "stow":
3
+ ensure => installed,
4
+ }
5
+ }
@@ -0,0 +1,25 @@
1
+ # /etc/sudoers
2
+ #
3
+ # This file MUST be edited with the 'visudo' command as root.
4
+ #
5
+ # See the man page for details on how to write a sudoers file.
6
+ #
7
+
8
+ Defaults env_reset
9
+
10
+ # Host alias specification
11
+
12
+ # User alias specification
13
+
14
+ # Cmnd alias specification
15
+
16
+ # User privilege specification
17
+ root ALL=(ALL) ALL
18
+
19
+ # Uncomment to allow members of group sudo to not need a password
20
+ # (Note that later entries override this, so you might need to move
21
+ # it further down)
22
+ # %sudo ALL=NOPASSWD: ALL
23
+
24
+ # Members of the admin group may gain root privileges
25
+ %admin ALL=(ALL) ALL
@@ -0,0 +1 @@
1
+ import "*"
@@ -0,0 +1,5 @@
1
+ class sudo::install {
2
+ package{ "sudo":
3
+ ensure => installed,
4
+ }
5
+ }
@@ -0,0 +1,14 @@
1
+ class sudo::sudoers {
2
+
3
+ file { "/tmp/sudoers":
4
+ mode => 440,
5
+ source => "puppet:///modules/sudo/sudoers",
6
+ notify => Exec["check-sudoers"],
7
+ }
8
+
9
+ exec { "check-sudoers":
10
+ command => "/usr/sbin/visudo -cf /tmp/sudoers && cp /tmp/sudoers /etc/sudoers",
11
+ refreshonly => true,
12
+ }
13
+
14
+ }
@@ -0,0 +1,12 @@
1
+ class ufw {
2
+ package{ "ufw":
3
+ ensure => installed,
4
+ }
5
+
6
+ exec { "Set default rules":
7
+ user => "root",
8
+ path => "/usr/bin:/usr/sbin:/bin",
9
+ command => "ufw allow to 0.0.0.0/0 port 80 && ufw allow to 0.0.0.0/0 port 443 && ufw allow to 0.0.0.0/0 port 3000 && ufw allow 10000:10020/tcp && ufw allow to 0.0.0.0/0 port 22",
10
+ require => Package["ufw"],
11
+ }
12
+ }
@@ -0,0 +1,28 @@
1
+ Puppet module: users
2
+
3
+ # Written by Lab42 #
4
+ # http://www.example42.com
5
+
6
+ Licence: GPLv3
7
+
8
+
9
+ DESCRIPTION:
10
+ This module provides users management on the system.
11
+ It manages both local users (you have obviously to add them according to custom needs) and external authentication sources, such as ldap. It provides automount features.
12
+
13
+
14
+ USER VARIABLES:
15
+ In order to customize the behaviour of the module you can set the following variables:
16
+ $users_auth (default: "local") - Defines the authentication method to be used. Default uses only local authentication, set to "ldap" to ADD ldap authentication.
17
+ $users_ldap_servers (default: ["ldapm.example42.com","ldaps.example42.com"]) - Defines the ldap backend server(s) you want to use for ldap authentication
18
+ $users_ldap_basedn (default: "dc=example42,dc=com") - Defines the ldap base dn for ldap authentication
19
+ $users_ldap_ssl (default: "no") - Defines if you want to use SSL for ldap authentication
20
+ $users_automount (default: "no") - Set to "yes" if you want to enable homes automount
21
+
22
+
23
+ USAGE:
24
+ # Standard Classes
25
+ include users # Manages users via Puppet. Set the above variables to manage ldap authentication.
26
+ # If $my_project is set, it autoloads users::$my_project where you can define custom local users and custom configurations
27
+
28
+ DEPENDENCIES:
@@ -0,0 +1,16 @@
1
+ define adduser ( $uid='', $gid='', $shell='/bin/bash', $home='', $comment='', $password='', $groups='' ) {
2
+
3
+ user {
4
+ "$name":
5
+ # Temp fix for err: //Node[test.example42.com]/general/hardening::eal4/users::admins/Adduser[admin]/User[admin]/uid: change from 500 to failed: Could not set uid on user[admin]: Execution of '/usr/sbin/usermod -u admin' returned 4: usermod: uid 0 is not unique
6
+ # Uncomment and fix when necessary
7
+ # uid => $uid,
8
+ # gid => $gid,
9
+ shell => $shell,
10
+ comment => $comment,
11
+ home => $home,
12
+ password => $password,
13
+ groups => $groups,
14
+ ensure => present,
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ class users::admin {
2
+ # Creates user: admin with wheel privileges
3
+ # Default password = 'example' CHANGE IT
4
+ user {
5
+ "admin":
6
+ ensure => present,
7
+ groups => 'wheel',
8
+ # Default password = 'example' CHANGE IT before uncommenting
9
+ # password => '$1$xd/jf97n$ZAhAz.CIGJ0gUECBohz/..',
10
+ }
11
+ }
@@ -0,0 +1,34 @@
1
+ # Class: users::automount
2
+ #
3
+ # Manages users' home directory automount
4
+ #
5
+ # Usage:
6
+ # Set $users_auth = "ldap" and $users_automount = "yes" and
7
+ # include users
8
+ # NOTE/TODO: This class is made for automounter based on ldap. When and if other auth methods will be supported this class will be refactored.
9
+ #
10
+ # Variables:
11
+ # $users_automount (default: "no") - Set to "yes" if you want to enable homes automount
12
+ #
13
+ class users::automount {
14
+
15
+ # Load the variables used in this module. Check the params.pp file
16
+ include users::params
17
+
18
+ $users_ldap_servers = $users::params::ldap_servers
19
+ $users_ldap_basedn = $users::params::ldap_basedn
20
+ $users_ldap_ssl = $users::params::ldap_ssl
21
+ $users_automount = $users::params::automount
22
+
23
+ # Required packages
24
+ case $operatingsystem {
25
+ ubuntu,debian: {
26
+ package { "autofs": ensure => present }
27
+ package { "autofs-ldap": ensure => present }
28
+ }
29
+ redhat,centos: {
30
+ }
31
+ }
32
+
33
+ }
34
+
@@ -0,0 +1,8 @@
1
+ define deluser {
2
+
3
+ user {
4
+ "$name":
5
+ ensure => absent,
6
+ }
7
+ }
8
+
@@ -0,0 +1,16 @@
1
+ class users::example42 {
2
+ # Adds a local "example42" user, With password "example42".
3
+ user {
4
+ "example42":
5
+ comment => "Example 42 default user",
6
+ password => '$1$xd/jf97n$ZAhAz.CIGJ0gUECBohz/..',
7
+ ensure => present,
8
+ }
9
+
10
+ # Uncomment below to remove example42 user
11
+ # user {
12
+ # "example42":
13
+ # ensure => absent,
14
+ # }
15
+
16
+ }
@@ -0,0 +1,31 @@
1
+ # Class: users
2
+ #
3
+ # Manages local users and external authentication methods
4
+ #
5
+ # Usage:
6
+ # include users
7
+ #
8
+ # Variables:
9
+ # $users_auth (default: "local") - Defines the authentication method to be used. Default uses only local authentication, set to "ldap" to ADD ldap authentication.
10
+ # $users_ldap_servers (default: ["ldapm.example42.com","ldaps.example42.com"]) - Defines the ldap backend server(s) you want to use for ldap authentication
11
+ # $users_ldap_basedn (default: "dc=example42,dc=com") - Defines the ldap base dn for ldap authentication
12
+ # $users_ldap_ssl (default: "no") - Defines if you want to use SSL for ldap authentication
13
+ # $users_automount (default: "no") - Set to "yes" if you want to enable homes automount
14
+ #
15
+ class users {
16
+
17
+ # Load the variables used in this module. Check the params.pp file
18
+ include users::params
19
+
20
+ # Include the relevant subclass according to $users_auth settings
21
+ case $users::params::auth {
22
+ ldap: { include users::ldap }
23
+ # TODO ads: { include users::ads }
24
+ # TODO nis: { include users::nis }
25
+ }
26
+
27
+ # Autoloads users::$my_project if $my_project is defined
28
+ # Place in users::$my_project your customizatios
29
+ if $my_project { include "users::${my_project}" }
30
+
31
+ }
@@ -0,0 +1,114 @@
1
+ # Class: users::ldap
2
+ #
3
+ # Manages ldap authentication
4
+ #
5
+ # Usage:
6
+ # Set $users_auth = "ldap" and
7
+ # include users
8
+ #
9
+ # Variables:
10
+ # $users_ldap_servers (default: ["ldapm.example42.com","ldaps.example42.com"]) - Defines the ldap backend server(s) you want to use for ldap authentication
11
+ # $users_ldap_basedn (default: "dc=example42,dc=com") - Defines the ldap base dn for ldap authentication
12
+ # $users_ldap_ssl (default: "no") - Defines if you want to use SSL for ldap authentication
13
+ # $users_automount (default: "no") - Set to "yes" if you want to enable homes automount
14
+ #
15
+ class users::ldap {
16
+
17
+ # Load the variables used in this module. Check the params.pp file
18
+ include users::params
19
+
20
+ $users_ldap_servers = $users::params::ldap_servers
21
+ $users_ldap_basedn = $users::params::ldap_basedn
22
+ $users_ldap_ssl = $users::params::ldap_ssl
23
+ $users_ldap_cacert = $users::params::ldap_cacert
24
+ $users_automount = $users::params::automount
25
+
26
+ # PAM's configurations for ldap are managed in the dedicated pam::ldap class
27
+ include pam::ldap
28
+
29
+ # Include autofs::ldap if $users_automount = "yes"
30
+ if $users::params::automount == "yes" { include "autofs::ldap" }
31
+
32
+ # Systems' config files for LDAP
33
+ file { "nsswitch.conf":
34
+ path => "/etc/nsswitch.conf",
35
+ mode => "644",
36
+ owner => "root",
37
+ group => "root",
38
+ require => [ File["ldap.conf"] ],
39
+ ensure => present,
40
+ content => template("users/ldap/nsswitch.conf.erb"),
41
+ }
42
+
43
+ file { "ldap.conf":
44
+ path => $users::params::configfile_ldap ,
45
+ mode => "644",
46
+ owner => "root",
47
+ group => "root",
48
+ ensure => present,
49
+ content => template("users/ldap/ldap.conf.erb"),
50
+ }
51
+
52
+ # Openldap client config
53
+ file { "openldap-ldap.conf":
54
+ path => $operatingsystem ? {
55
+ debian => "/etc/ldap/ldap.conf",
56
+ ubuntu => "/etc/ldap/ldap.conf",
57
+ redhat => "/etc/openldap/ldap.conf",
58
+ centos => "/etc/openldap/ldap.conf",
59
+ },
60
+ mode => "644",
61
+ owner => "root",
62
+ group => "root",
63
+ ensure => present,
64
+ content => template("users/ldap/openldap-ldap.conf.erb"),
65
+ # TOTO - Breaks on ubuntu804 - Verify
66
+ # notify => $users_automount ? {
67
+ # "yes" => "Service[autofs]",
68
+ # default => undef,
69
+ # },
70
+ }
71
+
72
+ case $users_ldap_ssl {
73
+ yes: {
74
+ file { "ldap_cacert":
75
+ path => "${users::params::ldap_cacert}",
76
+ mode => "644",
77
+ owner => "root",
78
+ group => "root",
79
+ ensure => present,
80
+ source => "${users::params::users_source}/ldap/cacert.pem",
81
+ }
82
+ }
83
+ }
84
+
85
+
86
+ # Required packages
87
+ case $operatingsystem {
88
+ Ubuntu,Debian: {
89
+ package { "libpam-ldap": ensure => present }
90
+ package { "libnss-ldap": ensure => present }
91
+ package { "ldap-utils": ensure => present }
92
+
93
+ case $lsbdistcodename {
94
+ lenny: {
95
+ # Debian 5, by default, uses a separated file for pam ldap settings
96
+ file { "pam_ldap.conf":
97
+ path => "/etc/pam_ldap.conf",
98
+ mode => "644",
99
+ owner => "root",
100
+ group => "root",
101
+ ensure => present,
102
+ content => template("users/ldap/ldap.conf.erb"),
103
+ }
104
+ }
105
+ }
106
+
107
+ }
108
+ redhat,centos: {
109
+ package { "nss_ldap": ensure => present }
110
+ }
111
+ }
112
+
113
+ }
114
+
@@ -0,0 +1,84 @@
1
+ # Class: users::params
2
+ #
3
+ # Defines users parameters
4
+ # In this class are defined as variables values that are used in other users classes
5
+ # This class should be included, where necessary, and eventually be enhanced with support for more OS
6
+ # You don't have generally to modify this file.
7
+ #
8
+ class users::params {
9
+
10
+ ## DEFAULTS FOR VARIABLES USERS CAN SET
11
+ # (Here are set the defaults, provide your custom variables externally)
12
+
13
+ # Define the authentication method to be used
14
+ $auth = $users_auth ? {
15
+ '' => "local",
16
+ default => $users_auth,
17
+ }
18
+
19
+ # Define the ldap server(s) to use (If $users_auth=ldap)
20
+ $ldap_servers = $users_ldap_servers ? {
21
+ '' => [ "ldapm.example42.com" , "ldaps.example42.com" ],
22
+ default => $users_ldap_servers,
23
+ }
24
+
25
+ # Define the ldap basdn to use (If $users_auth=ldap)
26
+ $ldap_basedn = $users_ldap_basedn ? {
27
+ '' => "dc=example42,dc=com",
28
+ default => $users_ldap_basedn,
29
+ }
30
+
31
+ # Define if you want to use SSL for ldap authentication (If $users_auth=ldap)
32
+ $ldap_ssl = $users_ldap_ssl ? {
33
+ '' => "no",
34
+ default => $users_ldap_ssl,
35
+ }
36
+
37
+ # Define if you want to use automount (If $users_auth=ldap)
38
+ $automount = $users_automount ? {
39
+ '' => "no",
40
+ default => $users_automount,
41
+ }
42
+
43
+
44
+
45
+ ## MODULES INTERNAL VARIABLES
46
+ # (Modify only to adapt to unsupported OSes)
47
+
48
+ $ldap_cacert = $operatingsystem ? {
49
+ 'debian' => "/etc/ldap/cacert.pem",
50
+ 'ubuntu' => "/etc/ldap/cacert.pem",
51
+ default => "/etc/openldap/cacert.pem",
52
+ }
53
+
54
+ $configfile_ldap = $operatingsystem ? {
55
+ debian => $lsbdistid ? {
56
+ debian => "/etc/libnss-ldap.conf",
57
+ ubuntu => "/etc/ldap.conf",
58
+ },
59
+ ubuntu => "/etc/ldap.conf",
60
+ redhat => "/etc/ldap.conf",
61
+ centos => "/etc/ldap.conf",
62
+ }
63
+
64
+
65
+ ## FILE SERVING SOURCE
66
+ # Sets the correct source for static files
67
+ # In order to provide files from different sources without modifying the module
68
+ # you can override the default source path setting the variable $base_source
69
+ # Ex: $base_source="puppet://ip.of.fileserver" or $base_source="puppet://$servername/myprojectmodule"
70
+
71
+ # What follows automatically manages the new source standard (with /modules/) from 0.25
72
+
73
+ case $base_source {
74
+ '': { $general_base_source="puppet://$servername" }
75
+ default: { $general_base_source=$base_source }
76
+ }
77
+
78
+ $users_source = $puppetversion ? {
79
+ /(^0.25)/ => "$general_base_source/modules/users",
80
+ /(^0.)/ => "$general_base_source/users",
81
+ default => "$general_base_source/modules/users",
82
+ }
83
+
84
+ }
@@ -0,0 +1,13 @@
1
+ # File managed by Puppet
2
+ host <% users_ldap_servers.each do |ldap| %><%= ldap %> <% end %>
3
+ base <%= users_ldap_basedn %>
4
+ pam_password exop
5
+ pam_lookup_policy yes
6
+
7
+ <% if users_ldap_ssl == "yes" && operatingsystem != "Ubuntu" -%>
8
+ ssl start_tls
9
+ tls_cacertfile <%= users_ldap_cacert %>
10
+ tls_checkpeer yes
11
+ <% end -%>
12
+
13
+ nss_initgroups_ignoreusers Debian-exim,backup,bin,daemon,dhcp,games,gnats,irc,klog,libuuid,list,lp,mail,man,news,ntpd,proxy,root,snmp,sshd,statd,sync,sys,syslog,uucp,www-data
@@ -0,0 +1,23 @@
1
+ # /etc/nsswitch.conf
2
+ #
3
+ # File managed by Puppet
4
+
5
+ passwd: files ldap
6
+ group: files
7
+ shadow: files ldap
8
+ <% if users_automount == "yes" -%>
9
+ automount: ldap
10
+ <% else -%>
11
+ automount: files
12
+ <% end -%>
13
+
14
+ hosts: files dns
15
+ networks: files
16
+
17
+ protocols: db files
18
+ services: db files
19
+ ethers: db files
20
+ rpc: db files
21
+
22
+ # netgroup: nis
23
+
@@ -0,0 +1,8 @@
1
+ # File Managed by Puppet
2
+ HOST <% users_ldap_servers.each do |ldap| -%><%= ldap -%> <% end %>
3
+ URI ldap://<%= users_ldap_servers.first %>
4
+ BASE <%= users_ldap_basedn %>
5
+ <% if users_ldap_ssl == "yes" -%>
6
+ TLS_CACERT <%= users_ldap_cacert %>
7
+ TLS_REQCERT demand
8
+ <% end -%>
@@ -0,0 +1,31 @@
1
+ class webmin {
2
+ $base = "webmin_1.480_all.deb"
3
+ $url = "http://prdownloads.sourceforge.net/webadmin/"
4
+ $archive = "/root/$base"
5
+ $installed = "/etc/webmin/version"
6
+
7
+ package { "libnet-ssleay-perl": ensure => installed }
8
+ package { "libauthen-pam-perl": ensure => installed }
9
+ package { "libio-pty-perl": ensure => installed }
10
+ package { "libmd5-perl": ensure => installed }
11
+
12
+ service { webmin:
13
+ ensure => running,
14
+ require => Exec["InstallWebmin"],
15
+ provider => init;
16
+ }
17
+
18
+ exec { "DownloadWebmin":
19
+ cwd => "/root",
20
+ command => "wget $url$base",
21
+ creates => $archive,
22
+ }
23
+
24
+ exec { "InstallWebmin":
25
+ cwd => "/root",
26
+ command => "dpkg -i $archive",
27
+ creates => $installed,
28
+ require => Exec["DownloadWebmin"],
29
+ notify => Service[webmin],
30
+ }
31
+ }
@@ -0,0 +1 @@
1
+ # This role intentionally left blank
data/puppet/site.pp ADDED
@@ -0,0 +1,8 @@
1
+ Exec {
2
+ path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
3
+ }
4
+
5
+ import "classes/*"
6
+ include base, gemrc, postfix, logrotate, ufw, imagemagick
7
+
8
+ import "roles/*"