voxpupuli/puppet-squid

Name: puppet-squid

Owner: Vox Pupuli

Description: Puppet module for configuration of squid caching proxy.

Created: 2016-04-13 07:33:31.0

Updated: 2017-01-20 16:18:18.0

Pushed: 2018-01-04 09:44:24.0

Homepage: https://forge.puppet.com/puppet/squid

Size: 195

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Puppet module for Squid

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Description

Puppet module for configuring the squid caching service.

Usage

The set up a simple squid server with a cache to forward http port 80 requests.

s { 'squid': }
d::acl { 'Safe_ports':
pe    => port,
tries => ['80'],

d::http_access { 'Safe_ports':
tion => allow,

d::http_access{ '!Safe_ports':
tion => deny,

Parameters for squid Class

Parameters to the squid class almost map 1 to 1 to squid.conf parameters themselves.

s { 'squid':
che_mem    => '512 MB',
rkers      => 3,
redump_dir => '/var/spool/squid',

uppet
s { 'squid':
che_mem    => '512 MB',
rkers      => 3,
redump_dir => '/var/spool/squid',
ls         => { 'remote_urls' => {
                  type    => 'url_regex',
                  entries => ['http://example.org/path',
                              'http://example.com/anotherpath'],
                },
              },
tp_access  => { 'our_networks hosts' => { action => 'allow', }},
tp_ports   => { '10000' => { options => 'accel vhost', }},
mp_ports   => { '1000' => { process_number => 3, }},
che_dirs   => { '/data/' => { type => 'ufs', options => '15000 32 256 min-size=32769', process_number => 2 }},

The acls, http_access, http_ports, snmp_port, cache_dirs lines above are equivalent to their examples below.

Defined Type squid::acl

Defines acl entries for a squid server.

d::acl { 'remote_urls':
ype    => 'url_regex',
ntries => ['http://example.org/path',
           'http://example.com/anotherpath'],

would result in a multi entry squid acl

remote_urls url_regex http://example.org/path
remote_urls url_regex http://example.com/anotherpath

These may be defined as a hash passed to ::squid

Parameters for Type squid::acl
Defined Type squid::cache_dir

Defines cache_dir entries for a squid server.

d::cache_dir { '/data':
pe           => 'ufs',
tions        => '15000 32 256 min-size=32769',
ocess_number => 2,

Results in the squid configuration of

{processor} = 2
e_dir ufs 15000 32 256 min-size=32769
f
Parameters for Type squid::cache_dir
Defined Type squid::cache

Defines cache entries for a squid server.

d::cache { 'our_network_hosts_acl':
tion    => 'deny',
mment   => 'Our networks hosts are denied for caching',

Adds a squid.conf line

r networks hosts denied for caching
e deny our_network_hosts_acl
Defined Type squid::http_access

Defines http_access entries for a squid server.

d::http_access { 'our_networks hosts':
tion => 'allow',

Adds a squid.conf line

tp_access fragment for out_networks hosts
_access allow our_networks hosts
uppet
d::http_access { 'our_networks hosts':
tion    => 'allow',
mment   => 'Our networks hosts are allowed',

Adds a squid.conf line

r networks hosts are allowed
_access allow our_networks hosts
Defined Type squid::snmp_access

Defines snmp_access entries for a squid server.

d::snmp_access { 'monitoring hosts':
tion => 'allow',

Adds a squid.conf line

mp_access fragment for monitoring hosts
_access allow monitoring hosts
uppet
d::snmp_access { 'monitoring hosts':
tion    => 'allow',
mment   => 'Our monitoring hosts are allowed',

Adds a squid.conf line

r monitoring hosts are allowed
_access allow monitoring hosts

These may be defined as a hash passed to ::squid

Defined Type squid::icp_access

Defines icp_access entries for a squid server.

d::icp_access { 'our_networks hosts':
tion => 'allow',

Adds a squid.conf line

access allow our_networks hosts

These may be defined as a hash passed to ::squid

Parameters for Type squid::http_allow
Defined Type Squid::Http_port

Defines http_port entries for a squid server. By setting optional ssl parameter to true will create https_port entries instead.

d::http_port { '10000':
tions => 'accel vhost'

d::http_port { '10001':
l     => true,
tions => 'cert=/etc/squid/ssl_cert/server.cert key=/etc/squid/ssl_cert/server.key'

Results in a squid configuration of

_port 10000 accel vhost
s_port 10001 cert=/etc/squid/ssl_cert/server.cert key=/etc/squid/ssl_cert/server.key
Parameters for Type squid::http_port
Defined Type Squid::Https_port

Defines https_port entries for a squid server. As an alternative to using the Squid::Http_port defined type with ssl set to true, you can use this type instead. The result is the same. Internally this type uses Squid::Http_port to create the configuration entries.

Parameters for Type squid::https_port
Defined Type squid::refresh_pattern

Defines refresh_pattern entries for a squid server.

d::refresh_pattern { '^ftp':
n     => 1440,
x     => 10080,
rcent => 20,
der   => 60,


d::refresh_pattern { '(/cgi-bin/|\?)':
se_sensitive => falke,
n            => 0,
x            => 0,
rcent        => 0,
der          => 61,

would result in the following squid refresh patterns

fresh_pattern fragment for ^ftp
esh_pattern ^ftp: 1440 20% 10080
fresh_pattern fragment for (/cgi-bin/|\?)
esh_pattern (/cgi-bin/|\?): -i 0 0% 0

These may be defined as a hash passed to ::squid

YAML example:

d::refresh_patterns:
ftp':
max:     10080
min:     1440
percent: 20
order:   '60'
gopher':
max:     1440
min:     1440
percent: 0
order:   '61'
/cgi-bin/|\?)':
case_sensitive: false
max:            0
min:            0
percent:        0
order:          '62'
':
max:     4320
min:     0
percent: 20
order:   '63'
Parameters for Type squid::refresh_pattern
Defined Type Squid::Snmp_port

Defines snmp_port entries for a squid server.

d::snmp_port { '1000':
ocess_number => 3

Results in a squid configuration of

{process_number} = 3
_port 1000
f
Parameters for Type squid::http_port
Defined Type squid::auth_param

Defines auth_param entries for a squid server.

d::auth_param { 'basic auth_param':
heme  => 'basic',
tries => [
'program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd',
'children 5',
'realm Squid Basic Authentication',
'credentialsttl 5 hours',


would result in multi entry squid auth_param

_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd
_param basic children 5
_param basic realm Squid Basic Authentication
_param basic credentialsttl 5 hours

These may be defined as a hash passed to ::squid

Parameters for Type squid::auth_param
Defined Type squid::ssl_bump

Defines ssl_bump entries for a squid server.

d::ssl_bump { 'all':
tion => 'bump',

Adds a squid.conf line

bump bump all

These may be defined as a hash passed to ::squid

Parameters for Type squid::ssl_bump
Defined Type squid::sslproxy_cert_error

Defines sslproxy_cert_error entries for a squid server.

d::sslproxy_cert_error { 'all':
tion => 'allow',

Adds a squid.conf line

roxy_cert_error allow all

These may be defined as a hash passed to ::squid

Parameters for Type squid::sslproxy_cert_error
Defined Type squid::extra_config_section

Squid has a large number of configuration directives. Not all of these have been exposed individually in this module. For those that haven't, the extra_config_section defined type can be used.

Using a hash of config_entries:

d::extra_config_section { 'mail settings':
der          => '60',
nfig_entries => {
'mail_from'    => 'squid@example.com',
'mail_program' => 'mail',


Results in a squid configuration of

il settings
_from squid@example.com
_program mail

Using an array of config_entries:

d::extra_config_section { 'ssl_bump settings':
der          => '60',
nfig_entries => {
'ssl_bump'         => ['server-first', 'all'],
'sslcrtd_program'  => ['/usr/lib64/squid/ssl_crtd', '-s', '/var/lib/ssl_db', '-M', '4MB'],
'sslcrtd_children' => ['8', 'startup=1', 'idle=1'],


Results in a squid configuration of

l_bump settings
bump server-first all
rtd_program /usr/lib64/squid/ssl_crtd -s /var/lib/ssl_db -M 4MB
rtd_children 8 startup=1 idle=1

Using an array of hashes of config_entries:

d::extra_config_section { 'always_directs':
der          => '60',
nfig_entries => [{
'always_direct' => ['deny    www.reallyreallybadplace.com',
                    'allow   my-good-dst',
                    'allow   my-other-good-dst'],
,

Results in a squid configuration of

ways_directs
ys_direct deny    www.reallyreallybadplace.com
ys_direct allow   my-good-dst
ys_direct allow   my-other-good-dst
Parameters for Type squid::extra_config_section

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.