Skip to content

Commit bb97a8a

Browse files
committed
Add support for deploying a Squid caching proxy
Disabled by default.
1 parent b257eb3 commit bb97a8a

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
- name: Ensure /srv/docker/squid directory exists
3+
file:
4+
path: /srv/docker/squid
5+
state: directory
6+
mode: 0755
7+
become: true
8+
9+
- name: Copy modified squid.conf
10+
copy:
11+
src: "{{ kayobe_config_path }}/containers/squid_proxy/squid.conf"
12+
dest: /srv/docker/squid/
13+
mode: 0644
14+
become: true
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#
2+
# Recommended minimum configuration:
3+
#
4+
5+
# Example rule allowing access from your local networks.
6+
# Adapt to list your (internal) IP networks from where browsing
7+
# should be allowed
8+
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
9+
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
10+
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
11+
acl localnet src fc00::/7 # RFC 4193 local private network range
12+
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
13+
14+
acl SSL_ports port 443
15+
acl Safe_ports port 80 # http
16+
acl Safe_ports port 21 # ftp
17+
acl Safe_ports port 443 # https
18+
acl Safe_ports port 70 # gopher
19+
acl Safe_ports port 210 # wais
20+
acl Safe_ports port 1025-65535 # unregistered ports
21+
acl Safe_ports port 280 # http-mgmt
22+
acl Safe_ports port 488 # gss-http
23+
acl Safe_ports port 591 # filemaker
24+
acl Safe_ports port 777 # multiling http
25+
acl CONNECT method CONNECT
26+
27+
#
28+
# Recommended minimum Access Permission configuration:
29+
#
30+
# Deny requests to certain unsafe ports
31+
http_access deny !Safe_ports
32+
33+
# Deny CONNECT to other than secure SSL ports
34+
http_access deny CONNECT !SSL_ports
35+
36+
# Only allow cachemgr access from localhost
37+
http_access allow localhost manager
38+
http_access deny manager
39+
40+
# We strongly recommend the following be uncommented to protect innocent
41+
# web applications running on the proxy server who think the only
42+
# one who can access services on "localhost" is a local user
43+
#http_access deny to_localhost
44+
45+
#
46+
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
47+
#
48+
49+
# Example rule allowing access from your local networks.
50+
# Adapt localnet in the ACL section to list your (internal) IP networks
51+
# from where browsing should be allowed
52+
http_access allow localnet
53+
http_access allow localhost
54+
55+
# And finally deny all other access to this proxy
56+
http_access deny all
57+
58+
# Squid normally listens to port 3128
59+
http_port 3128
60+
61+
# Uncomment and adjust the following to add a disk cache directory.
62+
cache_dir ufs /var/spool/squid 4096 16 256
63+
cache_mem 768 MB
64+
maximum_object_size_in_memory 64 MB
65+
66+
# Leave coredumps in the first cache dir
67+
coredump_dir /var/spool/squid
68+
69+
#
70+
# Add any of your own refresh_pattern entries above these.
71+
#
72+
refresh_pattern ^ftp: 1440 20% 10080
73+
refresh_pattern ^gopher: 1440 0% 1440
74+
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
75+
refresh_pattern . 0 20% 4320

etc/kayobe/seed.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ seed_pulp_container:
105105
- pulp_containers:/var/lib/containers
106106
restart_policy: unless-stopped
107107

108+
# Seed container running a Squid caching proxy. This can be used to proxy
109+
# HTTP(S) requests from control plane hosts.
110+
seed_squid_container_enabled: false
111+
112+
seed_squid_container:
113+
squid:
114+
image: stackhpc/squid
115+
pre: "{{ kayobe_config_path }}/containers/squid_proxy/pre.yml"
116+
tag: "4.15"
117+
network_mode: host
118+
volumes:
119+
- squid_spool:/var/spool/squid
120+
- /srv/docker/squid/squid.conf:/etc/squid/squid.conf
121+
- /var/log/squid:/var/log/squid
122+
108123
# Dict of container images to start
109124
# Example:
110125
# seed_containers:
@@ -115,7 +130,8 @@ seed_pulp_container:
115130
# post: "{{ kayobe_env_config_path }}/containers/squid/post.yml"
116131
#
117132
seed_containers: >-
118-
{{ {} | combine(seed_pulp_container if seed_pulp_container_enabled | bool else {}) }}
133+
{{ {} | combine(seed_pulp_container if seed_pulp_container_enabled | bool else {})
134+
| combine(seed_squid_container if seed_squid_container_enabled | bool else {}) }}
119135
120136
###############################################################################
121137
# Seed node firewalld configuration.

0 commit comments

Comments
 (0)