Differences between revisions 3 and 4
Revision 3 as of 2005-08-21 18:11:46
Size: 3381
Editor: Kurgan
Comment:
Revision 4 as of 2005-10-18 10:35:19
Size: 3550
Editor: Kurgan
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Questa e` una configurazione minimale adatta a Squid standard di Debian. Puo` andare come punto di partenza, ma e` chiaro che la configurazione di squid e` cosi` complessa che puo` anche darsi che non vada bene per niente per voi. Come sempre, YMMV. Il file e` {{{/etc/squid.conf}}} Questa e` una configurazione minimale adatta a Squid standard di Debian. Puo` andare come punto di partenza, ma e` chiaro che la configurazione di squid e` cosi` complessa che puo` anche darsi che non vada bene per niente per voi. Come sempre, YMMV. Il file e` {{{/etc/squid.conf}}}.

Dal momento che rispetto al default cambia la configurazione della cache, consiglio di eseguire {{{squid -z}}} dopo avere messo in opera questa configurazione.
Line 7: Line 10:
#
hierarchy_stoplist cgi-bin ?
no_cache deny QUERY
Line 60: Line 60:
#
hierarchy_stoplist cgi-bin ?
no_cache deny QUERY
#

Configurazione minimale generica

Questa e` una configurazione minimale adatta a Squid standard di Debian. Puo` andare come punto di partenza, ma e` chiaro che la configurazione di squid e` cosi` complessa che puo` anche darsi che non vada bene per niente per voi. Come sempre, YMMV. Il file e` /etc/squid.conf.

Dal momento che rispetto al default cambia la configurazione della cache, consiglio di eseguire squid -z dopo avere messo in opera questa configurazione.

# porta su cui squid ascolta per l' HTTP
http_port 8080
#
# quanta cache in RAM
cache_mem 16 MB
# quanta cache sul disco e dove.
cache_dir diskd  /var/spool/squid 1024 64 256
#
# Fai risoluzione inversa degli host che si connettono a squid e mostrali nel log. 
# Roba da paranoici, per sapere chi ha fatto cosa. Di solito non serve.
log_fqdn on
# Mostra nei log i termini delle GET http (dopo il carattere "?")
# e` sempre per paranoici e control freaks.
strip_query_terms off
#
# TTL della pagine irraggiungibili e delle richieste DNS.
# Tenuti bassi per evitare che un problema momentaneo diventi un'ora di down.
negative_ttl 5 seconds
positive_dns_ttl 1 hours
negative_dns_ttl 5 seconds
#
# ACL per tutti
acl QUERY urlpath_regex cgi-bin \?
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443 563     # https, snews
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 Safe_ports port 901         # SWAT
acl Safe_ports port 631         # cups
acl purge method PURGE
acl CONNECT method CONNECT
acl local_lan src <ip address>/<mask>
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow local_lan
http_access allow localhost
http_access deny all
icp_access allow all
#
hierarchy_stoplist cgi-bin ?
no_cache deny QUERY
#
cache_mgr root
#
# Personalizzazione hostname e utente per ftp anonimo.
ftp_user Squid@<il tuo dominio>
visible_hostname <hostname del server squid>
append_domain <il tuo dominio, nella forma ".dominio.tld">


Squid come transparent proxy

Questa configurazione consente di usare Squid sia come transparent proxy che come proxy "classico". E` sufficiente inserire in squid.conf le seguenti voci:

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

Poi, sul firewall, ridirigere le connessioni che escono verso la porta 80 alla porta giusta del proxy server. Se il proxy server gira sullo stesso pc del firewall, si puo` fare cosi`: (eth0 e` l'interfaccia LAN, e 3128 e` la porta di default su cui ascolta squid)

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

Se invece il proxy server e` una macchina diversa dal firewall, cosi`: (eth0 e` l'interfaccia LAN, 192.168.2.1:8080 sono host e porta su cui gira il proxy)

iptables -t nat -I PREROUTING -i eth0 -m state --state new -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:8080

LinuxDebian/Squid (last edited 2016-11-10 09:22:31 by Kurgan)