Compare commits

..

20 Commits

Author SHA1 Message Date
Fred
6da3c49222 Update 2 files
- /gitlabci/docker-hub.yml
- /.gitlab-ci.yml
2024-08-01 12:27:21 +00:00
Fred
c5a63a6730 Restore rights to tmpfs after tests 2024-08-01 09:29:59 +00:00
Fred
488423694d Update workflow message 2024-07-25 12:37:49 +00:00
Fred
d3c02afab5 Tunne pipeline name 2024-07-25 12:32:48 +00:00
Fred
8f3752c31f Tune workflow name 2024-07-25 12:31:54 +00:00
Fred
9d8c662a6c Fix rights 2024-07-24 12:26:27 +00:00
Fred
6b7527addb Update docker-hub.yml 2024-07-24 11:37:32 +00:00
Fred
94323b7689 Update docker-hub.yml 2024-07-24 11:33:41 +00:00
Fred
6315a4a1b3 Update docker-hub.yml 2024-07-24 11:09:30 +00:00
Fred
4dbf12199b fix 2024-07-24 11:08:05 +00:00
Fred
f31ea2e3b7 test 2024-07-24 11:02:49 +00:00
Fred
49f6380114 fix 2024-07-24 10:55:04 +00:00
Fred
0124ee1201 Fix 2024-07-24 10:50:50 +00:00
Fred
436c70b19d test 2024-07-24 10:38:39 +00:00
Fred
f7e556aea6 fix CI_BUILDS_DIR 2024-07-24 10:33:32 +00:00
Fred
f9a0b126b5 Remove test with $CI_BUILDS_DIR 2024-07-24 09:15:20 +00:00
Fred
edd0729adc Test 2024-07-24 09:11:21 +00:00
Fred
b76abecedb Test move $CI_BUILDS_DIR 2024-07-24 09:10:04 +00:00
Fred
1864764d77 Add multi cores to make 2024-07-22 14:21:44 +00:00
Fred
2fa9599095 Hard code pid path 2024-05-02 14:30:03 +00:00
6 changed files with 314 additions and 25 deletions

View File

@ -2,9 +2,16 @@ workflow:
rules:
- if: $CI_COMMIT_BRANCH
workflow:
name: "$CI_COMMIT_TITLE: Squid auto rebuild docker from http://www.squid-cache.org/Versions images https://hub.docker.com/r/fredbcode"
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
# Build on tmpfs
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/tmpfs/$CI_PROJECT_NAME/$CI_COMMIT_BRANCH
stages:
- quality
- Docker-hub-build

View File

@ -13,15 +13,15 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--program-prefix= \
--libdir=/usr/lib \
--libexecdir=/usr/lib/squid \
--localstatedir=/run \
--sharedstatedir=/var/lib \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-icap-client \
--enable-icap-support \
--enable-async-io \
--with-pthreads \
--with-winbind \
--with-winbind \
--bindir=/usr/sbin \
--sbindir=/usr/sbin \
--with-squid=/usr/lib/squid \
@ -38,7 +38,7 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--enable-ssl \
--enable-ssl-crtd \
--with-openssl \
--enable-storeio="aufs,diskd,ufs,rock" \
--enable-storeio="aufs,diskd,ufs" \
--exec-prefix=/usr \
--enable-auth-basic="LDAP" \
--enable-auth-digest="LDAP" \
@ -51,10 +51,10 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--with-filedescriptors=48000 \
--enable-delay-pools \
--with-large-files \
--with-pidfile=/run/squid.pid \
--with-pidfile=/squid/squid.pid \
--with-default-user=squid \
--enable-removal-policies="lru,heap" \
&& make \
&& make -j4 \
&& find /tmp/ -type f -name "Makefil*" -delete \
&& find /tmp/ -type f -name "*.in" -delete
# Install
@ -94,12 +94,10 @@ RUN adduser --no-create-home --uid 1161 --group --system squid \
&& chown -Rf squid /usr/lib/squid \
&& chown -Rf squid /var/log/squid \
&& chown -Rf squid /var/cache/squid \
&& chown -Rf squid /run \
&& echo "cache_dir diskd /var/cache/squid/\${service_name} 130 51 51" >> /etc/squid/squid.conf \
&& echo "access_log stdio:/var/log/squid/access.log" >> /etc/squid/squid.conf \
&& echo "cache_log /var/log/squid/cache.log" >> /etc/squid/squid.conf \
&& echo "cache_effective_user squid" >> /etc/squid/squid.conf \
&& echo "pid_filename /var/run/squid.pid" >> /etc/squid/squid.conf \
# Removed in 5.8, needed for test
&& sed -i '/http_access deny all/ihttp_access allow localnet' /etc/squid/squid.conf \
# Packages dependencies installation for running and clean again
@ -112,4 +110,4 @@ HEALTHCHECK CMD squidclient mgr:info | grep "HTTP/1.1 200 OK" || exit 1
EXPOSE 3128
ENTRYPOINT ["dumb-init"]
USER squid
CMD ["bash", "-c", "/squid/run.sh"]
CMD ["bash", "-c", "/squid/run.sh && squid -N -n $HOSTNAME"]

