Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added visible_hostname. #42

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [],
Expand All @@ -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',
Expand Down
24 changes: 18 additions & 6 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 9 additions & 1 deletion templates/squid.conf.long.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2290,6 +2292,9 @@ maximum_object_size <%= @maximum_object_size %>
#logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion templates/squid.conf.short.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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 %>
Expand Down