14 oct 2010

SQUID +FreeBSD+Interception Caching

En mi entrada anterior hable de SQUID y los Tips a tener en cuenta para su configuración, hoy dejo los pasos que he realizado para la instalación del mismo sobre FreeBSD.

Interception Caching Configurar SQUID como Interception Caching o Proxy Transparente
   1.1 Instalar SQUID (make install)
     1.1.1 cd /usr/ports/www/squid
     1.1.2 make install – not clean, necesitaremos algunos scripts de los sources
   1.2 Config as Interception Cache
     1.2.1 Set – http_port IP:3128 transparente – in squid.conf
   1.3 Running SQUID
     1.3.1 Check acl access for localnet in squid.conf, for testing
       1.3.1.1 acl localnet 192.168.X.X/24
       1.3.1.2 http_access allow localnet
     1.3.2 /usr/local/sbin/squid -k parse – check syntax of squid.conf
     1.3.3 /usr/local/sbin/squid -Ncd1 – test squid, look output
     1.3.4 /usr/local/sbin/squid – running SQUID
     1.3.5 cp /usr/ports/www/squid/file/squid.in /etc/rc.d/squid - script for boot time
       1.3.5.1 Get execution permissions - chmod ug+x /etc/rc.d/squid
       1.3.5.2 Set var in /etc/rc.d/squid, Replace %%PREFIX%% for /usr/local
       1.3.5.3 Set var in /etc/rc.d/squid, Replace %%SQUID_UID%% for squid
     1.3.6 vi /etc/rc.conf add squid_enabled=”YES”
     1.3.7 /etc/rc.d/squid restart

Lo único que queda, es configurar el navegador a la dirección ip y puerto del proxy. Navegar, obvio que debemos estar en el rango ip de localnet, y verificar el funcionamiento del proxy en access.log y cache.log

#> tail -f /var/squid/logs/cache.log

Starting Squid Cache version 2.7.STABLE9 for i386-portbld-freebsd8.0...
Process ID 94872
With 11095 file descriptors available
Using kqueue for the IO loop
Performing DNS Tests...
Successful DNS name lookup tests...
DNS Socket created at 0.0.0.0, port 19005, FD 6
Adding nameserver X.X.X.X from /etc/resolv.conf
logfileOpen: opening log /var/squid/logs/access.log
Unlinkd pipe opened on FD 11
Swap maxSize 102400 + 8192 KB, estimated 8507 objects
Target number of buckets: 425
Using 8192 Store buckets
Max Mem size: 8192 KB
Max Swap size: 102400 KB
logfileOpen: opening log /var/squid/logs/store.log
Rebuilding storage in /var/squid/cache (DIRTY)
Using Least Load store dir selection
Set Current Directory to /var/squid/cache
Loaded Icons.
Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 12.
Accepting ICP messages at 0.0.0.0, port 3130, FD 13.
Accepting SNMP messages on port 3401, FD 14.
WCCP Disabled.
Ready to serve requests.

REFERENCES:

FreeBSD Starting Services
How To Install SQUID