Squid

De BlaxWiki
Aller à la navigationAller à la recherche

Doc sommaire de squid-fr

Pour configurer un acces, il faut deja comprendre comment fonctionne squid. Squid va definir une source (le client), une destination (la ressource a acceder), et une regle pour lier 
les deux. De base, toute les sources (definies ou non dans squid) n'ont aucun acces aux ressources (definies ou non dans squid). Pour ouvrir un acces, il faut en premier lieu creer 
une source, creer une destination si celle-ci n'existe pas deja, puis une regle d'autorisation entre cette source et cette destination.

Si le proxy n'a jamais ete configure pour ce serveur, il faudra le configurer. Pour chaque client, si le reseau du client ne contient que du windows, créer une ligne (dans squid.conf)
    acl <client>-1 src <reseau client> 

puis ajouter ces 2 lignes
    http_access allow CONNECT wuCONNECT <client>-1
    http_access allow windowsupdate <client>-1 

Si un seul serveur doit etre autorise ou si il s’agit d’un reseau prive avec plusieurs clients, remplacer <client>-1 par le nom du serveur.

Exemple de configuration proxy simple

Ici le proxy a pour role d'autoriser ou non l'accès à certaine url suivant l'ip source

# acl administrative
acl manager proto cache_object
acl localhost src 127.0.0.0/8
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl CONNECT method CONNECT
acl purge method PURGE


############################################
# DEBUT: acls de destination
############################################
#
acl windowsupdate       dstdomain windowsupdate.microsoft.com
acl windowsupdate       dstdomain .update.microsoft.com
acl windowsupdate       dstdomain download.windowsupdate.com
acl windowsupdate       dstdomain redir.metaservices.microsoft.com
acl windowsupdate       dstdomain images.metaservices.microsoft.com
acl windowsupdate       dstdomain c.microsoft.com
acl windowsupdate       dstdomain www.download.windowsupdate.com
acl windowsupdate       dstdomain download.microsoft.com
acl windowsupdate       dstdomain support.microsoft.com
acl windowsupdate       dstdomain wustat.windows.com
acl windowsupdate       dstdomain crl.microsoft.com
acl windowsupdate       dstdomain au.download.windowsupdate.com
acl windowsupdate       dstdomain crl.verisign.com
acl windowsupdate       dstdomain mscrl.microsoft.com
acl windowsupdate       dstdomain www.microsoft.com
acl windowsupdate       dstdomain sls.microsoft.com
acl windowsupdate       dstdomain productactivation.one.microsoft.com
acl windowsupdate       dstdomain ntservicepack.microsoft.com
acl windowsupdate       dstdomain go.microsoft.com
acl windowsupdate       dstdomain ie9cvlist.ie.microsoft.com
acl windowsupdate       dstdomain activation.sls.microsoft.com
acl wuCONNECT           dstdomain www.update.microsoft.com
acl wuCONNECT           dstdomain test.update.microsoft.com
acl wuCONNECT           dstdomain sls.microsoft.com
acl pecl                dstdomain pecl.php.net
acl pear                dstdomain pear.php.net
acl ubuntu              dstdomain .ubuntu.com
acl centos              dstdomain .centos.org
acl centos              dstdomain .zend.com
acl centos              dstdomain mirror.ovh.net
acl rhel                dstdomain xmlrpc.rhn.redhat.com
acl rhel                dstdomain content-xmlrpc.rhn.redhat.com
acl rhel                dstdomain rhn.redhat.com
acl scilnx              dstdomain ftp1.scientificlinux.org
acl windows             dstdomain .microsoft.com
acl perl                dstdomain ftp.u-strasbg.fr
acl perl                dstdomain .perl.org
acl perl                dstdomain .cict.fr
acl perl                dstdomain .jussieu.fr
acl perl                dstdomain cpan.enstimac.fr
acl sysinternals        dstdomain .sysinternals.com
acl package             dstdomain package.infra.agarik.com
acl package             dstdomain package1.infra.agarik.com
acl package             dstdomain package2.infra.agarik.com
acl agarik              dstdomain .agarik.com
acl python              dstdomain .python.org
acl vmware              dstdomain .vmware.com
acl php                 dstdomain .php.net
acl debian              dstdomain .debian.org
acl zend                dstdomain .zend.com
acl postgres            dstdomain .postgresql.org
acl compellent          dstdomain .compellent.com
acl clamav              dstdomain .clamav.net
acl palo.alto.networks  dstdomain .paloaltonetworks.com
#
############################################
# FIN: acls de destination
############################################

# Definition des autorisations d'acces via des paires acl reseau/acl destination

# Pour squidclamav
http_access allow localhost
http_access allow purge localhost
http_access deny purge
url_rewrite_access deny localhost

# Pour le manager
http_access allow manager localhost
http_access deny manager

# On autorise que les ports 'classiques' de telechargement http/https/ftp
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports


###########################################################
# Autorisations clients
###########################################################
# Agarik
http_access allow CONNECT wuCONNECT bab.agarik.com
http_access allow windowsupdate bab.agarik.com
http_access allow perl bab.agarik.com

# Cette ligne permet au machine de l acl reseau.install.mep.agarik.com de sortir sur internet sur n'importe quel domaine, mais seulement sur les port 21,80,443 (comme définit pour 
l'acl Safe_ports)

http_access allow reseau.install.mep.agarik.com

# on refuse tout
icp_access deny all
htcp_access deny all
http_access deny all

http_port 3128
hierarchy_stoplist cgi-bin ?

url_rewrite_program /opt/applis/squidclamav/bin/squidclamav -c /opt/applis/squidclamav/etc/squidclamav.conf
url_rewrite_children 15

access_log syslog:local6.warning squid
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern (cgi-bin|\?)    0       0%      0
refresh_pattern .               0       20%     4320
icp_port 3130
coredump_dir /opt/applis/squid/var/logs
cache_dir ufs /opt/applis/squid/var/cache 1024 16 256