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,166 @@
1
+ class rvm::ruby($ruby_version, $rvm_prefix) {
2
+ $binpath = "${rvm_prefix}bin/"
3
+
4
+ exec {
5
+ "rvm-install-ruby":
6
+ command => "${binpath}rvm install ${ruby_version}",
7
+ creates => "${rvm_prefix}rvm/rubies/${ruby_version}",
8
+ logoutput => 'on_failure',
9
+ timeout => "-1",
10
+ require => [Class["rvm::system"], Exec["system-rvm"]];
11
+ }
12
+ }
13
+
14
+ class rvm::passenger($ruby_version, $version, $rvm_prefix) {
15
+ $gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems"
16
+ $binpath = "${rvm_prefix}rvm/rubies/${ruby_version}/bin"
17
+
18
+ exec {
19
+ "passenger-gem":
20
+ command => "${rvm_prefix}rvm/rubies/${ruby_version}/bin/gem install passenger --no-ri --no-rdoc",
21
+ creates => "${binpath}/passenger",
22
+ require => Exec["rvm-install-ruby"];
23
+ }
24
+ }
25
+
26
+ class rvm::passenger::apache(
27
+ $ruby_version = 'ruby-1.9.2-p290',
28
+ $version = '3.0.8',
29
+ $rvm_prefix = '/usr/local/',
30
+ $mininstances = '1',
31
+ $maxpoolsize = '6',
32
+ $poolidletime = '300',
33
+ $maxinstancesperapp = '0',
34
+ $spawnmethod = 'smart-lv2'
35
+ ) {
36
+
37
+ # TODO: How can we get the gempath automatically using the ruby version
38
+ # Can we read the output of a command into a variable?
39
+ # e.g. $gempath = `usr/local/bin/rvm ${ruby_version} exec rvm gemdir`
40
+ $gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems"
41
+ $binpath = $rvm_prefix ? {
42
+ '/usr/local/' => '/usr/local/bin/',
43
+ default => "${rvm_prefix}rvm/bin/"
44
+ }
45
+
46
+ # TODO: How to inherit this from above?
47
+ class { 'rvm::ruby': ruby_version => $ruby_version, rvm_prefix => $rvm_prefix }
48
+ class { 'rvm::passenger': ruby_version => $ruby_version, version => $version, rvm_prefix => $rvm_prefix }
49
+ include apache
50
+
51
+ # Dependencies
52
+ if ! defined(Package['build-essential']) { package { build-essential: ensure => installed } }
53
+ if ! defined(Package['apache2-prefork-dev']) { package { apache2-prefork-dev: ensure => installed } }
54
+ if ! defined(Package['libapr1-dev']) { package { libapr1-dev: ensure => installed, alias => 'libapr-dev' } }
55
+ if ! defined(Package['libaprutil1-dev']) { package { libaprutil1-dev: ensure => installed, alias => 'libaprutil-dev' } }
56
+ if ! defined(Package['libcurl4-openssl-dev']) { package { libcurl4-openssl-dev: ensure => installed } }
57
+
58
+ exec {
59
+ 'passenger-install-apache2-module':
60
+ command => "${binpath}rvm ${ruby_version} exec passenger-install-apache2-module -a",
61
+ creates => "${gempath}/passenger-${version}/ext/apache2/mod_passenger.so",
62
+ logoutput => 'on_failure',
63
+ require => [
64
+ Class['rvm::system'],
65
+ Exec['system-rvm'],
66
+ Exec['rvm-install-ruby'],
67
+ Exec['passenger-gem'],
68
+ Package[
69
+ 'apache2',
70
+ 'build-essential',
71
+ 'apache2-prefork-dev',
72
+ 'libapr-dev',
73
+ 'libaprutil-dev',
74
+ 'libcurl4-openssl-dev'
75
+ ]
76
+ ];
77
+ }
78
+
79
+ file {
80
+ '/etc/apache2/mods-available/passenger.load':
81
+ content => "LoadModule passenger_module ${gempath}/passenger-${version}/ext/apache2/mod_passenger.so",
82
+ ensure => file,
83
+ require => Exec['passenger-install-apache2-module'];
84
+
85
+ '/etc/apache2/mods-available/passenger.conf':
86
+ content => template('rvm/passenger-apache.conf.erb'),
87
+ ensure => file,
88
+ require => Exec['passenger-install-apache2-module'];
89
+
90
+ '/etc/apache2/mods-enabled/passenger.load':
91
+ ensure => 'link',
92
+ target => '../mods-available/passenger.load',
93
+ require => File['/etc/apache2/mods-available/passenger.load'];
94
+
95
+ '/etc/apache2/mods-enabled/passenger.conf':
96
+ ensure => 'link',
97
+ target => '../mods-available/passenger.conf',
98
+ require => File['/etc/apache2/mods-available/passenger.conf'];
99
+ }
100
+
101
+ # Add Apache restart hooks
102
+ File['/etc/apache2/mods-available/passenger.load'] ~> Service['apache']
103
+ File['/etc/apache2/mods-available/passenger.conf'] ~> Service['apache']
104
+ File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache']
105
+ File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache']
106
+ }
107
+
108
+ class ruby::passenger::apache::disable {
109
+
110
+ file {
111
+ '/etc/apache2/mods-enabled/passenger.load':
112
+ ensure => 'absent';
113
+ '/etc/apache2/mods-enabled/passenger.conf':
114
+ ensure => 'absent';
115
+ }
116
+
117
+ # Add Apache restart hooks
118
+ if defined(Service['apache']) { File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache'] }
119
+ if defined(Service['apache']) { File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache'] }
120
+ }
121
+
122
+ class rvm::passenger::nginx(
123
+ $ruby_version = 'ruby-1.9.2-p290',
124
+ $version = '3.0.8',
125
+ $rvm_prefix = '/usr/local/',
126
+ $mininstances = '1',
127
+ $maxpoolsize = '6',
128
+ $poolidletime = '300',
129
+ $maxinstancesperapp = '0',
130
+ $spawnmethod = 'smart-lv2'
131
+ ) {
132
+
133
+ # TODO: How can we get the gempath automatically using the ruby version
134
+ # Can we read the output of a command into a variable?
135
+ # e.g. $gempath = `usr/local/bin/rvm ${ruby_version} exec rvm gemdir`
136
+ $gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems"
137
+ $binpath = $rvm_prefix ? {
138
+ '/usr/local/' => '/usr/local/bin/',
139
+ default => "${rvm_prefix}rvm/bin/"
140
+ }
141
+
142
+ # TODO: How to inherit this from above?
143
+ class { 'rvm::ruby': ruby_version => $ruby_version, rvm_prefix => $rvm_prefix }
144
+ class { 'rvm::passenger': ruby_version => $ruby_version, version => $version, rvm_prefix => $rvm_prefix }
145
+
146
+ # Dependencies
147
+ if ! defined(Package['build-essential']) { package { build-essential: ensure => installed } }
148
+ if ! defined(Package['libcurl4-openssl-dev']) { package { libcurl4-openssl-dev: ensure => installed } }
149
+
150
+ exec {
151
+ 'passenger-install-nginx-module':
152
+ command => "${binpath}rvm ${ruby_version} exec passenger-install-nginx-module --auto --auto-download",
153
+ creates => "${gempath}/passenger-${version}/ext/nginx/mod_passenger.so",
154
+ logoutput => 'on_failure',
155
+ require => [
156
+ Class['rvm::system'],
157
+ Exec['system-rvm'],
158
+ Exec['rvm-install-ruby'],
159
+ Exec['passenger-gem'],
160
+ Package[
161
+ 'build-essential',
162
+ 'libcurl4-openssl-dev'
163
+ ]
164
+ ];
165
+ }
166
+ }
@@ -0,0 +1,33 @@
1
+ class rvm::system {
2
+
3
+ include rvm::dependencies
4
+
5
+ file {'install-system-rvm':
6
+ ensure => 'present',
7
+ path => '/root/install-system-rvm',
8
+ owner => 'root', group => 'root', mode => '0774',
9
+ source => 'puppet:///modules/rvm/install-system-rvm';
10
+ }
11
+
12
+ exec { 'system-rvm':
13
+ command => '/root/install-system-rvm',
14
+ require => [
15
+ File['install-system-rvm'],
16
+ Package['curl', 'git-core'],
17
+ Class['rvm::dependencies'],
18
+ ],
19
+ creates => '/usr/local/rvm';
20
+ }
21
+
22
+ exec { 'rvm-get-head':
23
+ command => '/usr/local/rvm/bin/rvm get head',
24
+ require => [
25
+ Exec['system-rvm'],
26
+ File['install-system-rvm'],
27
+ Package['curl', 'git-core'],
28
+ Class['rvm::dependencies'],
29
+ ],
30
+ creates => '/usr/local/bin/rvm';
31
+ }
32
+
33
+ }
@@ -0,0 +1,13 @@
1
+
2
+ define rvm::system_user () {
3
+
4
+ $username = $title
5
+ $group = $operatingsystem ? {
6
+ default => 'rvm',
7
+ }
8
+
9
+ exec { "/usr/sbin/usermod -a -G $group $username":
10
+ unless => "cat /etc/group | grep $group | grep $username",
11
+ require => [User[$username], Exec['system-rvm']];
12
+ }
13
+ }
@@ -0,0 +1,2 @@
1
+ import "classes/*.pp"
2
+ import "definitions/*.pp"
@@ -0,0 +1,9 @@
1
+ <IfModule passenger_module>
2
+ PassengerRoot <%= gempath %>/passenger-<%= version %>
3
+ PassengerRuby <%= rvm_prefix %>rvm/wrappers/<%= ruby_version %>/ruby
4
+ PassengerMaxPoolSize <%= maxpoolsize %>
5
+ PassengerPoolIdleTime <%= poolidletime %>
6
+ PassengerMinInstances <%= mininstances %>
7
+ PassengerMaxInstancesPerApp <%= maxinstancesperapp %>
8
+ PassengerSpawnMethod <%= spawnmethod %>
9
+ </IfModule>
@@ -0,0 +1,4 @@
1
+ # Lab42 Puppet Infrastructure #
2
+ # PROVIDED 'AS IS'
3
+
4
+
@@ -0,0 +1,39 @@
1
+ # Fake null class
2
+
3
+ class ssh::auth {
4
+
5
+ define key ($ensure = "present", $filename = "", $force = false, $group = "puppet", $home = "", $keytype = "rsa", $length = 2048, $maxdays = "", $mindate = "", $options = "", $user = "") {
6
+
7
+ }
8
+
9
+
10
+ class keymaster {
11
+ } # class keymaster
12
+
13
+
14
+ define client ($ensure = "", $filename = "", $group = "", $home = "", $user = "") {
15
+ } # define client
16
+
17
+
18
+ define server ($ensure = "", $group = "", $home = "", $options = "", $user = "") {
19
+ } # define server
20
+
21
+ } # class ssh::auth
22
+
23
+
24
+ define ssh_auth_key_master ($ensure, $force, $keytype, $length, $maxdays, $mindate) {
25
+
26
+ } # define ssh_auth_key_master
27
+
28
+ define ssh_auth_key_client ($ensure, $filename, $group, $home, $user) {
29
+
30
+ } # define ssh_auth_key_client
31
+
32
+ define ssh_auth_key_server ($ensure, $group, $home, $options, $user) {
33
+
34
+ } # define ssh_auth_key_server
35
+
36
+
37
+ define ssh_auth_key_namecheck ($parm, $value) {
38
+ } # define namecheck
39
+
@@ -0,0 +1,340 @@
1
+ # This class has been written by Andrew E. Schulman
2
+ # It has been imported in Example42 under the terms of GPL3
3
+ #
4
+ # =========
5
+ # ssh::auth
6
+ # =========
7
+ #
8
+ # The latest official release and documentation for ssh::auth can always
9
+ # be found at http://reductivelabs.com/trac/puppet/wiki/Recipes/ModuleSSHAuth .
10
+ #
11
+ # Version: 0.3.2
12
+ # Release date: 2009-12-29
13
+
14
+ class ssh::auth {
15
+
16
+ $keymaster_storage = "/var/lib/keys"
17
+
18
+ Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }
19
+ Notify { withpath => false }
20
+
21
+
22
+ ##########################################################################
23
+
24
+
25
+ # ssh::auth::key
26
+
27
+ # Declare keys. The approach here is just to define a bunch of
28
+ # virtual resources, representing key files on the keymaster, client,
29
+ # and server. The virtual keys are then realized by
30
+ # ssh::auth::{keymaster,client,server}, respectively. The reason for
31
+ # doing things that way is that it makes ssh::auth::key into a "one
32
+ # stop shop" where users can declare their keys with all of their
33
+ # parameters, whether those parameters apply to the keymaster, server,
34
+ # or client. The real work of creating, installing, and removing keys
35
+ # is done in the private definitions called by the virtual resources:
36
+ # ssh_auth_key_{master,server,client}.
37
+
38
+ define key ($ensure = "present", $filename = "", $force = false, $group = "puppet", $home = "", $keytype = "rsa", $length = 2048, $maxdays = "", $mindate = "", $options = "", $user = "") {
39
+
40
+ ssh_auth_key_namecheck { "${title}-title": parm => "title", value => $title }
41
+
42
+ # apply defaults
43
+ $_filename = $filename ? { "" => "id_${keytype}", default => $filename }
44
+ $_length = $keytype ? { "rsa" => $length, "dsa" => 1024 }
45
+ $_user = $user ? {
46
+ "" => regsubst($title, '^([^@]*)@?.*$', '\1'),
47
+ default => $user,
48
+ }
49
+ $_home = $home ? { "" => "/home/$_user", default => $home }
50
+
51
+ ssh_auth_key_namecheck { "${title}-filename": parm => "filename", value => $_filename }
52
+
53
+ @ssh_auth_key_master { $title:
54
+ ensure => $ensure,
55
+ force => $force,
56
+ keytype => $keytype,
57
+ length => $_length,
58
+ maxdays => $maxdays,
59
+ mindate => $mindate,
60
+ }
61
+ @ssh_auth_key_client { $title:
62
+ ensure => $ensure,
63
+ filename => $_filename,
64
+ group => $group,
65
+ home => $_home,
66
+ user => $_user,
67
+ }
68
+ @ssh_auth_key_server { $title:
69
+ ensure => $ensure,
70
+ group => $group,
71
+ home => $_home,
72
+ options => $options,
73
+ user => $_user,
74
+ }
75
+ }
76
+
77
+
78
+ ##########################################################################
79
+
80
+
81
+ # ssh::auth::keymaster
82
+ #
83
+ # Keymaster host:
84
+ # Create key storage; create, regenerate, and remove key pairs
85
+
86
+ class keymaster {
87
+
88
+ # Set up key storage
89
+
90
+ file { $ssh::auth::keymaster_storage:
91
+ ensure => directory,
92
+ owner => puppet,
93
+ group => puppet,
94
+ mode => 644,
95
+ }
96
+
97
+ # Realize all virtual master keys
98
+ Ssh_auth_key_master <| |>
99
+
100
+ } # class keymaster
101
+
102
+
103
+ ##########################################################################
104
+
105
+
106
+ # ssh::auth::client
107
+ #
108
+ # Install generated key pairs onto clients
109
+
110
+ define client ($ensure = "", $filename = "", $group = "", $home = "", $user = "") {
111
+
112
+ # Realize the virtual client keys.
113
+ # Override the defaults set in ssh::auth::key, as needed.
114
+ if $ensure { Ssh_auth_key_client <| title == $title |> { ensure => $ensure } }
115
+ if $filename { Ssh_auth_key_client <| title == $title |> { filename => $filename } }
116
+ if $group { Ssh_auth_key_client <| title == $title |> { group => $group } }
117
+
118
+ if $user { Ssh_auth_key_client <| title == $title |> { user => $user, home => "/home/$user" } }
119
+ if $home { Ssh_auth_key_client <| title == $title |> { home => $home } }
120
+
121
+ realize Ssh_auth_key_client[$title]
122
+
123
+ } # define client
124
+
125
+
126
+ ##########################################################################
127
+
128
+
129
+ # ssh::auth::server
130
+ #
131
+ # Install public keys onto clients
132
+
133
+ define server ($ensure = "", $group = "", $home = "", $options = "", $user = "") {
134
+
135
+ # Realize the virtual server keys.
136
+ # Override the defaults set in ssh::auth::key, as needed.
137
+ if $ensure { Ssh_auth_key_server <| title == $title |> { ensure => $ensure } }
138
+ if $group { Ssh_auth_key_server <| title == $title |> { group => $group } }
139
+ if $options { Ssh_auth_key_server <| title == $title |> { options => $options } }
140
+
141
+ if $user { Ssh_auth_key_server <| title == $title |> { user => $user, home => "/home/$user" } }
142
+ if $home { Ssh_auth_key_server <| title == $title |> { home => $home } }
143
+
144
+ realize Ssh_auth_key_server[$title]
145
+
146
+ } # define server
147
+
148
+ } # class ssh::auth
149
+
150
+
151
+ ##########################################################################
152
+
153
+
154
+ # ssh_auth_key_master
155
+ #
156
+ # Create/regenerate/remove a key pair on the keymaster.
157
+ # This definition is private, i.e. it is not intended to be called directly by users.
158
+ # ssh::auth::key calls it to create virtual keys, which are realized in ssh::auth::keymaster.
159
+
160
+ define ssh_auth_key_master ($ensure, $force, $keytype, $length, $maxdays, $mindate) {
161
+
162
+ Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }
163
+ File {
164
+ owner => puppet,
165
+ group => puppet,
166
+ mode => 600,
167
+ }
168
+
169
+ $keydir = "${ssh::auth::keymaster_storage}/${title}"
170
+ $keyfile = "${keydir}/key"
171
+
172
+ file {
173
+ "$keydir":
174
+ ensure => directory,
175
+ mode => 644;
176
+ "$keyfile":
177
+ ensure => $ensure;
178
+ "${keyfile}.pub":
179
+ ensure => $ensure,
180
+ mode => 644;
181
+ }
182
+
183
+ if $ensure == "present" {
184
+
185
+ # Remove the existing key pair, if
186
+ # * $force is true, or
187
+ # * $maxdays or $mindate criteria aren't met, or
188
+ # * $keytype or $length have changed
189
+
190
+ $keycontent = file("${keyfile}.pub", "/dev/null")
191
+ if $keycontent {
192
+
193
+ if $force {
194
+ $reason = "force=true"
195
+ }
196
+ if !$reason and $mindate and generate("/usr/bin/find", $keyfile, "!", "-newermt", "${mindate}") {
197
+ $reason = "created before ${mindate}"
198
+ }
199
+ if !$reason and $maxdays and generate("/usr/bin/find", $keyfile, "-mtime", "+${maxdays}") {
200
+ $reason = "older than ${maxdays} days"
201
+ }
202
+ if !$reason and $keycontent =~ /^ssh-... [^ ]+ (...) (\d+)$/ {
203
+ if $keytype != $1 { $reason = "keytype changed: $1 -> $keytype" }
204
+ else { if $length != $2 { $reason = "length changed: $2 -> $length" } }
205
+ }
206
+ if $reason {
207
+ exec { "Revoke previous key ${title}: ${reason}":
208
+ command => "rm $keyfile ${keyfile}.pub",
209
+ before => Exec["Create key $title: $keytype, $length bits"],
210
+ }
211
+ }
212
+ }
213
+
214
+ # Create the key pair.
215
+ # We "repurpose" the comment field in public keys on the keymaster to
216
+ # store data about the key, i.e. $keytype and $length. This avoids
217
+ # having to rerun ssh-keygen -l on every key at every run to determine
218
+ # the key length.
219
+ exec { "Create key $title: $keytype, $length bits":
220
+ command => "ssh-keygen -t ${keytype} -b ${length} -f ${keyfile} -C \"${keytype} ${length}\" -N \"\"",
221
+ user => "puppet",
222
+ group => "puppet",
223
+ creates => $keyfile,
224
+ require => File[$keydir],
225
+ before => File[$keyfile, "${keyfile}.pub"],
226
+ }
227
+
228
+ } # if $ensure == "present"
229
+
230
+ } # define ssh_auth_key_master
231
+
232
+
233
+ ##########################################################################
234
+
235
+
236
+ # ssh_auth_key_client
237
+ #
238
+ # Install a key pair into a user's account.
239
+ # This definition is private, i.e. it is not intended to be called directly by users.
240
+
241
+ define ssh_auth_key_client ($ensure, $filename, $group, $home, $user) {
242
+
243
+ File {
244
+ owner => $user,
245
+ group => $group,
246
+ mode => 600,
247
+ require => User[$user],
248
+ }
249
+
250
+ $key_src_file = "${ssh::auth::keymaster_storage}/${title}/key" # on the keymaster
251
+ $key_tgt_file = "${home}/.ssh/${filename}" # on the client
252
+
253
+ $key_src_content_pub = file("${key_src_file}.pub", "/dev/null")
254
+ if $ensure == "absent" or $key_src_content_pub =~ /^(ssh-...) ([^ ]+)/ {
255
+ $keytype = $1
256
+ $modulus = $2
257
+ file {
258
+ $key_tgt_file:
259
+ ensure => $ensure,
260
+ content => file($key_src_file, "/dev/null");
261
+ "${key_tgt_file}.pub":
262
+ ensure => $ensure,
263
+ content => "$keytype $modulus $title\n",
264
+ mode => 644;
265
+ }
266
+ } else {
267
+ notify { "Private key file $key_src_file for key $title not found on keymaster; skipping ensure => present": }
268
+ }
269
+
270
+ } # define ssh_auth_key_client
271
+
272
+
273
+ ##########################################################################
274
+
275
+
276
+ # ssh_auth_key_server
277
+ #
278
+ # Install a public key into a server user's authorized_keys(5) file.
279
+ # This definition is private, i.e. it is not intended to be called directly by users.
280
+
281
+ define ssh_auth_key_server ($ensure, $group, $home, $options, $user) {
282
+
283
+ # on the keymaster:
284
+ $key_src_dir = "${ssh::auth::keymaster_storage}/${title}"
285
+ $key_src_file = "${key_src_dir}/key.pub"
286
+ # on the server:
287
+ $key_tgt_file = "${home}/.ssh/authorized_keys"
288
+
289
+ File {
290
+ owner => $user,
291
+ group => $group,
292
+ require => User[$user],
293
+ mode => 600,
294
+ }
295
+ Ssh_authorized_key {
296
+ user => $user,
297
+ target => $key_tgt_file,
298
+ }
299
+
300
+ if $ensure == "absent" {
301
+ ssh_authorized_key { $title: ensure => "absent" }
302
+ }
303
+ else {
304
+ $key_src_content = file($key_src_file, "/dev/null")
305
+ if ! $key_src_content {
306
+ notify { "Public key file $key_src_file for key $title not found on keymaster; skipping ensure => present": }
307
+ } else { if $ensure == "present" and $key_src_content !~ /^(ssh-...) ([^ ]*)/ {
308
+ err("Can't parse public key file $key_src_file")
309
+ notify { "Can't parse public key file $key_src_file for key $title on the keymaster: skipping ensure => $ensure": }
310
+ } else {
311
+ $keytype = $1
312
+ $modulus = $2
313
+ ssh_authorized_key { $title:
314
+ ensure => "present",
315
+ type => $keytype,
316
+ key => $modulus,
317
+ options => $options ? { "" => undef, default => $options },
318
+ }
319
+ }} # if ... else ... else
320
+ } # if ... else
321
+
322
+ } # define ssh_auth_key_server
323
+
324
+
325
+ ##########################################################################
326
+
327
+
328
+ # ssh_auth_key_namecheck
329
+ #
330
+ # Check a name (e.g. key title or filename) for the allowed form
331
+
332
+ define ssh_auth_key_namecheck ($parm, $value) {
333
+ if $value !~ /^[A-Za-z0-9]/ {
334
+ fail("ssh::auth::key: $parm '$value' not allowed: must begin with a letter or digit")
335
+ }
336
+ if $value !~ /^[A-Za-z0-9_.:@-]+$/ {
337
+ fail("ssh::auth::key: $parm '$value' not allowed: may only contain the characters A-Za-z0-9_.:@-")
338
+ }
339
+ } # define namecheck
340
+
@@ -0,0 +1,69 @@
1
+ class ssh::eal4 {
2
+
3
+ # Cripto settings
4
+ ssh::config { Protocol:
5
+ value => "2",
6
+ }
7
+
8
+ ssh::config { Ciphers:
9
+ value => "3des-cbc",
10
+ }
11
+
12
+ # X11 forwarding (You MAY allow)
13
+ ssh::config { X11Forwarding:
14
+ value => "no",
15
+ }
16
+
17
+
18
+ # Login settings
19
+ ssh::config { UsePAM:
20
+ value => "yes",
21
+ }
22
+
23
+ ssh::config { PermitRootLogin:
24
+ value => "no",
25
+ }
26
+
27
+ ssh::config { PermitEmptyPasswords:
28
+ value => "no",
29
+ }
30
+
31
+ ssh::config { PasswordAuthentication:
32
+ value => "no",
33
+ }
34
+
35
+ ssh::config { ChallengeResponseAuthentication:
36
+ value => "yes",
37
+ }
38
+
39
+ # Disables other authentication methods (you MAY want to change some of these settings)
40
+
41
+ ssh::config { IgnoreRhosts:
42
+ value => "yes",
43
+ }
44
+
45
+ ssh::config { HostbasedAuthentication:
46
+ value => "no",
47
+ }
48
+
49
+ ssh::config { PubkeyAuthentication:
50
+ value => "no",
51
+ }
52
+
53
+ ssh::config { RhostsRSAAuthentication:
54
+ value => "no",
55
+ }
56
+
57
+ ssh::config { RSAAuthentication:
58
+ value => "no",
59
+ }
60
+
61
+ ssh::config { KerberosAuthentication:
62
+ value => "no",
63
+ }
64
+
65
+ ssh::config { GSSAPIAuthentication:
66
+ value => "no",
67
+ }
68
+
69
+ }