from-scratch 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -1
  3. data/Berksfile.lock +20 -1
  4. data/cookbooks/bluepill/CHANGELOG.md +93 -0
  5. data/cookbooks/bluepill/README.md +91 -0
  6. data/cookbooks/bluepill/attributes/default.rb +44 -0
  7. data/cookbooks/bluepill/metadata.json +1 -0
  8. data/cookbooks/bluepill/providers/service.rb +172 -0
  9. data/cookbooks/bluepill/recipes/default.rb +48 -0
  10. data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
  11. data/cookbooks/bluepill/resources/service.rb +27 -0
  12. data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
  13. data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
  14. data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
  15. data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
  16. data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
  17. data/cookbooks/nginx/CHANGELOG.md +435 -0
  18. data/cookbooks/nginx/README.md +521 -0
  19. data/cookbooks/nginx/attributes/auth_request.rb +23 -0
  20. data/cookbooks/nginx/attributes/default.rb +131 -0
  21. data/cookbooks/nginx/attributes/devel.rb +24 -0
  22. data/cookbooks/nginx/attributes/echo.rb +24 -0
  23. data/cookbooks/nginx/attributes/geoip.rb +31 -0
  24. data/cookbooks/nginx/attributes/headers_more.rb +24 -0
  25. data/cookbooks/nginx/attributes/lua.rb +28 -0
  26. data/cookbooks/nginx/attributes/naxsi.rb +24 -0
  27. data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
  28. data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
  29. data/cookbooks/nginx/attributes/passenger.rb +58 -0
  30. data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
  31. data/cookbooks/nginx/attributes/repo.rb +35 -0
  32. data/cookbooks/nginx/attributes/set_misc.rb +8 -0
  33. data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
  34. data/cookbooks/nginx/attributes/source.rb +42 -0
  35. data/cookbooks/nginx/attributes/status.rb +22 -0
  36. data/cookbooks/nginx/attributes/syslog.rb +24 -0
  37. data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
  38. data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
  39. data/cookbooks/nginx/files/default/mime.types +78 -0
  40. data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  41. data/cookbooks/nginx/libraries/matchers.rb +20 -0
  42. data/cookbooks/nginx/metadata.json +351 -0
  43. data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
  44. data/cookbooks/nginx/recipes/commons.rb +24 -0
  45. data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
  46. data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
  47. data/cookbooks/nginx/recipes/commons_script.rb +29 -0
  48. data/cookbooks/nginx/recipes/default.rb +31 -0
  49. data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
  50. data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
  51. data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  52. data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
  53. data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
  54. data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
  55. data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
  56. data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
  57. data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
  58. data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  59. data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  60. data/cookbooks/nginx/recipes/ipv6.rb +23 -0
  61. data/cookbooks/nginx/recipes/lua.rb +47 -0
  62. data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
  63. data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
  64. data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
  65. data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
  66. data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
  67. data/cookbooks/nginx/recipes/package.rb +52 -0
  68. data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
  69. data/cookbooks/nginx/recipes/passenger.rb +56 -0
  70. data/cookbooks/nginx/recipes/repo.rb +41 -0
  71. data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
  72. data/cookbooks/nginx/recipes/set_misc.rb +30 -0
  73. data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
  74. data/cookbooks/nginx/recipes/source.rb +205 -0
  75. data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
  76. data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
  77. data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  78. data/cookbooks/nginx/templates/default/default-site.erb +11 -0
  79. data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  80. data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  81. data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
  82. data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
  83. data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  84. data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
  85. data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
  86. data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
  87. data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
  88. data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
  89. data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  90. data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  91. data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  92. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  93. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  94. data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  95. data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  96. data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
  97. data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  98. data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
  99. data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  100. data/cookbooks/ohai/CHANGELOG.md +69 -0
  101. data/cookbooks/ohai/README.md +89 -0
  102. data/cookbooks/ohai/attributes/default.rb +31 -0
  103. data/cookbooks/ohai/files/default/plugins/README +1 -0
  104. data/cookbooks/ohai/libraries/matchers.rb +14 -0
  105. data/cookbooks/ohai/metadata.json +1 -0
  106. data/cookbooks/ohai/providers/hint.rb +38 -0
  107. data/cookbooks/ohai/recipes/default.rb +52 -0
  108. data/cookbooks/ohai/resources/hint.rb +5 -0
  109. data/cookbooks/packagecloud/CHANGELOG.md +12 -0
  110. data/cookbooks/packagecloud/README.md +80 -0
  111. data/cookbooks/packagecloud/attributes/default.rb +8 -0
  112. data/cookbooks/packagecloud/libraries/helper.rb +43 -0
  113. data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
  114. data/cookbooks/packagecloud/metadata.json +1 -0
  115. data/cookbooks/packagecloud/providers/repo.rb +212 -0
  116. data/cookbooks/packagecloud/resources/repo.rb +10 -0
  117. data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
  118. data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
  119. data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
  120. data/cookbooks/rsyslog/CHANGELOG.md +193 -0
  121. data/cookbooks/rsyslog/README.md +276 -0
  122. data/cookbooks/rsyslog/attributes/default.rb +131 -0
  123. data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
  124. data/cookbooks/rsyslog/metadata.json +1 -0
  125. data/cookbooks/rsyslog/providers/file_input.rb +44 -0
  126. data/cookbooks/rsyslog/recipes/client.rb +87 -0
  127. data/cookbooks/rsyslog/recipes/default.rb +89 -0
  128. data/cookbooks/rsyslog/recipes/server.rb +44 -0
  129. data/cookbooks/rsyslog/resources/file_input.rb +28 -0
  130. data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
  131. data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
  132. data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
  133. data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
  134. data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
  135. data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
  136. data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
  137. data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
  138. data/cookbooks/runit/.kitchen.cloud.yml +103 -0
  139. data/cookbooks/runit/.kitchen.yml +38 -0
  140. data/cookbooks/runit/.rspec +3 -0
  141. data/cookbooks/runit/.rubocop.yml +45 -0
  142. data/cookbooks/runit/Berksfile.disabled +11 -0
  143. data/cookbooks/runit/CHANGELOG.md +226 -0
  144. data/cookbooks/runit/CONTRIBUTING.md +266 -0
  145. data/cookbooks/runit/Cheffile +11 -0
  146. data/cookbooks/runit/Gemfile +17 -0
  147. data/cookbooks/runit/LICENSE +201 -0
  148. data/cookbooks/runit/README.md +435 -0
  149. data/cookbooks/runit/Rakefile +23 -0
  150. data/cookbooks/runit/TESTING.md +26 -0
  151. data/cookbooks/runit/attributes/default.rb +62 -0
  152. data/cookbooks/runit/files/default/runit.seed +1 -0
  153. data/cookbooks/runit/files/default/runsvdir +0 -0
  154. data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  155. data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  156. data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  157. data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  158. data/cookbooks/runit/libraries/default.rb +0 -0
  159. data/cookbooks/runit/libraries/helpers.rb +190 -0
  160. data/cookbooks/runit/libraries/matchers.rb +69 -0
  161. data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
  162. data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
  163. data/cookbooks/runit/metadata.json +50 -0
  164. data/cookbooks/runit/recipes/default.rb +91 -0
  165. data/cookbooks/runit/templates/debian/init.d.erb +66 -0
  166. data/cookbooks/runit/templates/default/log-config.erb +24 -0
  167. data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  168. data/cookbooks/scratchify/Berksfile +2 -1
  169. data/cookbooks/scratchify/Berksfile.lock +20 -1
  170. data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
  171. data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
  172. data/cookbooks/scratchify/metadata.json +5 -2
  173. data/cookbooks/scratchify/recipes/default.rb +15 -1
  174. data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
  175. data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
  176. data/cookbooks/scratchify/templates/nginx.erb +31 -0
  177. data/cookbooks/scratchify/templates/node.json.erb +21 -6
  178. data/cookbooks/yum-epel/CHANGELOG.md +84 -0
  179. data/cookbooks/yum-epel/README.md +172 -0
  180. data/cookbooks/yum-epel/attributes/default.rb +1 -0
  181. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
  182. data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
  183. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
  184. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
  185. data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
  186. data/cookbooks/yum-epel/attributes/epel.rb +28 -0
  187. data/cookbooks/yum-epel/metadata.json +1 -0
  188. data/cookbooks/yum-epel/recipes/default.rb +61 -0
  189. data/cookbooks/yum/CHANGELOG.md +294 -0
  190. data/cookbooks/yum/README.md +285 -0
  191. data/cookbooks/yum/attributes/main.rb +100 -0
  192. data/cookbooks/yum/libraries/matchers.rb +27 -0
  193. data/cookbooks/yum/metadata.json +1 -0
  194. data/cookbooks/yum/providers/globalconfig.rb +41 -0
  195. data/cookbooks/yum/providers/repository.rb +106 -0
  196. data/cookbooks/yum/recipes/default.rb +26 -0
  197. data/cookbooks/yum/resources/globalconfig.rb +109 -0
  198. data/cookbooks/yum/resources/repository.rb +69 -0
  199. data/cookbooks/yum/templates/default/main.erb +276 -0
  200. data/cookbooks/yum/templates/default/repo.erb +125 -0
  201. data/lib/from-scratch.rb +1 -0
  202. data/lib/from-scratch/version.rb +1 -1
  203. data/metadata.rb +5 -1
  204. data/recipes/default.rb +15 -1
  205. data/recipes/nginx_site.rb +4 -0
  206. data/recipes/pre_rvm.rb +5 -0
  207. data/templates/nginx.erb +31 -0
  208. data/templates/node.json.erb +21 -6
  209. metadata +194 -1
