From 65f332a73523e5ed6719e9f79c9691f3197818f0 Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Thu, 24 Mar 2016 14:22:57 -0400 Subject: [PATCH 1/7] Added visible_hostname. --- manifests/init.pp | 1 + templates/squid.conf.long.erb | 3 +++ templates/squid.conf.short.erb | 3 +++ 3 files changed, 7 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index e27a043..2abfd08 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -22,6 +22,7 @@ $server_persistent_connections = 'on', $maximum_object_size = '4096 KB', $maximum_object_size_in_memory = '512 KB', + $visible_hostname = '', $config_hash = {}, $refresh_patterns = [], $template = 'long', diff --git a/templates/squid.conf.long.erb b/templates/squid.conf.long.erb index 8df1b62..e12120a 100644 --- a/templates/squid.conf.long.erb +++ b/templates/squid.conf.long.erb @@ -3575,6 +3575,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..e290d53 100644 --- a/templates/squid.conf.short.erb +++ b/templates/squid.conf.short.erb @@ -71,6 +71,9 @@ maximum_object_size_in_memory <%= @maximum_object_size_in_memory %> maximum_object_size <%= @maximum_object_size %> 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 %> From 904a225e7380e7a09962055c79edfc1edcb796a8 Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Thu, 24 Mar 2016 14:40:53 -0400 Subject: [PATCH 2/7] Added logformat. --- manifests/init.pp | 1 + templates/squid.conf.long.erb | 3 +++ templates/squid.conf.short.erb | 3 +++ 3 files changed, 7 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 2abfd08..4b239f0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,6 +23,7 @@ $maximum_object_size = '4096 KB', $maximum_object_size_in_memory = '512 KB', $visible_hostname = '', + $logformat = [], $config_hash = {}, $refresh_patterns = [], $template = 'long', diff --git a/templates/squid.conf.long.erb b/templates/squid.conf.long.erb index e12120a..696dbf7 100644 --- a/templates/squid.conf.long.erb +++ b/templates/squid.conf.long.erb @@ -2290,6 +2290,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 diff --git a/templates/squid.conf.short.erb b/templates/squid.conf.short.erb index e290d53..bfc54cb 100644 --- a/templates/squid.conf.short.erb +++ b/templates/squid.conf.short.erb @@ -69,6 +69,9 @@ 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 != "" -%> From 74940ea9c9a197115b8f04a4a48d71b67ad3a475 Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Thu, 24 Mar 2016 15:02:25 -0400 Subject: [PATCH 3/7] Allow for override of access_log parameter. --- manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/init.pp b/manifests/init.pp index 4b239f0..ef27949 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 = $access_log, $http_access = [], $icp_access = [], $tcp_outgoing_address = [], From ecc321d80bfb6a0da2d127f13bf25a1ea02011b9 Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Tue, 10 May 2016 16:52:09 -0400 Subject: [PATCH 4/7] oh deprecated --- templates/squid.conf.long.erb | 2 ++ templates/squid.conf.short.erb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/templates/squid.conf.long.erb b/templates/squid.conf.long.erb index 696dbf7..c3513e4 100644 --- a/templates/squid.conf.long.erb +++ b/templates/squid.conf.long.erb @@ -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 diff --git a/templates/squid.conf.short.erb b/templates/squid.conf.short.erb index bfc54cb..d659b33 100644 --- a/templates/squid.conf.short.erb +++ b/templates/squid.conf.short.erb @@ -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 From 137087992ee84b2543360069c7f0966484b683af Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Tue, 10 May 2016 16:58:31 -0400 Subject: [PATCH 5/7] Adding back localhost acls --- templates/squid.conf.long.erb | 2 +- templates/squid.conf.short.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/squid.conf.long.erb b/templates/squid.conf.long.erb index c3513e4..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 diff --git a/templates/squid.conf.short.erb b/templates/squid.conf.short.erb index d659b33..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 From d247afd348aa5cc5357402f50b544b34eec29573 Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Mon, 19 Sep 2016 16:31:58 -0400 Subject: [PATCH 6/7] Added special case for variables under Ubuntu 16.04 --- manifests/params.pp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) 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' From 98f45f5fb08be7c52d2ee60677d8daafd7bcd8db Mon Sep 17 00:00:00 2001 From: Robert Cashman Date: Mon, 1 Oct 2018 11:31:03 -0400 Subject: [PATCH 7/7] Switched access_log to be optional --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index ef27949..18b5947 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,7 +8,7 @@ $acl = [], $ssl_ports = [ '443' ], $safe_ports = [ '80', '21', '443', '70', '210', '1025-65535', '280', '488', '591', '777', ], - $access_log = $access_log, + $access_log = $::squid3::params::access_log, $http_access = [], $icp_access = [], $tcp_outgoing_address = [],