X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/0df04eec2b48e47ba11c39a3a3e397ba1f7a0c92..53a51b1f4d048aa2e860ce99aeb27331afe7bd56:/cookbooks/tilecache/templates/default/squid.conf.erb?ds=sidebyside diff --git a/cookbooks/tilecache/templates/default/squid.conf.erb b/cookbooks/tilecache/templates/default/squid.conf.erb index 9f973a9d8..a575bcb0b 100644 --- a/cookbooks/tilecache/templates/default/squid.conf.erb +++ b/cookbooks/tilecache/templates/default/squid.conf.erb @@ -1,69 +1,7 @@ -acl osmtile_sites dstdomain a.tile.openstreetmap.org b.tile.openstreetmap.org c.tile.openstreetmap.org tile.openstreetmap.org a.tile.osm.org b.tile.osm.org c.tile.osm.org tile.osm.org +acl osmtile_thishost dstdomain <%= node.name %> +acl osmtile_sites dstdomain <%= node.name %> a.tile.openstreetmap.org b.tile.openstreetmap.org c.tile.openstreetmap.org tile.openstreetmap.org a.tile.osm.org b.tile.osm.org c.tile.osm.org tile.osm.org acl osmtiles_png urlpath_regex .png$ -acl osmtileScrapers browser ^$ -acl osmtileScrapers browser ^MOBAC -acl osmtileScrapers browser ^JTileDownloader -acl osmtileScrapers browser ^Apache\-HttpClient -acl osmtileScrapers browser ^Opera\/10\.00 -acl osmtileScrapers browser ^shipxy01 -#acl osmtileScrapers browser ^OsmAnd #Victor + Email. Whitelist for 1 week -#acl osmtileScrapers browser ^apemap #CGI143 + Email. Whitelist for 1 week -acl osmtileScrapers browser Firefox\/2\.0\.0\.11$ -#acl osmtileScrapers browser Firefox\/3\.5\.7$ #CGI285 + Email. Whitelist for 1 week -acl osmtileScrapers browser Firefox\/3\.6$ -acl osmtileScrapers browser ^Mozilla\/5\.0$ #QLandkarte unwilling to set a real user-agent. -acl osmtileScrapers browser ^Mozilla$ #Intentionally faked user-agent -acl osmtileScrapers browser ^User\-Agent -acl osmtileScrapers browser Firefox\/0\.8$ -acl osmtileScrapers browser Firefox\/1\.0$ -acl osmtileScrapers browser Firefox\/1\.0\.7$ -acl osmtileScrapers browser K\-Meleon\/1\.02$ -acl osmtileScrapers browser MSIE.7\.0.*Windows.NT.5\.1.*2\.0\.50727.$ -acl osmtileScrapers browser MSIE.5.5 -acl osmtileScrapers browser ^LoadOSM\.exe$ -acl osmtileScrapers browser ^app_name$ -# TEMPORARY unblock of osmdroid-based apps which should be setting their unique -# User-Agent, but aren't. Re-block on/near 2016-08-29. -#acl osmtileScrapers browser ^osmdroid$ # app using osmdroid library not setting app-specific User-Agent -#acl osmtileScrapers browser ^Mozilla/5\.0 \(Windows NT 5\.1\)$ # Faked User-Agent -acl osmtileScrapers browser Firefox\/3\.0 -acl osmtileScrapers browser Firefox\/4\.0 -acl osmtileScrapers browser Firefox\/5\.0 -acl osmtileScrapers browser Firefox\/6\.0 -acl osmtileScrapers browser Firefox\/7\.0 -acl osmtileScrapers browser Firefox\/8\.0 -acl osmtileScrapers browser Firefox\/9\.0 -acl osmtileScrapers browser Firefox\/10\.0 -acl osmtileScrapers browser Firefox\/11\.0 -acl osmtileScrapers browser Firefox\/12\.0 -acl osmtileScrapers browser Firefox\/13\.0 - -acl is_fake_browser browser Firefox\/3\.0 -acl is_fake_browser browser Firefox\/4\.0 -acl is_fake_browser browser Firefox\/5\.0 -acl is_fake_browser browser Firefox\/6\.0 -acl is_fake_browser browser Firefox\/7\.0 -acl is_fake_browser browser Firefox\/8\.0 -acl is_fake_browser browser Firefox\/9\.0 -acl is_fake_browser browser Firefox\/10\.0 -acl is_fake_browser browser Firefox\/11\.0 -acl is_fake_browser browser Firefox\/12\.0 -acl is_fake_browser browser Firefox\/13\.0 - -http_access deny osmtile_sites osmtileScrapers - -acl osmtileOverusers referer_regex ^https?://pmap\.kuku\.lu/ -acl osmtileOverusers referer_regex ^https?://[^.]*\.pmap\.kuku\.lu/ -acl osmtileOverusers referer_regex ^https?://fastpokemap\.com/ -acl osmtileOverusers referer_regex ^https?://[^.]*\.fastpokemap\.com/ - -http_access deny osmtile_sites osmtileOverusers - -# Delay pool when !has_referer and is_browser -acl has_referer referer_regex . -acl is_browser browser Mozilla - acl whitelist_path urlpath_regex ^/cgi-bin/(export|debug) acl blacklist_path urlpath_regex ^/cgi-bin/ acl blacklist_path urlpath_regex ^/MyAdmin/ @@ -91,78 +29,43 @@ http_access allow osmtile_sites requestMethodGet acl osmtile_nocache_url urlpath_regex \.png/(status|dirty)$ cache deny osmtile_sites osmtile_nocache_url -<% node[:tilecache][:tile_siblings].each do |sibling| -%> -cache_peer <%= sibling %> sibling 3128 3130 weight=1500 -<% end -%> -#Primary Parent -cache_peer <%= node[:tilecache][:tile_parent] %> parent 80 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 -cache_peer_access osmtileAccel allow osmtile_sites - -#Backup Parents -<% @renders.each do |renders| -%> -cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 80 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 -cache_peer_access osmtileAccelBackup<%= renders[:hostname] %> allow osmtile_sites -<% end -%> - -#---------------------------------- -#Create an unlimited pool for cache IP addresses -acl pool_unlimited src 127.0.0.1 <% @caches.each do |cache| -%> <% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%> -acl pool_unlimited src <%= address %> acl tile_caches src <%= address %> <% end -%> <% end -%> -#AOL External (London Hack Weekend) -acl pool_unlimited src 64.236.163.23 -#SoTM-US 2014 -acl pool_unlimited src 66.78.217.141 -#SoTM-US 2014 Hack Day Red Cross -acl pool_unlimited src 162.6.86.34 -acl pool_unlimited src 162.6.86.35 -acl pool_unlimited src 162.6.86.36 -#Telenav Whitelist - mvexel -acl pool_unlimited src 108.60.98.6 -#SoTM-EU 2014 -acl pool_unlimited src 185.52.244.32/29 -#Allow tile_caches ICP access -icp_access allow tile_caches - -<% (0..127).each do |i| -%> -acl pool_<%= sprintf("%03d", 2*i) %> src <%= 2*i %>.0.0.0/7 -<% end %> +# Primary Parent +<% if node[:squid][:version] < 4 -%> +cache_peer <%= node[:tilecache][:tile_parent] %> parent 443 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 ssl ssldomain=render.openstreetmap.org +<% elsif node[:lsb][:release].to_f < 20.04 -%> +cache_peer <%= node[:tilecache][:tile_parent] %> parent 443 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 tls tlsdomain=render.openstreetmap.org +<% else -%> +cache_peer <%= node[:tilecache][:tile_parent] %> parent 443 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 tls tlsdomain=render.openstreetmap.org tls-options=NORMAL:-VERS-TLS1.3 +<% end -%> +cache_peer_access osmtileAccel allow osmtile_sites -delay_pools 256 -delay_initial_bucket_level 25 +# Backup Parents +<% @renders.each do |renders| -%> +<% if node[:squid][:version] < 4 -%> +cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 443 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 ssl ssldomain=render.openstreetmap.org +<% elsif node[:lsb][:release].to_f < 20.04 -%> +cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 443 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 tls tlsdomain=render.openstreetmap.org +<% else -%> +cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 443 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 tls tlsdomain=render.openstreetmap.org tls-options=NORMAL:-VERS-TLS1.3 +<% end -%> +cache_peer_access osmtileAccelBackup<%= renders[:hostname] %> allow osmtile_sites +<% end -%> -<% (1..256).each do |i| -%> -delay_class <%= i %> 3 -<% end %> -#bit mask -# xxxxxxx- -------- xxxxxxxx xxxxxxxx +# ---------------------------------- -# small pools for faked browsers -<% (0..127).each do |i| -%> -delay_access <%= i+1 %> allow pool_<%= sprintf("%03d", 2*i) %> !pool_unlimited is_fake_browser osmtile_sites -delay_access <%= i+1 %> deny all -delay_parameters <%= i+1 %> -1/-1 <%= node[:tilecache][:net_bucket_refill] / 30 %>/<%= node[:tilecache][:net_bucket_size] / 30 %> <%= node[:tilecache][:ip_bucket_refill] / 30 %>/<%= node[:tilecache][:ip_bucket_size] / 30 %> -<% end %> +<% if node[:squid][:version] < 4 -%> -# small pools for !has_referer && is_browser - designed to slow down anyone -# using no-referer to bypass blocks due to abusive levels of use. -<% (0..127).each do |i| -%> -delay_access <%= i+1 %> allow pool_<%= sprintf("%03d", 2*i) %> !pool_unlimited !has_referer is_browser osmtile_sites -delay_access <%= i+1 %> deny all -delay_parameters <%= i+1 %> -1/-1 <%= node[:tilecache][:net_bucket_refill] / 10 %>/<%= node[:tilecache][:net_bucket_size] / 10 %> <%= node[:tilecache][:ip_bucket_refill] / 10 %>/<%= node[:tilecache][:ip_bucket_size] / 10 %> -<% end %> +#Allow tile_caches HTCP access +htcp_access allow tile_caches -# bigger pools for users providing a referer (assuming it's not blocked) -# or non-browser users. -<% (0..127).each do |i| %> -delay_access <%= i+129 %> allow pool_<%= sprintf("%03d", 2*i) %> !pool_unlimited osmtile_sites -delay_access <%= i+129 %> deny all -delay_parameters <%= i+129 %> -1/-1 <%= node[:tilecache][:net_bucket_refill] %>/<%= node[:tilecache][:net_bucket_size] %> <%= node[:tilecache][:ip_bucket_refill] %>/<%= node[:tilecache][:ip_bucket_size] %> +#Allow tile_caches ICP access +icp_access allow tile_caches <% end %> #----------------------------------