Overview

Squid

Cache

/usr/local/squid/sbin/squid -k parse                                      #Check Configuration
/usr/local/squid/sbin/squid -f /etc/squid/squid.conf -k parse             #Check Configuration
/usr/local/squid2/sbin/squid -f /etc/squid2/squid.conf -k parse           #Check specified config file
/usr/local/squid/sbin/squid -f /etc/squid/squid.conf -k parse             #Check specified config file

Config

squid.conf

#
# Recommended minimum configuration:
#
#acl manager proto cache_object
#acl localhost src 127.0.0.1/32 ::1
#acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

error_directory /etc/squid/error

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
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
acl localnet src 213.144.12.248/29 # Offiziell1
acl clients src 10.6.7.0/24     # Client-Netzwerk
acl mgmt-server src 192.168.64.12/32  # Management-Server
acl extern src all              # Externe Zugriffe
#acl localnet src fc00::/7       # RFC 4193 local private network range
#acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
#acl all src all

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
acl SSH_ports port 22           # ssh
acl IMAP_ports port 143         # imap
acl CONNECT method CONNECT

acl HTTPS proto HTTPS

acl ftp proto FTP
acl high_ports port 1025-65535
acl ftp_port port 21
http_access allow ftp_port CONNECT
http_access allow ftp
always_direct allow ftp
http_access allow high_ports

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
http_access allow SSH_ports clients
http_access allow SSH_ports lydon
http_access allow IMAP_ports

# 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

# 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
#
#ignore_expect_100 on

# 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
#http_access allow extern



# And finally deny all other access to this proxy
#http_access deny all

# Squid normally listens to port 3128
# http_port 8080
http_port 10.6.3.25:8080
http_port 10.6.3.25:80 accel vhost
http_port 10.6.3.26:80 accel vhost

https_port 10.6.3.26:443 accel vhost cert=/root/certs/another-domain/another-domain.crt key=/root/certs/another-domain/another-domain.key cafile=/root/certs/another-domain/intermediate.crt options=ALL:NO_SSLv2:NO_SSLv3 cipher=ALL:!aNULL:!eNULL:!LOW:!EXP:!ADH:!RC4+RSA:+HIGH:!MEDIUM:!3DES

https_port 10.6.3.32:443 accel vhost cert=/root/certs/wildcard.local/wildcard.local.crt key=/root/certs/wildcard.local/wildcard.local.key cafile=/root/certs/wildcard.local/cabundle.crt options=ALL:NO_SSLv2:NO_SSLv3 cipher=ALL:!aNULL:!eNULL:!LOW:!EXP:!ADH:!RC4+RSA:+HIGH:!MEDIUM:!3DES

https_port 10.6.3.33:443 accel vhost cert=/root/certs/wildcard.local/wildcard.local.crt key=/root/certs/wildcard.local/wildcard.local.key cafile=/root/certs/wildcard.local/cabundle.crt options=ALL:NO_SSLv2:NO_SSLv3 cipher=ALL:!aNULL:!eNULL:!LOW:!EXP:!ADH:!RC4+RSA:+HIGH:!MEDIUM:!3DES

https_port 10.6.3.34:443 accel vhost cert=/root/certs/wildcard.local/wildcard.local.crt key=/root/certs/wildcard.local/wildcard.local.key cafile=/root/certs/wildcard.local/cabundle.crt options=ALL:NO_SSLv2:NO_SSLv3 cipher=ALL:!aNULL:!eNULL:!LOW:!EXP:!ADH:!RC4+RSA:+HIGH:!MEDIUM:!3DES

# not in use: 10.6.3.34-36

# We recommend you to use at least the following line.
#hierarchy_stoplist cgi-bin ?

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/log/squid/cache 100 16 256

# Leave coredumps in the first cache dir
#coredump_dir /var/log/squid/cache

# 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

# Configuration by TechniData IT-Service GmbH

#cache_peer 192.168.63.94 parent 443 0 no-query originserver ssl sslflags=DONT_VERIFY_PEER login=PASS name=sdtcc
#manitu2:
cache_peer 10.124.32.7 parent 443 0 no-query originserver ssl sslflags=DONT_VERIFY_PEER login=PASS name=sdtcc
acl sites_sdtcc dstdomain another-domain
cache_peer_access sdtcc allow sites_sdtcc
http_access deny !HTTPS sites_sdtcc
deny_info 307:https://%H%R sites_sdtcc
http_access allow extern sites_sdtcc

