Configuration squid sous fedora

Fermé
lamyae100 Messages postés 6 Date d'inscription mercredi 12 janvier 2011 Statut Membre Dernière intervention 19 mars 2011 - 18 mars 2011 à 16:45
 adolf nka - 23 oct. 2012 à 11:03
Bonjour,
j ai installer squid serveur et client sous fedora vmw et je n sais pas comment faire tous les estapes pour realiser mon projet
j ai fait les etapes suivant
yum install squid
gedit /etc/squid/squid.conf
et voila:

#
# Recommended minimum configuration:
#
visible_hostname localhost.localdomainacl 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

# 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 fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl words url_regex facebook youtube
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 CONNECT method CONNECT


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

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

# 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 !words
# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 127.0.0.1: 3128
# 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/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/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

j a

2 réponses

hechbenz Messages postés 5 Date d'inscription jeudi 23 décembre 2010 Statut Membre Dernière intervention 14 janvier 2012
18 avril 2011 à 17:44
c koi l'énoncé du projet
0
Auteur:
nicolargo

Date:
8/06/2007

Catégories:
Reseau
Systeme

Tags:
fedora
proxy
réseau
squid
système
Installation de Squid sur Fedora


Voici un tutoriel pour installer Squid sur une distribution Fedora (Core 6). Squid est un serveur proxy gérant les protocoles HTTP, HTTPS et FTP. Il offre des performances de haut niveau, même si le service tourne sur une machine peu puissante.

L'installation peut se faire soit depuis les sources, soit depuis le repo Fedora.

Installation depuis les sources

Il faut d'abord récupérer les sources de la dernière version stable (2.6 au moment de l'écriture de ce post):

# wget http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE13.tar.gz

On lance la séquence de compilation:

# tar zxvf squid-2.6.STABLE13.tar.gz
# cd squid-2.6.STABLE13
# ./configure --enable-snmp
# make
# make install

Le répertoire d'installation par défaut est /usr/local/squid/.

Pour des raisons de sécurité, le processus sera lancé par l'utilisateur 'squid' (à créer si il n'existe pas...). Il faut donc créer les répertoires suivants:

# mkdir /var/spool/squid
# chown -R squid:squid /var/spool/squid
# mkdir /var/log/squid
# chown -R squid:squid /var/log/squid

La configuration est centralisé dans le fichier /usr/local/squid/etc/squid.conf.

Installation depuis le repos Fedora (méthode plus simple...)

On utilise yum pour installer Squid sur son système:

# yum install squid

Sous Fedora, l'automatisation du lancement de Squid au démarrage de la machine doit se faire de la manière suivante:

# chkconfig squid on

La configuration est centralisé dans le fichier /etc/squid/squid.conf.

Configuration

Voici, en exemple, mon fichier de configuration squid.conf:

http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mem 16 MB
cache_dir ufs /var/spool/squid 3000 16 256
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl user src 192.168.0.0/255.255.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
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 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 CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow user all
http_access deny all
http_reply_access allow all
icp_access allow all
snmp_access allow all
coredump_dir /usr/local/squid/var/cache

Avant de pouvoir utiliser le proxy, il faut générer la structure de base du répertoire de cache, pour cela on fait:

# squid -z
2007/06/07 17:14:38| Creating Swap Directories

Remarque: Si vous rencontrez l'erreur suivante:
FATAL: Could not determine fully qualified hostname. Please set 'visible_hostname'
Il faut renseigner l'option visible_hostname dans le fichier de configuration squid.conf.

Il ne reste plus qu'à lancer le serveur:

# squid
ou
# service squid start

Si le serveur ne démarre pas, c'est qu'il doit y avoir une erreur dans la configuration. Le plus simple pour identifier cette erreur est de lancer squid en mode console:

# squid -N -d 255

Si le PC système sur lequel est installé Squid intégre un Firewall de type Iptables, il faut penser à ajouter la règles suivantes:

# iptables -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 3128 -j ACCEPT
# /sbin/iptables-save

Configuration des clients

Sur Firefox, il faut aller dans le menu Preférences/Avancé/Réseau/Paramètres... puis saisir les informations:

Et voila... bon surf !
0