Skip to content

Commit d0351f6

Browse files
jaymzhfacebook-github-bot
authored andcommitted
fb_apache: allow user to not enable public status (facebook#262)
Summary: Public status is usually not desired and can be a security risk. Allow the user to opt-out and setup status however they want. Signed-off-by: Phil Dibowitz <phil@ipom.com> Pull Request resolved: facebook#262 Differential Revision: D69672310 fbshipit-source-id: 189067fca7159f66c270eda80c19cdbcd81bade0
1 parent 106c341 commit d0351f6

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

cookbooks/fb_apache/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@ Requirements
77

88
Attributes
99
----------
10+
* node['fb_apache']['enable_default_site']
11+
* node['fb_apache']['enable_public_status']
12+
* node['fb_apache']['extra_configs']
1013
* node['fb_apache']['manage_packages']
1114
* node['fb_apache']['manage_service']
12-
* node['fb_apache']['sites'][$SITE][$CONFIG]
13-
* node['fb_apache']['sysconfig'][$KEY]
14-
* node['fb_apache']['sysconfig']['_extra_lines']
15+
* node['fb_apache']['module_packages']
1516
* node['fb_apache']['modules']
1617
* node['fb_apache']['modules_directory']
1718
* node['fb_apache']['modules_mapping']
18-
* node['fb_apache']['module_packages']
19-
* node['fb_apache']['enable_default_site']
20-
* node['fb_apache']['extra_configs']
2119
* node['fb_apache']['mpm']
20+
* node['fb_apache']['sites'][$SITE][$CONFIG]
21+
* node['fb_apache']['sysconfig'][$KEY]
22+
* node['fb_apache']['sysconfig']['_extra_lines']
2223

2324
Usage
2425
-----
@@ -219,6 +220,11 @@ and we've pre-populated all the common modules on both distro variants.
219220
Finally, `node['fb_apache']['modules_directory']` is set to the proper module
220221
directory for your distro, but you may override it if you'd like.
221222

223+
### Global status
224+
By default this cookbook will enable a mod_status handler available publically
225+
at /server-status. You can disable this with
226+
`node.default['fb_apache']['enable_public_status'] = false`.
227+
222228
### Extra Configs
223229
Everything in `node['fb_apache']['extra_configs']` will be converted from hash
224230
syntax to Apache Config syntax in the same 1:1 manner as the `sites` hash above

cookbooks/fb_apache/attributes/default.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787

8888
default['fb_apache'] = {
8989
'sysconfig' => sysconfig,
90+
'enable_public_status' => true,
9091
'manage_packages' => true,
9192
'manage_service' => true,
9293
'enable_default_site' => true,

cookbooks/fb_apache/recipes/default.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178

179179
# We want to collect apache stats
180180
template "#{confdir}/status.conf" do
181+
only_if { node['fb_apache']['enable_public_status'] }
181182
source 'status.erb'
182183
owner node.root_user
183184
group node.root_group
@@ -187,6 +188,13 @@
187188
notifies :restart, 'service[apache]'
188189
end
189190

191+
file "#{confdir}/status.conf" do
192+
not_if { node['fb_apache']['enable_public_status'] }
193+
action :delete
194+
notifies :verify, 'fb_apache_verify_configs[doit]', :before
195+
notifies :restart, 'service[apache]'
196+
end
197+
190198
moddirbase = ::File.basename(moddir)
191199
sitesdirbase = ::File.basename(sitesdir)
192200
confdirbase = ::File.basename(confdir)

0 commit comments

Comments
 (0)