View File

@ -0,0 +1,196 @@
opyright (C) 1996-2022 The Squid Software Foundation and contributors
##
## Squid software is distributed under GPLv2+ license and includes
## contributions from numerous individuals and organizations.
## Please see the COPYING and CONTRIBUTORS files for details.
##
#
# This file associates URL patterns for servers or services
# that don't automatically include Content-Type (like ftp) with a mime type
# and a graphical icon.
#
# Content-Encodings are taken from section 3.1 of RFC2068 (HTTP/1.1)
#
# This file has the format :
#
# regexp content-type icon encoding mode actions
#--------------------------------------------------------------------------------------------------------
\.gif$ image/gif silk/image.png - image +download
\.mime$ www/mime silk/page_white_text.png - ascii +download
^internal-dirup$ - silk/arrow_up.png - -
^internal-dir$ - silk/folder.png - -
^internal-link$ - silk/link.png - -
^internal-logo$ - SN.png - -
^internal-menu$ - silk/folder_table.png - -
^internal-text$ - silk/page_white_text.png - -
^internal-index$ - silk/folder_table.png - -
^internal-image$ - silk/image.png - -
^internal-sound$ - silk/music.png - -
^internal-movie$ - silk/film.png - -
^internal-telnet$ - silk/computer_link.png - -
^internal-binary$ - silk/application.png - -
^internal-unknown$ - silk/bullet_red.png - -
^internal-view$ - silk/page_white.png - -
^internal-download$ - silk/package_go.png - -
\.bin$ application/macbinary silk/application.png - image +download
\.oda$ application/oda silk/application.png - image +download
\.exe$ application/octet-stream silk/application.png - image +download
\.pdf$ application/pdf silk/page_white_acrobat.png - image +download
\.ai$ application/postscript silk/page_green.png - image +download +view
\.eps$ application/postscript silk/page_green.png - image +download +view
\.ps$ application/postscript silk/page_green.png - image +download +view
\.rtf$ text/rtf silk/page_white_picture.png - ascii +download +view
\.Z$ - silk/compress.png compress image +download
\.gz$ - silk/compress.png gzip image +download
\.bz2$ application/octet-stream silk/compress.png - image +download
\.bz$ application/octet-stream silk/compress.png - image +download
\.tgz$ application/x-tar silk/compress.png gzip image +download
\.csh$ application/x-csh silk/script.png - ascii +download +view
\.dvi$ application/x-dvi silk/page_white_text.png - image +download
\.hdf$ application/x-hdf silk/database.png - image +download
\.latex$ application/x-latex silk/page_white_text.png - ascii +download +view
\.lsm$ text/plain silk/page_white_text.png - ascii +download +view
\.nc$ application/x-netcdf silk/cd.png - image +download
\.cdf$ application/x-netcdf silk/cd.png - ascii +download
\.sh$ application/x-sh silk/script.png - ascii +download +view
\.tcl$ application/x-tcl silk/script.png - ascii +download +view
\.tex$ application/x-tex silk/page_white_text.png - ascii +download +view
\.texi$ application/x-texinfo silk/page_white_text.png - ascii +download +view
\.texinfo$ application/x-texinfo silk/page_white_text.png - ascii +download +view
\.t$ application/x-troff silk/page_white_text.png - ascii +download +view
\.roff$ application/x-troff silk/page_white_text.png - ascii +download +view
\.tr$ application/x-troff silk/page_white_text.png - ascii +download +view
\.man$ application/x-troff-man silk/page_white_magnify.png - ascii +download +view
\.me$ application/x-troff-me silk/page_white_text.png - ascii +download +view
\.ms$ application/x-troff-ms silk/page_white_text.png - ascii +download +view
\.src$ application/x-wais-source silk/script.png - ascii +download
\.zip$ application/zip silk/compress.png - image +download
\.bcpio$ application/x-bcpio silk/box.png - image +download
\.cpio$ application/x-cpio silk/box.png - image +download
\.gtar$ application/x-gtar silk/page_white_stack.png - image +download
\.rpm$ application/x-rpm silk/package.png - image +download
\.shar$ application/x-shar silk/script.png - image +download +view
\.sv4cpio$ application/x-sv4cpio silk/box.png - image +download
\.sv4crc$ application/x-sv4crc silk/box.png - image +download
\.tar$ application/x-tar silk/page_white_stack.png - image +download
\.ustar$ application/x-ustar silk/page_white_stack.png - image +download
\.au$ audio/basic silk/music.png - image +download
\.snd$ audio/basic silk/music.png - image +download
\.mp2$ audio/mpeg silk/music.png - image +download
\.mp3$ audio/mpeg silk/music.png - image +download
\.mpga$ audio/mpeg silk/music.png - image +download
\.aif$ audio/x-aiff silk/music.png - image +download
\.aiff$ audio/x-aiff silk/music.png - image +download
\.aifc$ audio/x-aiff silk/music.png - image +download
\.wav$ audio/x-wav silk/music.png - image +download
\.bmp$ image/bmp silk/image.png - image +download
\.ief$ image/ief silk/image.png - image +download
\.jpeg$ image/jpeg silk/photo.png - image +download
\.jpg$ image/jpeg silk/photo.png - image +download
\.jpe$ image/jpeg silk/photo.png - image +download
\.tiff$ image/tiff silk/photo.png - image +download
\.tif$ image/tiff silk/image.png - image +download
\.ras$ image/x-cmu-raster silk/image.png - image +download
\.pnm$ image/x-portable-anymap silk/image.png - image +download
\.pbm$ image/x-portable-bitmap silk/image.png - image +download
\.pgm$ image/x-portable-graymap silk/image.png - image +download
\.ppm$ image/x-portable-pixmap silk/image.png - image +download
\.rgb$ image/x-rgb silk/image.png - image +download
\.xbm$ image/x-xbitmap silk/image.png - image +download
\.xpm$ image/x-xpixmap silk/image.png - image +download
\.xwd$ image/x-xwindowdump silk/image.png - image +download
\.html$ text/html silk/page_world.png - ascii +download +view
\.htm$ text/html silk/page_world.png - ascii +download +view
\.css$ text/css silk/css.png - ascii +download +view
\.js$ application/x-javascript silk/script.png - ascii +download +view
\.c$ text/plain silk/page_white_c.png - ascii +download
\.h$ text/plain silk/page_white_c.png - ascii +download
\.cc$ text/plain silk/page_white_cplusplus.png - ascii +download
\.cpp$ text/plain silk/page_white_cplusplus.png - ascii +download
\.hh$ text/plain silk/page_white_c.png - ascii +download
\.m$ text/plain silk/script.png - ascii +download
\.f90$ text/plain silk/page_code.png - ascii +download
\.txt$ text/plain silk/page_white_text.png - ascii +download
\.asc$ text/plain silk/page_white_text.png - ascii +download
\.rtx$ text/richtext silk/page_white_picture.png - ascii +download +view
\.tsv$ text/tab-separated-values silk/script.png - ascii +download +view
\.etx$ text/x-setext silk/page_white_text.png - ascii +download +view
\.mpeg$ video/mpeg silk/film.png - image +download
\.mpg$ video/mpeg silk/film.png - image +download
\.mpe$ video/mpeg silk/film.png - image +download
\.qt$ video/quicktime silk/film.png - image +download
\.mov$ video/quicktime silk/film.png - image +download
\.avi$ video/x-msvideo silk/film.png - image +download
\.movie$ video/x-sgi-movie silk/film.png - image +download
\.cpt$ application/mac-compactpro silk/compress.png - image +download
\.hqx$ application/mac-binhex40 silk/page_white_zip.png - image +download
\.mwrt$ application/macwriteii silk/page_white_text.png - image +download
\.msw$ application/msword silk/script.png - image +download
\.doc$ application/msword silk/page_white_word.png - image +download +view
\.xls$ application/vnd.ms-excel silk/page_excel.png - image +download
\.ppt$ application/vnd.ms-powerpoint silk/page_white_powerpoint.png - image +download
\.wk[s1234]$ application/vnd.lotus-1-2-3 silk/script.png - image +download
\.mif$ application/vnd.mif silk/page_white_text.png - image +download
\.sit$ application/x-stuffit silk/compress.png - image +download
\.pict$ application/pict silk/picture.png - image +download
\.pic$ application/pict silk/picture.png - image +download
\.arj$ application/x-arj-compressed silk/compress.png - image +download
\.lzh$ application/x-lha-compressed silk/compress.png - image +download
\.lha$ application/x-lha-compressed silk/compress.png - image +download
\.zlib$ application/x-deflate silk/compress.png deflate image +download
README text/plain silk/information.png - ascii +download
^core$ application/octet-stream silk/bomb.png - image +download
\.core$ application/octet-stream silk/bomb.png - image +download
\.png$ image/png silk/image.png - image +download
\.cab$ application/octet-stream silk/compress.png - image +download +view
\.xpi$ application/x-xpinstall silk/plugin_add.png - image +download
\.class$ application/octet-stream silk/script_gear.png - image +download
\.java$ text/plain silk/cup.png - ascii +download
\.dcr$ application/x-director silk/script_palette.png - image +download
\.dir$ application/x-director silk/film.png - image +download
\.dxr$ application/x-director silk/film_key.png - image +download
\.djv$ image/vnd.djvu silk/image.png - image +download
\.djvu$ image/vnd.djvu silk/image.png - image +download
\.dll$ application/octet-stream silk/plugin.png - image +download
\.dms$ application/octet-stream silk/drive_disk.png - image +download
\.ez$ application/andrew-inset silk/bullet_red.png - image +download
\.ice$ x-conference/x-cooltalk silk/compress.png - image +download
\.iges$ model/iges silk/image.png - image +download
\.igs$ model/iges silk/image.png - image +download
\.kar$ audio/midi silk/music.png - image +download
\.mid$ audio/midi silk/music.png - image +download
\.midi$ audio/midi silk/music.png - image +download
\.mesh$ model/mesh silk/image.png - image +download
\.silo$ model/mesh silk/image.png - image +download
\.mxu$ video/vnd.mpegurl silk/film.png - image +download
\.pdb$ chemical/x-pdb silk/chart_line.png - image +download
\.pgn$ application/x-chess-pgn silk/bricks.png - image +download
\.ra$ audio/x-realaudio silk/music.png - image +download
\.ram$ audio/x-pn-realaudio silk/music.png - image +download
\.rm$ audio/x-pn-realaudio silk/music.png - image +download
\.sgml$ text/sgml silk/page_code.png - ascii +download
\.sgm$ text/sgml silk/page_code.png - ascii +download
\.skd$ application/x-koan silk/music.png - image +download
\.skm$ application/x-koan silk/music.png - image +download
\.skp$ application/x-koan silk/music.png - image +download
\.skt$ application/x-koan silk/music.png - image +download
\.smi$ application/smil silk/layers.png - image +download
\.smil$ application/smil silk/layers.png - image +download
\.so$ application/octet-stream silk/plugin.png - image +download
\.spl$ application/x-futuresplash silk/page_white_flash.png - image +download
\.swf$ application/x-shockwave-flash silk/page_white_flash.png - image +download
\.vcd$ application/x-cdlink silk/cd.png - image +download
\.vrml$ model/vrml silk/image.png - image +download
\.wbmp$ image/vnd.wap.wbmp silk/image.png - image +download
\.wbxml$ application/vnd.wap.wbxml silk/database_table.png - image +download
\.wmlc$ application/vnd.wap.wmlc silk/database_table.png - image +download
\.wmlsc$ application/vnd.wap.wmlscriptc silk/script.png - image +download
\.wmls$ application/vnd.wap.wmlscript silk/script.png - image +download
\.xht$ application/xhtml silk/page_world.png - ascii +download
\.xhtml$ application/xhtml silk/page_world.png - ascii +download
\.xml$ text/xml silk/page_world.png - ascii +download
\.xsl$ text/xml silk/layout.png - ascii +download
\.xyz$ chemical/x-xyz silk/chart_line.png - image +download
#
# the default
. text/plain silk/bullet_red.png - image +download +view