cache_peer 192.168.64.94 parent 443 0 no-query originserver ssl sslflags=DONT_VERIFY_PEER login=PASS name=testhost
acl sites_testhost dstdomain test-domain.local
cache_peer_access testhost allow sites_testhost
http_access allow extern sites_testhost

cache_peer 192.168.64.94 parent 8444 0 no-query originserver ssl sslflags=DONT_VERIFY_PEER login=PASS name=testhost-chesar
acl sites_testhost-chesar dstdomain chesar-domain.local
cache_peer_access testhost-chesar allow sites_testhost-chesar
http_access allow extern sites_testhost-chesar

# squid parameter
cache_dir diskd /var/log/squid/cache 3000 16 256
cache_mem 512 MB
coredump_dir /var/log/squid/cache
access_log /var/log/squid/logs/access.log common
cache_log /var/log/squid/logs/cache.log
cache_store_log /var/log/squid/logs/store.log
logfile_rotate 7
pid_filename /var/log/squid/logs/squid.pid
httpd_suppress_version_string on
#extension_methods RPC_IN_DATA RPC_OUT_DATA

cache_effective_user squid

http_access deny all

Reverse example

Accessing vhost:

http_port 10.6.3.26:80 accel vhost

HTTPS:

https_port 10.6.3.24:443 accel vhost cert=/root/certs/test.crt key=/root/certs/test.key cafile=/root/certs/test.pem

Forwarding:

cache_peer 192.168.65.119 parent 80 0 no-query originserver login=PASS name=servernameXY
acl sites_servernameXY dstdomain test.com
cache_peer_access servernameXY allow sites_servernameXY
http_access allow extern sites_servernameXY

Compile

1. To compile Squid run

./configure

Advanced options:

./configure --with-large-files --sysconfdir=/etc/squid --localstatedir=/var/log/squid --enable-ssl --with-openssl --with-filedescriptors=16384 --enable-storeio=diskd,ufs --prefix=/usr/local/squid --with-included-ltdl

Options:

SLES:
--prefix=/usr
--sysconfdir=/etc/squid
--bindir=/usr/sbin
--sbindir=/usr/sbin
--localstatedir=/var
--libexecdir=/usr/sbin
--datadir=/usr/share/squid
Ubuntu:
--prefix=/usr
--localstatedir=/var
--libexecdir=${prefix}/lib/squid
--srcdir=.
--datadir=${prefix}/share/squid
--sysconfdir=/etc/squid

2.

make

3.

make install

Check also: http://wiki.squid-cache.org/SquidFaq/CompilingSquid#How_do_I_compile_Squid.3F

Note: “libssl-dev” is required if you set “–enable-ssl –with-openssl”.

Cache

To create cache:

/usr/local/squid/sbin/squid -z

Init-Script

#!/bin/sh

### BEGIN INIT INFO
# Provides:             squid
# Required-Start:       $network $remote_fs $syslog
# Required-Stop:        $network $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:
# Short-Description:    Proxy Server
### END INIT INFO

set -e

test -x /usr/local/squid/sbin/squid || exit 0

umask 022

SQUID=/usr/local/squid/sbin/squid

case "$1" in
 start)
   #echo -n "Starting SQUID: "
   $SQUID
;;

 stop)
   #echo -n "Shutdown SQUID: "
   $SQUID -k shutdown
   n=120
   while $SQUID -k check && [ $n -gt 120 ]; do
   sleep 1
   echo -n .
   n=`expr $n - 1`
   done
   ;;

 reload)
   echo -n "Reload SQUID: "
   $SQUID -k reconfigure
;;


 restart)
   #echo -n "Shutdown SQUID :"
   $SQUID -k shutdown
   n=120
   while $SQUID -k check && [ $n -gt 120 ]; do
   sleep 1
   echo -n .
   n=`expr $n - 1`
   done
   echo -n "Starting SQUID: "
   $SQUID
;;

 status)
   #echo -n "Status SQUID: "
   $SQUID -k check
   ;;

 probe)
   exit 0
   ;;

 *)
   echo "Usage: $0 {start|stop|status|reload|restart|probe}"
   exit 1
  esac

Windows

squid.exe -k reconfigure            #Reload config
squid.exe -k parse                  #Check config
squid/squid.txt · Last modified: 2017/12/09 01:19 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki