960
Comment:
|
3381
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
== 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}}} {{{ # porta su cui squid ascolta per l' HTTP http_port 8080 # hierarchy_stoplist cgi-bin ? no_cache deny QUERY # # 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 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"> }}} ---- |
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
# porta su cui squid ascolta per l' HTTP http_port 8080 # hierarchy_stoplist cgi-bin ? no_cache deny QUERY # # 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 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