@@ -0,0 +1,87 @@
1
+ #
2
+ # Cookbook Name:: rsyslog
3
+ # Recipe:: client
4
+ #
5
+ # Copyright 2009-2015, Chef Software, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ # Do not run this recipe if the server attribute is set
21
+ return if node['rsyslog']['server']
22
+
23
+ include_recipe 'rsyslog::default'
24
+
25
+ def chef_solo_search_installed?
26
+ klass = ::Search.const_get('Helper')
27
+ return klass.is_a?(Class)
28
+ rescue NameError
29
+ return false
30
+ end
31
+
32
+ # On Chef Solo, we use the node['rsyslog']['server_ip'] attribute, and on
33
+ # normal Chef, we leverage the search query.
34
+ if Chef::Config[:solo] && !chef_solo_search_installed?
35
+ if node['rsyslog']['server_ip']
36
+ server_ips = Array(node['rsyslog']['server_ip'])
37
+ else
38
+ Chef::Application.fatal!("Chef Solo does not support search. You must set node['rsyslog']['server_ip'] or use the chef-solo-search cookbook!")
39
+ end
40
+ else
41
+ results = search(:node, node['rsyslog']['server_search']).map do |server|
42
+ ipaddress = server['ipaddress']
43
+ # If both server and client are on the same cloud and local network, they may be
44
+ # instructed to communicate via the internal interface by enabling `use_local_ipv4`
45
+ if node['rsyslog']['use_local_ipv4'] && server.attribute?('cloud') && server['cloud']['local_ipv4']
46
+ ipaddress = server['cloud']['local_ipv4']
47
+ end
48
+ ipaddress
49
+ end
50
+ server_ips = Array(node['rsyslog']['server_ip']) + Array(results)
51
+ end
52
+
53
+ rsyslog_servers = []
54
+
55
+ server_ips.each do |ip|
56
+ rsyslog_servers << { 'server' => ip, 'port' => node['rsyslog']['port'], 'logs' => node['rsyslog']['logs_to_forward'], 'protocol' => node['rsyslog']['protocol'], 'remote_template' => node['rsyslog']['default_remote_template'] }
57
+ end
58
+
59
+ unless node['rsyslog']['custom_remote'].first.empty?
60
+ node['rsyslog']['custom_remote'].each do |server|
61
+ if server['server'].nil?
62
+ Chef::Application.fatal!('Found a custom_remote server with no IP. Check your custom_remote attribute definition!')
63
+ end
64
+ end
65
+ rsyslog_servers += node['rsyslog']['custom_remote']
66
+ end
67
+
68
+ if rsyslog_servers.empty?
69
+ Chef::Application.fatal!('The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search!')
70
+ end
71
+
72
+ remote_type = node['rsyslog']['use_relp'] ? 'relp' : 'remote'
73
+
74
+ template "#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf" do
75
+ source "49-#{remote_type}.conf.erb"
76
+ owner 'root'
77
+ group 'root'
78
+ mode '0644'
79
+ variables(servers: rsyslog_servers)
80
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
81
+ only_if { node['rsyslog']['remote_logs'] }
82
+ end
83
+
84
+ file "#{node['rsyslog']['config_prefix']}/rsyslog.d/server.conf" do
85
+ action :delete
86
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
87
+ end
@@ -0,0 +1,89 @@
1
+ #
2
+ # Cookbook Name:: rsyslog
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2009-2015, Chef Software, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ extend RsyslogCookbook::Helpers
21
+
22
+ package 'rsyslog'
23
+ package 'rsyslog-relp' if node['rsyslog']['use_relp']
24
+
25
+ if node['rsyslog']['enable_tls'] && node['rsyslog']['tls_ca_file']
26
+ Chef::Application.fatal!("Recipe rsyslog::default can not use 'enable_tls' with protocol '#{node['rsyslog']['protocol']}' (requires 'tcp')") unless node['rsyslog']['protocol'] == 'tcp'
27
+ package 'rsyslog-gnutls'
28
+ end
29
+
30
+ directory "#{node['rsyslog']['config_prefix']}/rsyslog.d" do
31
+ owner 'root'
32
+ group 'root'
33
+ mode '0755'
34
+ end
35
+
36
+ directory node['rsyslog']['working_dir'] do
37
+ owner node['rsyslog']['user']
38
+ group node['rsyslog']['group']
39
+ mode '0700'
40
+ end
41
+
42
+ # Our main stub which then does its own rsyslog-specific
43
+ # include of things in /etc/rsyslog.d/*
44
+ template "#{node['rsyslog']['config_prefix']}/rsyslog.conf" do
45
+ source 'rsyslog.conf.erb'
46
+ owner 'root'
47
+ group 'root'
48
+ mode '0644'
49
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
50
+ end
51
+
52
+ template "#{node['rsyslog']['config_prefix']}/rsyslog.d/50-default.conf" do
53
+ source '50-default.conf.erb'
54
+ owner 'root'
55
+ group 'root'
56
+ mode '0644'
57
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
58
+ end
59
+
60
+ # syslog needs to be stopped before rsyslog can be started on RHEL versions before 6.0
61
+ if platform_family?('rhel') && node['platform_version'].to_i < 6
62
+ service 'syslog' do
63
+ action [:stop, :disable]
64
+ end
65
+ elsif platform_family?('smartos', 'omnios')
66
+ # syslog needs to be stopped before rsyslog can be started on SmartOS, OmniOS
67
+ service 'system-log' do
68
+ action :disable
69
+ end
70
+ end
71
+
72
+ if platform_family?('omnios')
73
+ # manage the SMF manifest on OmniOS
74
+ template '/var/svc/manifest/system/rsyslogd.xml' do
75
+ source 'omnios-manifest.xml.erb'
76
+ owner 'root'
77
+ group 'root'
78
+ mode '0644'
79
+ notifies :run, 'execute[import rsyslog manifest]', :immediately
80
+ end
81
+
82
+ execute 'import rsyslog manifest' do
83
+ action :nothing
84
+ command 'svccfg import /var/svc/manifest/system/rsyslogd.xml'
85
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
86
+ end
87
+ end
88
+
89
+ declare_rsyslog_service
@@ -0,0 +1,44 @@
1
+ #
2
+ # Cookbook Name:: rsyslog
3
+ # Recipe:: server
4
+ #
5
+ # Copyright 2009-2015, Chef Software, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ # Manually set this attribute
21
+ node.set['rsyslog']['server'] = true
22
+
23
+ include_recipe 'rsyslog::default'
24
+
25
+ directory node['rsyslog']['log_dir'] do
26
+ owner node['rsyslog']['user']
27
+ group node['rsyslog']['group']
28
+ mode '0755'
29
+ recursive true
30
+ end
31
+
32
+ template "#{node['rsyslog']['config_prefix']}/rsyslog.d/35-server-per-host.conf" do
33
+ source '35-server-per-host.conf.erb'
34
+ owner 'root'
35
+ group 'root'
36
+ mode '0644'
37
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
38
+ end
39
+
40
+ file "#{node['rsyslog']['config_prefix']}/rsyslog.d/remote.conf" do
41
+ action :delete
42
+ notifies :restart, "service[#{node['rsyslog']['service_name']}]"
43
+ only_if { ::File.exist?("#{node['rsyslog']['config_prefix']}/rsyslog.d/remote.conf") }
44
+ end
@@ -0,0 +1,28 @@
1
+ # Cookbook Name:: rsyslog
2
+ # Resource:: file_input
3
+ #
4
+ # Copyright 2012-2015, Joseph Holsten
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ actions :create
20
+ default_action :create
21
+
22
+ attribute :name, kind_of: String, name_attribute: true, required: true
23
+ attribute :file, kind_of: String, required: true
24
+ attribute :priority, kind_of: Integer, default: 99
25
+ attribute :severity, kind_of: String
26
+ attribute :facility, kind_of: String
27
+ attribute :cookbook, kind_of: String, default: 'rsyslog'
28
+ attribute :source, kind_of: String, default: 'file-input.conf.erb'
@@ -0,0 +1,62 @@
1
+ # Generated by Chef
2
+ # Local modifications will be overwritten
3
+
4
+ <% if node['rsyslog']['use_relp'] -%>
5
+ $ModLoad imrelp
6
+ $InputRELPServerRun <%= node['rsyslog']['relp_port'] %>
7
+ <% end -%>
8
+ $DirGroup <%= node['rsyslog']['group'] %>
9
+ $DirCreateMode 0755
10
+ $FileGroup <%= node['rsyslog']['group'] %>
11
+
12
+ $template PerHostAuth,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/auth.log"
13
+ $template PerHostCron,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/cron.log"
14
+ $template PerHostSyslog,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/syslog"
15
+ $template PerHostDaemon,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/daemon.log"
16
+ $template PerHostKern,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/kern.log"
17
+ $template PerHostLpr,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/lpr.log"
18
+ $template PerHostUser,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/user.log"
19
+ $template PerHostMail,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/mail.log"
20
+ $template PerHostMailInfo,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/mail.info"
21
+ $template PerHostMailWarn,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/mail.warn"
22
+ $template PerHostMailErr,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/mail.err"
23
+ $template PerHostNewsCrit,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/news.crit"
24
+ $template PerHostNewsErr,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/news.err"
25
+ $template PerHostNewsNotice,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/news.notice"
26
+ $template PerHostDebug,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/debug"
27
+ $template PerHostMessages,"<%= node['rsyslog']['log_dir'] %>/<%= node['rsyslog']['per_host_dir'] %>/messages"
28
+
29
+ auth,authpriv.* ?PerHostAuth
30
+ *.*;auth,authpriv.none -?PerHostSyslog
31
+ cron.* ?PerHostCron
32
+ daemon.* -?PerHostDaemon
33
+ kern.* -?PerHostKern
34
+ lpr.* -?PerHostLpr
35
+ mail.* -?PerHostMail
36
+ user.* -?PerHostUser
37
+
38
+ mail.info -?PerHostMailInfo
39
+ mail.warn ?PerHostMailWarn
40
+ mail.err ?PerHostMailErr
41
+
42
+ news.crit ?PerHostNewsCrit
43
+ news.err ?PerHostNewsErr
44
+ news.notice -?PerHostNewsNotice
45
+
46
+ *.=debug;\
47
+ auth,authpriv.none;\
48
+ news.none;mail.none -?PerHostDebug
49
+
50
+ *.=info;*.=notice;*.=warn;\
51
+ auth,authpriv.none;\
52
+ cron,daemon.none;\
53
+ mail,news.none -?PerHostMessages
54
+
55
+
56
+ <% unless node['rsyslog']['allow_non_local'] -%>
57
+ #
58
+ # Stop processing of all non-local messages. You can process remote messages
59
+ # on levels less than 35.
60
+ #
61
+ :fromhost-ip,!isequal,"127.0.0.1" ~
62
+ <% end -%>
@@ -0,0 +1,10 @@
1
+ # Generated by Chef
2
+ $ModLoad omrelp
3
+ $ActionQueueType LinkedList # use asynchronous processing
4
+ $ActionQueueFileName srvrfwd # set file name, also enables disk mode
5
+ $ActionResumeRetryCount -1 # infinite retries on insert failure
6
+ $ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
7
+
8
+ <% @servers.each do |server| -%>
9
+ <%= node['rsyslog']['logs_to_forward'] %> :omrelp:<%= "#{server}:#{node['rsyslog']['relp_port']}" %><%= node['rsyslog']['default_remote_template'] ? ';' + node['rsyslog']['default_remote_template'] : nil %>
10
+ <% end -%>
@@ -0,0 +1,30 @@
1
+ # Generated by Chef
2
+ $ActionQueueType LinkedList # use asynchronous processing
3
+ $ActionQueueFileName srvrfwd # set file name, also enables disk mode
4
+ $ActionResumeRetryCount -1 # infinite retries on insert failure
5
+ $ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
6
+ $ActionQueueMaxDiskSpace <%= node['rsyslog']['action_queue_max_disk_space'] %> # Don't use more than this much space for the queue
7
+ <% if node['rsyslog']['enable_tls'] && node['rsyslog']['tls_ca_file'] -%>
8
+ $DefaultNetstreamDriverCAFile <%= node['rsyslog']['tls_ca_file'] %>
9
+ <% if node['rsyslog']['tls_certificate_file'] -%>
10
+ $DefaultNetstreamDriverCertFile <%= node['rsyslog']['tls_certificate_file'] %>
11
+ <% end -%>
12
+ <% if node['rsyslog']['tls_key_file'] -%>
13
+ $DefaultNetstreamDriverKeyFile <%= node['rsyslog']['tls_key_file'] %>
14
+ <% end -%>
15
+
16
+ $DefaultNetstreamDriver gtls
17
+ $ActionSendStreamDriverMode 1
18
+ $ActionSendStreamDriverAuthMode <%= node['rsyslog']['tls_auth_mode'] %>
19
+ <% end -%>
20
+
21
+ <% @servers.each do |server| -%>
22
+ <% case server['protocol'] -%>
23
+ <% when "tcp" -%>
24
+ <%= server['logs'] ? server['logs'] : node['rsyslog']['logs_to_forward'] %> @@<%= server['server'] %>:<%= server['port'] ? server['port'] : node['rsyslog']['port'] %><%= server['remote_template'] ? ';' + server['remote_template'] : nil %>
25
+ <% when "udp" -%>
26
+ <%= server['logs'] ? server['logs'] : node['rsyslog']['logs_to_forward'] %> @<%= server['server'] %>:<%= server['port'] ? server['port'] : node['rsyslog']['port'] %><%= server['remote_template'] ? ';' + server['remote_template'] : nil %>
27
+ <% else -%>
28
+ <%= server['logs'] ? server['logs'] : node['rsyslog']['logs_to_forward'] %><%= node['rsyslog']['protocol'] == "tcp" ? " @@" : " @" %><%= server['server'] %>:<%= server['port'] ? server['port'] : node['rsyslog']['port'] %><%= server['remote_template'] ? ';' + server['remote_template'] : nil %>
29
+ <% end -%>
30
+ <% end -%>
@@ -0,0 +1,6 @@
1
+ # Generated by Chef
2
+ # For more information see rsyslog.conf(5) and /etc/rsyslog.conf
3
+
4
+ <% node['rsyslog']['default_facility_logs'].each do |key, value| %>
5
+ <%= key %> <%= value %>
6
+ <% end %>
@@ -0,0 +1,15 @@
1
+ # <%= @tag %>.conf - Syslog file inputs for <%= @tag %>
2
+ #
3
+ # Generated by Chef for <%= node['fqdn'] %>
4
+ # Local modifications will be overwritten.
5
+ $ModLoad imfile
6
+ $InputFileName <%= @file_name %>
7
+ $InputFileTag <%= @tag %>:
8
+ $InputFileStateFile <%= @state_file %>
9
+ <% if @severity %>
10
+ $InputFileSeverity <%= @severity %>
11
+ <% end %>
12
+ <% if @facility %>
13
+ $InputFileFacility <%= @facility %>
14
+ <% end %>
15
+ $InputRunFileMonitor
@@ -0,0 +1,30 @@
1
+ <?xml version='1.0'?>
2
+ <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
3
+ <service_bundle type='manifest' name='export'>
4
+ <service name='<%= node['rsyslog']['service_name'] %>' type='service' version='0'>
5
+ <create_default_instance enabled='true'/>
6
+ <single_instance/>
7
+ <dependency name='network' grouping='require_all' restart_on='error' type='service'>
8
+ <service_fmri value='svc:/milestone/network:default'/>
9
+ </dependency>
10
+ <dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
11
+ <service_fmri value='svc:/system/filesystem/local'/>
12
+ </dependency>
13
+ <method_context/>
14
+ <exec_method name='start' type='method' exec='/opt/omni/sbin/rsyslogd -f %{config_file}' timeout_seconds='60'/>
15
+ <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
16
+ <property_group name='startd' type='framework'>
17
+ <propval name='duration' type='astring' value='contract'/>
18
+ <propval name='ignore_error' type='astring' value='core,signal'/>
19
+ </property_group>
20
+ <property_group name='application' type='application'>
21
+ <propval name='config_file' type='astring' value='<%= node["rsyslog"]["config_prefix"] %>/rsyslog.conf'/>
22
+ </property_group>
23
+ <stability value='Evolving'/>
24
+ <template>
25
+ <common_name>
26
+ <loctext xml:lang='C'>rsyslog daemon</loctext>
27
+ </common_name>
28
+ </template>
29
+ </service>
30
+ </service_bundle>
@@ -0,0 +1,117 @@
1
+ # Config generated by Chef - manual edits will be overwritten
2
+ #
3
+ # /etc/rsyslog.conf Configuration file for rsyslog.
4
+ #
5
+ # For more information see
6
+ # /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
7
+ #
8
+ # Default logging rules can be found in /etc/rsyslog.d/50-default.conf
9
+ #
10
+ # Set max message size
11
+ #
12
+ $MaxMessageSize <%= node['rsyslog']['max_message_size'] %>
13
+
14
+ #
15
+ # Preserve FQDN
16
+ #
17
+ $PreserveFQDN <%= node['rsyslog']['preserve_fqdn'] %>
18
+
19
+ #################
20
+ #### MODULES ####
21
+ #################
22
+
23
+ <% if node['rsyslog']['modules'] && !node['rsyslog']['modules'].empty? %>
24
+ <% [*node['rsyslog']['modules']].each do |mod| %>
25
+ $ModLoad <%= mod %>
26
+ <% end %>
27
+ <% end %>
28
+
29
+ <% if node['rsyslog']['server'] -%>
30
+ <% if node['rsyslog']['enable_tls'] && node['rsyslog']['tls_ca_file'] &&
31
+ node['rsyslog']['tls_key_file'] && node['rsyslog']['tls_certificate_file'] -%>
32
+ $DefaultNetstreamDriver gtls
33
+ $DefaultNetstreamDriverCAFile <%= node['rsyslog']['tls_ca_file'] %>
34
+ $DefaultNetstreamDriverCertFile <%= node['rsyslog']['tls_certificate_file'] %>
35
+ $DefaultNetstreamDriverKeyFile <%= node['rsyslog']['tls_key_file'] %>
36
+
37
+ $ModLoad imtcp
38
+
39
+ $InputTCPServerStreamDriverMode 1 # run driver in TLS-only mode
40
+ $InputTCPServerStreamDriverAuthMode <%= node['rsyslog']['tls_auth_mode'] || 'anon' %>
41
+ $InputTCPServerRun <%= node['rsyslog']['port'] %>
42
+ # Provide <%= node['rsyslog']['protocol'].upcase %> log reception
43
+ <% else -%>
44
+ <% if node['rsyslog']['protocol'] =~ /tcp/ %>
45
+ $ModLoad imtcp
46
+ $InputTCPServerRun <%= node['rsyslog']['port'] %>
47
+ <% end -%>
48
+ <% if node['rsyslog']['protocol'] =~ /udp/ %>
49
+ $ModLoad imudp
50
+ $UDPServerAddress <%= node['rsyslog']['bind'] %>
51
+ $UDPServerRun <%= node['rsyslog']['port'] %>
52
+ <% end -%>
53
+ <% end -%>
54
+ <% end -%>
55
+
56
+ ###########################
57
+ #### GLOBAL DIRECTIVES ####
58
+ ###########################
59
+
60
+ <% if node["rsyslog"]["default_file_template"] -%>
61
+ #
62
+ # Default log format template
63
+ #
64
+ $ActionFileDefaultTemplate <%= node["rsyslog"]["default_file_template"] %>
65
+ <% elsif !node["rsyslog"]["high_precision_timestamps"] -%>
66
+ #
67
+ # Use traditional timestamp format.
68
+ # To enable high precision timestamps, comment out the following line.
69
+ #
70
+ $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
71
+ <% end -%>
72
+
73
+ # Filter duplicated messages
74
+ $RepeatedMsgReduction <%= node['rsyslog']['repeated_msg_reduction'] %>
75
+
76
+ #
77
+ # Set temporary directory to buffer syslog queue
78
+ #
79
+ $WorkDirectory <%= node['rsyslog']['working_dir'] %>
80
+
81
+ #
82
+ # Set the default permissions for all log files.
83
+ #
84
+ $FileOwner <%= node['rsyslog']['user'] %>
85
+ $FileGroup <%= node['rsyslog']['group'] %>
86
+ $FileCreateMode 0640
87
+ $DirCreateMode 0755
88
+ $Umask 0022
89
+ <% if node['rsyslog']['priv_seperation'] %>
90
+ $PrivDropToUser <%= node['rsyslog']['priv_user'] || node['rsyslog']['user'] %>
91
+ $PrivDropToGroup <%= node['rsyslog']['priv_group'] || node['rsyslog']['group'] %>
92
+ <% end %>
93
+ <% unless node['rsyslog']['rate_limit_interval'].nil? %>
94
+ #
95
+ # Set the amount of time that is being measured for rate limiting
96
+ #
97
+ $SystemLogRateLimitInterval <%= node['rsyslog']['rate_limit_interval'] %>
98
+ <% end %>
99
+ <% unless node['rsyslog']['rate_limit_burst'].nil? %>
100
+ #
101
+ # Set the amount of messages, that have to occur in the time limit of
102
+ # SystemLogRateLimitInterval, to trigger rate limiting
103
+ #
104
+ $SystemLogRateLimitBurst <%= node['rsyslog']['rate_limit_burst'] %>
105
+ <% end %>
106
+
107
+ #
108
+ # Set other directives
109
+ #
110
+ <% node['rsyslog']['additional_directives'].each_pair do |k,v| %>
111
+ $<%= k %> <%= v %>
112
+ <% end %>
113
+
114
+ #
115
+ # Include all config files in <%= node['rsyslog']['config_prefix'] %>/rsyslog.d/
116
+ #
117
+ $IncludeConfig <%= node['rsyslog']['config_prefix'] %>/rsyslog.d/*.conf