diff --git a/manifests/init.pp b/manifests/init.pp index e27a043..18b5947 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,6 +8,7 @@ $acl = [], $ssl_ports = [ '443' ], $safe_ports = [ '80', '21', '443', '70', '210', '1025-65535', '280', '488', '591', '777', ], + $access_log = $::squid3::params::access_log, $http_access = [], $icp_access = [], $tcp_outgoing_address = [], @@ -22,6 +23,8 @@ $server_persistent_connections = 'on', $maximum_object_size = '4096 KB', $maximum_object_size_in_memory = '512 KB', + $visible_hostname = '', + $logformat = [], $config_hash = {}, $refresh_patterns = [], $template = 'long', diff --git a/manifests/params.pp b/manifests/params.pp index 741fcee..b08919f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,12 +16,24 @@ $coredump_dir = '/var/spool/squid' } 'Debian', 'Ubuntu': { - $package_name = 'squid3' - $service_name = 'squid3' - $service_enable = false - $config_file = '/etc/squid3/squid.conf' - $log_directory = '/var/log/squid3' - $coredump_dir = '/var/spool/squid3' + case $::operatingsystemmajrelease { + '16.04': { + $package_name = 'squid' + $service_name = 'squid' + $service_enable = false + $config_file = '/etc/squid/squid.conf' + $log_directory = '/var/log/squid' + $coredump_dir = '/var/spool/squid' + } + default: { + $package_name = 'squid3' + $service_name = 'squid3' + $service_enable = false + $config_file = '/etc/squid3/squid.conf' + $log_directory = '/var/log/squid3' + $coredump_dir = '/var/spool/squid3' + } + } } 'FreeBSD': { $package_name = 'squid' diff --git a/templates/squid.conf.long.erb b/templates/squid.conf.long.erb index 8df1b62..a891000 100644 --- a/templates/squid.conf.long.erb +++ b/templates/squid.conf.long.erb @@ -641,9 +641,9 @@ # <% if @use_deprecated_opts -%> acl manager proto cache_object +<% end -%> acl localhost src 127.0.0.1/32 ::1 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 -<% end -%> # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing @@ -758,9 +758,11 @@ acl CONNECT method CONNECT # # Recommended minimum Access Permission configuration: # +<% if @use_deprecated_opts -%> # Only allow cachemgr access from localhost http_access allow manager localhost http_access deny manager +<% end -%> # Deny requests to certain unsafe ports http_access deny !Safe_ports @@ -2290,6 +2292,9 @@ maximum_object_size <%= @maximum_object_size %> #logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %h" "%{User-Agent}>h" %Ss:%Sh #Default: # none +<% @logformat.each do |line| -%> +logformat <%= line %> +<% end -%> # TAG: access_log # These files log client request activities. Has a line every HTTP or @@ -3575,6 +3580,9 @@ cache_mgr <%= @cache_mgr %> # names with this setting. #Default: # none +<% if @visible_hostname != "" -%> +visible_hostname <%= @visible_hostname %> +<% end -%> # TAG: unique_hostname # If you want to have multiple machines with the same diff --git a/templates/squid.conf.short.erb b/templates/squid.conf.short.erb index 40599af..3d8374d 100644 --- a/templates/squid.conf.short.erb +++ b/templates/squid.conf.short.erb @@ -4,9 +4,9 @@ # predefined ACLs <% if @use_deprecated_opts -%> acl manager proto cache_object +<% end -%> acl localhost src 127.0.0.1/32 ::1 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 -<% end -%> acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src 172.16.0.0/12 # RFC1918 possible internal network acl localnet src 192.168.0.0/16 # RFC1918 possible internal network @@ -21,8 +21,10 @@ acl Safe_ports port <%= line %> acl CONNECT method CONNECT # predefined http_accesses +<% if @use_deprecated_opts -%> http_access allow manager localhost http_access deny manager +<% end -%> http_access deny !Safe_ports http_access deny CONNECT !SSL_ports @@ -69,8 +71,14 @@ hierarchy_stoplist cgi-bin ? coredump_dir <%= @coredump_dir %> maximum_object_size_in_memory <%= @maximum_object_size_in_memory %> maximum_object_size <%= @maximum_object_size %> +<% @logformat.each do |line| -%> +logformat <%= line %> +<% end -%> ignore_expect_100 <%= @ignore_expect_100 %> cache_mgr <%= @cache_mgr %> +<% if @visible_hostname != "" -%> +visible_hostname <%= @visible_hostname %> +<% end -%> client_persistent_connections <%= @client_persistent_connections %> server_persistent_connections <%= @server_persistent_connections %> forwarded_for <%= @forwarded_for %>