]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nominatim/recipes/default.rb
nominatim: add read timeout to apache
[chef.git] / cookbooks / nominatim / recipes / default.rb
index b7954af92eedeb6b7fa35910843bd290835b7b21..a8009759ff3dba77926ab82870173bf54b2d8b5e 100644 (file)
@@ -293,7 +293,7 @@ file "#{build_directory}/settings/ip_blocks.map" do
   mode 0o664
 end
 
-include_recipe "apache::ssl"
+include_recipe "apache"
 
 package "php"
 package "php-fpm"
@@ -306,28 +306,21 @@ apache_module "proxy"
 apache_module "proxy_fcgi"
 apache_module "proxy_http"
 apache_module "headers"
+apache_module "reqtimeout"
 
-service "php5-fpm" do
-  if node[:lsb][:release].to_f >= 15.10
-    provider Chef::Provider::Service::Systemd
-    service_name "php7.0-fpm"
-  elsif node[:lsb][:release].to_f >= 14.04
-    provider Chef::Provider::Service::Upstart
-  end
+service "php7.0-fpm" do
   action [:enable, :start]
   supports :status => true, :restart => true, :reload => true
 end
 
-php_confdir = node[:lsb][:release].to_f >= 15.10 ? "/etc/php/7.0" : "/etc/php5"
-
 node[:nominatim][:fpm_pools].each do |name, data|
-  template "#{php_confdir}/fpm/pool.d/#{name}.conf" do
+  template "/etc/php/7.0/fpm/pool.d/#{name}.conf" do
     source "fpm.conf.erb"
     owner "root"
     group "root"
     mode 0o644
     variables data.merge(:name => name)
-    notifies :reload, "service[php5-fpm]"
+    notifies :reload, "service[php7.0-fpm]"
   end
 end
 
@@ -338,7 +331,6 @@ ssl_certificate "nominatim.openstreetmap.org" do
            "nominatim.openstreetmap.net",
            "nominatim.openstreetmaps.org",
            "nominatim.openmaps.org"]
-  fallback_certificate "openstreetmap"
   notifies :reload, "service[apache2]"
 end
 
@@ -361,8 +353,12 @@ end
 
 include_recipe "fail2ban"
 
+web_servers = search(:node, "recipes:web\\:\\:frontend").collect do |n| # ~FC010
+  n.ipaddresses(:role => :external)
+end.flatten
+
 fail2ban_filter "nominatim" do
-  failregex '^<HOST> - - \[\] "[^"]+" 429 '
+  failregex '^<HOST> - - \[\] "[^"]+" (408|429) '
 end
 
 fail2ban_jail "nominatim" do
@@ -370,6 +366,7 @@ fail2ban_jail "nominatim" do
   logpath "/var/log/apache2/nominatim.openstreetmap.org-access.log"
   ports [80, 443]
   maxretry 100
+  ignoreips web_servers
 end
 
 munin_plugin_conf "nominatim" do