View File

@ -0,0 +1,96 @@
#
# Recommended minimum configuration:
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
acl localnet src 172.16.0.0/12 # RFC 1918 local private network (LAN)
acl localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
icap_enable on
icap_service service_req reqmod_precache bypass=off icap://e2guardian:1344/request
adaptation_access service_req deny manager
adaptation_access service_req allow all
icap_preview_enable off
icap_send_client_ip on
icap_send_client_username on
icap_service_failure_limit 80 in 5 seconds
icap_connect_timeout 60 seconds
icap_io_timeout 120 seconds
icap_service_revival_delay 30
#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all
# Squid normally listens to port 3128
http_port 3128
# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/cache/squid 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /var/cache/squid
#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
cache_dir diskd /var/cache/squid/${service_name} 130 51 51
access_log stdio:/var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_effective_user squid
follow_x_forwarded_for allow all
# Remove identifying headers
request_header_access Cache-Control deny all
request_header_access Via deny all
request_header_access X-Forwarded-For deny all

View File

@ -19,14 +19,6 @@ docker-hub-build:
- docker build --build-arg SQUID_VERSION=$SQUID_VERSION --pull -t $CONTAINER_BUILD_NOPROD_NAME_AMD64 .
- docker push $CONTAINER_BUILD_NOPROD_NAME_AMD64
.standalone:
image:
name: $CONTAINER_BUILD_NOPROD_NAME_AMD64
entrypoint: [""]
variables:
GIT_STRATEGY: none
dependencies: []
.services-amd64:
services:
- name: $CONTAINER_BUILD_NOPROD_NAME_AMD64
@ -45,11 +37,13 @@ docker-hub-test:
SquidParseConfig:
stage: Docker-hub-test
extends: .standalone
image:
name: $CONTAINER_BUILD_NOPROD_NAME_AMD64
script:
- /usr/sbin/squid -k parse /etc/squid/squid.conf
# Stop if error
- "! /usr/sbin/squid -k parse /etc/squid/squid.conf 2>&1 | grep ERROR"
- "! /usr/sbin/squid -k parse /etc/squid/squid.conf 2>&1 | grep ERROR"
dive:
image:
name: wagoodman/dive:latest

View File

@ -1,10 +1,8 @@
#!/bin/bash
USER=$( grep -m 1 ^cache_effective_user /etc/squid/squid.conf | awk '{ print ($2) }' )
PID=$( grep -m 1 ^pid_filename /etc/squid/squid.conf | awk '{ print ($2) }' )
if [ -e "$PID" ];then
if [ -e "/run/squid.pid" ];then
echo "Squid pid: Already running ?"
rm $PÏD
rm /run/squid.pid
pkill squid
exit 1
fi
@ -19,7 +17,7 @@ else
touch "/var/spool/squid/$HOSTNAME"
fi
while test -e $PID
while test -e /run/squid.pid
do
echo "cache is generated/checked"
sleep 1
@ -44,4 +42,4 @@ fi
echo "Starting: squid"
# Run autoreload: IN BACKGROUND
/squid/autoreload.sh &
squid -N -n "$HOSTNAME"