]> git.openstreetmap.org Git - chef.git/blob - cookbooks/squid/templates/default/squid.conf.erb
Make more fail2ban jail properties optional
[chef.git] / cookbooks / squid / templates / default / squid.conf.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 #configure host name
4 visible_hostname <%= node.name %>
5
6 #FIXME - configurable
7 cache_mem  <%= node[:squid][:cache_mem] %>
8
9 max_filedescriptors 98304
10
11 #used by squidclient / munin
12 http_port 3128
13 #ICP
14 icp_port 3130
15 log_icp_queries off
16
17 #FIXME - configurable
18 <% if node[:squid][:version] < 3 -%>
19 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
20 <% else -%>
21 http_port 80 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
22 <% end -%>
23
24 cache_effective_user proxy
25 cache_effective_group proxy
26
27 #FIXME - configurable
28 <% Array(node[:squid][:cache_dir]).each do |cache_dir| -%>
29 cache_dir <%= cache_dir %>
30 <% end -%>
31 <% if node[:squid][:version] < 3 -%>
32 cache_swap_log /var/spool/squid/%s
33 <% end -%>
34
35 cache_mgr webmaster@openstreetmap.org
36
37 quick_abort_min 0 KB
38 quick_abort_max 0 KB
39
40 read_ahead_gap 64 KB
41
42 maximum_object_size 1048576 bytes
43 maximum_object_size_in_memory 64 KB
44
45 cache_replacement_policy heap LFUDA
46 memory_replacement_policy heap GDSF
47
48 server_persistent_connections on
49 persistent_request_timeout 1 minutes
50
51 negative_ttl 15 seconds
52 half_closed_clients off
53 <% if node[:squid][:version] < 3 -%>
54 pipeline_prefetch on
55 <% else -%>
56 pipeline_prefetch 1
57 <% end -%>
58
59 read_timeout 90 seconds
60 request_timeout 90 seconds
61 connect_timeout 20 seconds
62 client_lifetime 1 hours
63
64 <% if node[:squid][:version] < 4 -%>
65 collapsed_forwarding on
66 <% end -%>
67 <% if node[:squid][:version] < 3 -%>
68 refresh_stale_hit 300 seconds
69 <% end -%>
70
71 #Recommended minimum configuration:
72 #----------------------------------
73 <% if node[:squid][:version] < 3 -%>
74 acl all src all
75 acl manager proto cache_object
76 acl localhost src 127.0.0.1/32
77 acl to_localhost dst 127.0.0.0/8
78 <% end -%>
79 acl SSL_ports port 443
80 acl Safe_ports port 80          # http
81 acl Safe_ports port 21          # ftp
82 acl Safe_ports port 443         # https
83 acl Safe_ports port 70          # gopher
84 acl Safe_ports port 210         # wais
85 acl Safe_ports port 1025-65535  # unregistered ports
86 acl Safe_ports port 280         # http-mgmt
87 acl Safe_ports port 488         # gss-http
88 acl Safe_ports port 591         # filemaker
89 acl Safe_ports port 777         # multiling http
90 acl CONNECT method CONNECT
91 http_access allow manager localhost
92
93 http_access allow manager
94
95 http_access deny manager
96 http_access deny !Safe_ports
97 http_access deny CONNECT !SSL_ports
98 #----------------------------------
99
100 acl purge_hosts src 127.0.0.0/8
101 acl PURGE method purge
102 http_access allow purge purge_hosts
103 http_access deny purge
104
105 forwarded_for on
106 follow_x_forwarded_for allow localhost
107
108 <% if node[:squid][:version] < 3 -%>
109 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
110 access_log <%= node[:squid][:access_log] %>
111 <% else -%>
112 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
113 access_log daemon:<%= node[:squid][:access_log] %>
114 <% end -%>
115 cache_log /var/log/squid/cache.log
116 cache_store_log none
117 buffered_logs on
118 client_db off
119 strip_query_terms off
120 <% if node[:squid][:version] > 2 -%>
121 # Work around bug in squid 3 that causes log_fqdn to be
122 # turned on by some of the (unused by us) default formats:
123 # http://lists.squid-cache.org/pipermail/squid-users/2016-February/thread.html#8999
124 url_rewrite_extras "%>a %un %>rm myip=%la myport=%lp"
125 store_id_extras "%>a %un %>rm myip=%la myport=%lp"
126 <% end -%>
127
128 digest_generation on
129
130 refresh_pattern .               0       50%     8640
131
132 #ZERO required for logrotate to work properly
133 logfile_rotate 0
134
135 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
136 <%= File.read(file) %>
137 <% end -%>
138
139 #MUST BE LAST ACL
140 #--------------
141 http_access deny all
142 icp_access deny all
143 #--------------
144