manuales:servidor_squid
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previaPróxima revisiónAmbos lados, revisión siguiente | ||
manuales:servidor_squid [2011/04/14 18:49] – cayu | manuales:servidor_squid [2011/05/09 14:34] – cayu | ||
---|---|---|---|
Línea 96: | Línea 96: | ||
==== Mensaje de respuesta ==== | ==== Mensaje de respuesta ==== | ||
+ | |||
+ | Es el mensaje recibido por parte del servidor | ||
+ | |||
+ | Un ejemplo : | ||
+ | |||
+ | < | ||
+ | HTTP/1.0 200 OK Date: Sat, 14 Jan 2011 11:32:12 GMT Server : Apache/1.3 Content-Type : text/HTML Content-Length : 1245 | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | === Códigos de respuesta === | ||
+ | |||
+ | ^^ Código ^ Mensaje ^ Descripción ^^ | ||
+ | |200|OK|La solicitud se llevó a cabo de manera correcta| | ||
+ | |201|CREATED|Sigue a un comando POST e indica el éxito, la parte restante del cuerpo indica la dirección URL donde se ubicará el documento creado recientemente| | ||
+ | |202|ACCEPTED|La solicitud ha sido aceptada, pero el procedimiento que sigue no se ha llevado a cabo| | ||
+ | |203|PARTIAL|INFORMATION Cuando se recibe este código en respuesta a un comando de GET indica que la respuesta no está completa| | ||
+ | |204|NO RESPONSE| El servidor ha recibido la solicitud, pero no hay información de respuesta| | ||
+ | |205|RESET CONTENT| El servidor le indica al navegador que borre el contenido en los campos de un formulario| | ||
+ | |206|PARTIAL CONTENT| Es una respuesta a una solicitud que consiste en el encabezado range. El servidor debe indicar el encabezado content-Range| | ||
+ | |301|MOVED|Los datos solicitados han sido transferidos a una nueva dirección| | ||
+ | |302|FOUND|Los datos solicitados se encuentran en una nueva dirección URL, pero, no obstante, pueden haber sido trasladados| | ||
+ | |303|METHOD|Significa que el cliente debe intentarlo con una nueva dirección; es preferible que intente con otro método en vez de GET| | ||
+ | |304|NOT MODIFIED|Si el cliente llevó a cabo un comando GET condicional (con la solicitud relativa a si el documento ha sido modificado desde la última vez) y el documento no ha sido modificado, este código se envía como respuesta| | ||
+ | |400|BAD REQUEST|La sintaxis de la solicitud se encuentra formulada de manera errónea o es imposible de responder| | ||
+ | |401|UNAUTHORIZED|Los parámetros del mensaje aportan las especificaciones de formularios de autorización que se admiten. El cliente debe reformular la solicitud con los datos de autorización correctos| | ||
+ | |402|PAYMENT REQUIRED|El cliente debe reformular la solicitud con los datos de pago correctos| | ||
+ | |403|FORBIDDEN|El acceso al recurso simplemente se deniega| | ||
+ | |404|NOT FOUND|El servidor no halló nada en la dirección especificada. Se ha abandonado sin dejar una dirección para redireccionar| | ||
+ | |500|INTERNAL ERROR|El servidor encontró una condición inesperada que le impide seguir con la solicitud| | ||
+ | |501|NOT IMPLEMENTED|El servidor no admite el servicio solicitado| | ||
+ | |502|BAD GATEWAY|El servidor que actúa como una puerta de enlace o proxy ha recibido una respuesta no válida del servidor al que intenta acceder| | ||
+ | |503|SERVICE UNAVAILABLE|El servidor no puede responder en ese momento debido a que se encuentra congestionado (todas las líneas de comunicación se encuentran congestionadas, | ||
+ | |504|GATEWAY TIMEOUT|La respuesta del servidor ha llevado demasiado tiempo en relación al tiempo de espera que la puerta de enlace podía admitir| | ||
===== Proxy Web ===== | ===== Proxy Web ===== | ||
Línea 209: | Línea 244: | ||
===== Implementación ===== | ===== Implementación ===== | ||
- | ===== Compilación | + | ==== Compilación ==== |
Para la puesta en marcha de un servidor Squid, su instalación puede realizar desde paquetes provisto por la distribución: | Para la puesta en marcha de un servidor Squid, su instalación puede realizar desde paquetes provisto por la distribución: | ||
Línea 238: | Línea 273: | ||
- | ===== Configuración | + | ==== Configuración ==== |
- | Por la opción de compilación --sysconfdir, | + | Por la opción de compilación |
+ | |||
+ | === Servicio === | ||
+ | |||
+ | El archivo de configuración principal lo tendremos en /// | ||
El primer paso es vericar el path de los logs y del cache, y también el usuario con el que corre el Squid, observando el valor de los siguientes parámetros (los default se encuentran comentados, pero están activos): | El primer paso es vericar el path de los logs y del cache, y también el usuario con el que corre el Squid, observando el valor de los siguientes parámetros (los default se encuentran comentados, pero están activos): | ||
Línea 268: | Línea 307: | ||
</ | </ | ||
+ | |||
+ | Ejemplo de configuración mínima para que arranque el servicio : | ||
+ | |||
+ | < | ||
+ | http_port 3128 | ||
+ | |||
+ | hierarchy_stoplist cgi-bin ? | ||
+ | |||
+ | refresh_pattern ^ftp: | ||
+ | refresh_pattern ^gopher: | ||
+ | refresh_pattern -i (/ | ||
+ | refresh_pattern . | ||
+ | |||
+ | acl all src 0.0.0.0/ | ||
+ | acl manager proto cache_object | ||
+ | acl localhost src 127.0.0.1/ | ||
+ | acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 | ||
+ | |||
+ | acl localnet src 10.0.0.0/ | ||
+ | acl localnet src 172.16.0.0/ | ||
+ | acl localnet src 192.168.0.0/ | ||
+ | acl localnet src fc00::/ | ||
+ | acl localnet src fe80::/ | ||
+ | |||
+ | 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 | ||
+ | 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 localhost | ||
+ | http_access allow localnet | ||
+ | http_access deny all | ||
+ | </ | ||
+ | |||
+ | ==== Información de Squid ==== | ||
+ | |||
+ | Si queremos ver los mensajes de error de Squid traducidos | ||
+ | |||
+ | < | ||
+ | error_directory / | ||
+ | </ | ||
+ | |||
+ | |||
+ | Si queremos ocultar la versión del Squid a mostrar | ||
+ | |||
+ | < | ||
+ | httpd_suppress_version_string on | ||
+ | </ | ||
+ | |||
+ | Si queremos modificar el nombre del host a mostrar en el mensaje de error | ||
+ | |||
+ | < | ||
+ | visible_hostname mihostproxy | ||
+ | </ | ||
+ | |||
+ | Enlace interesante: | ||
+ | |||
+ | |||
+ | === Información en tiempo real === | ||
+ | |||
+ | |||
+ | Por medio del objeto < | ||
+ | |||
+ | Ejemplo : | ||
+ | < | ||
+ | # telnet localhost 3128 | ||
+ | GET cache_object:// | ||
+ | HTTP/1.0 200 OK | ||
+ | Server: squid | ||
+ | Mime-Version: | ||
+ | Date: Fri, 15 Apr 2011 15:02:23 GMT | ||
+ | Content-Type: | ||
+ | Expires: Fri, 15 Apr 2011 15:02:23 GMT | ||
+ | Last-Modified: | ||
+ | X-Cache: MISS from proxybuenoaires | ||
+ | Via: 1.0 proxybuenoaires (squid) | ||
+ | Connection: close | ||
+ | |||
+ | Squid Object Cache: Version 3.1.11 | ||
+ | Start Time: Fri, 18 Mar 2011 23:11:52 GMT | ||
+ | Current Time: Fri, 15 Apr 2011 15:02:23 GMT | ||
+ | Connection information for squid: | ||
+ | Number of clients accessing cache: 34 | ||
+ | Number of HTTP requests received: | ||
+ | Number of ICP messages received: 0 | ||
+ | Number of ICP messages sent: 0 | ||
+ | Number of queued ICP replies: 0 | ||
+ | Number of HTCP messages received: 0 | ||
+ | Number of HTCP messages sent: 0 | ||
+ | Request failure ratio: 0.00 | ||
+ | Average HTTP requests per minute since start: 35.8 | ||
+ | Average ICP messages per minute since start: 0.0 | ||
+ | Select loop called: 161640210 times, 14.785 ms avg | ||
+ | Cache information for squid: | ||
+ | Hits as % of all requests: | ||
+ | Hits as % of bytes sent: | ||
+ | Memory hits as % of hit requests: | ||
+ | Disk hits as % of hit requests: | ||
+ | Storage Swap size: 0 KB | ||
+ | Storage Swap capacity: 0.0% used, 100.0% free | ||
+ | Storage Mem size: 112 KB | ||
+ | Storage Mem capacity: 0.0% used, 100.0% free | ||
+ | Mean Object Size: 0.00 KB | ||
+ | Requests given to unlinkd: 0 | ||
+ | Median Service Times (seconds) | ||
+ | HTTP Requests (All): | ||
+ | Cache Misses: | ||
+ | Cache Hits: 0.00000 | ||
+ | Near Hits: | ||
+ | Not-Modified Replies: | ||
+ | DNS Lookups: | ||
+ | ICP Queries: | ||
+ | Resource usage for squid: | ||
+ | UP Time: | ||
+ | CPU Time: | ||
+ | CPU Usage: | ||
+ | CPU Usage, 5 minute avg: 0.08% | ||
+ | CPU Usage, 60 minute avg: 0.15% | ||
+ | Process Data Segment Size via sbrk(): 24284 KB | ||
+ | Maximum Resident Size: 110864 KB | ||
+ | Page faults with physical i/o: 3 | ||
+ | Memory usage for squid via mallinfo(): | ||
+ | Total space in arena: | ||
+ | Ordinary blocks: | ||
+ | Small blocks: | ||
+ | Holding blocks: | ||
+ | Free Small blocks: | ||
+ | Free Ordinary blocks: | ||
+ | Total in use: 21574 KB 86% | ||
+ | Total free: 3649 KB 14% | ||
+ | Total size: 25224 KB | ||
+ | Memory accounted for: | ||
+ | Total accounted: | ||
+ | memPool accounted: | ||
+ | memPool unaccounted: | ||
+ | memPoolAlloc calls: 433622248 | ||
+ | memPoolFree calls: | ||
+ | File descriptor usage for squid: | ||
+ | Maximum number of file descriptors: | ||
+ | Largest file desc currently in use: 313 | ||
+ | Number of file desc currently in use: 277 | ||
+ | Files queued for open: 0 | ||
+ | Available number of file descriptors: | ||
+ | Reserved number of file descriptors: | ||
+ | Store Disk files open: 0 | ||
+ | Internal Data Structures: | ||
+ | 29 StoreEntries | ||
+ | 29 StoreEntries with MemObjects | ||
+ | 25 Hot Object Cache Items | ||
+ | 0 on-disk objects | ||
+ | </ | ||
+ | |||
+ | == Cache manager == | ||
+ | |||
+ | |||
+ | Para un manejo mas amigable de esta información tenemos el **Cache manager** de Squid, que es un componente que muestra estadísticas vía web del estado del servicio en tiempo real, como consultas DNS de determinada ip cliente, información del consumo de memoria, cpu, cache y mucho más. | ||
+ | |||
+ | |||
+ | Se componen de diferentes archivos | ||
+ | |||
+ | * **cachemgr.cgi** - Es la utilidad CGI que nos muestra los reportes vía web | ||
+ | * **cachemgr.conf** - Es el archivo de configuración principal del **Cache manager** | ||
+ | |||
+ | |||
+ | == Archivos de LOG == | ||
+ | |||
+ | * **/ | ||
+ | * En este archivo se registran todos los pedidos HTTP, siendo sus campos : | ||
+ | * timestamp de la recepción de la petición | ||
+ | * Tiempo transcurrido entre la petición y la recepción | ||
+ | * Dirección IP del cliente | ||
+ | * Código de resultado HTTP | ||
+ | * Cantidad de bytes entregados al cliente | ||
+ | * Método HTTP utilizado - GET, POST, CONNECT | ||
+ | * URL solicitada | ||
+ | * Si hay autenticación, | ||
+ | * Desde donde se resolvió la petición, DIRECT o desde un PARENT proxy | ||
+ | * Tipo de contenido mime | ||
+ | * **/ | ||
+ | * Mensajes informativos o de error sobre el cache interno de Squid | ||
+ | * **/ | ||
+ | * Información de los objetos que pasaron por el cache | ||
+ | * **/ | ||
+ | * Información general del proceso squidGuard | ||
+ | * **/ | ||
+ | * Información del filtrado de reglas de squidGuard | ||
===== Controles de acceso ===== | ===== Controles de acceso ===== | ||
Línea 323: | Línea 560: | ||
http_access allow mired → permito navegar si hay una coincidencia con la ACL mired \\ | http_access allow mired → permito navegar si hay una coincidencia con la ACL mired \\ | ||
+ | |||
+ | ==== Autenticacion ==== | ||
+ | |||
+ | Squid puede utilizar diferentes métodos de validación de usuarios, los mismo pueden ser independientes de Squid y se llamados por un helper. | ||
+ | |||
+ | |||
+ | |||
+ | Básicamente el helper nos devolvera **OK** ó **ERR** en base a la información que le hayamos proporcionado | ||
+ | |||
+ | === LDAP === | ||
+ | |||
+ | Ejemplo de configuración para un LDAP común | ||
+ | < | ||
+ | auth_param basic program / | ||
+ | |||
+ | auth_param basic children 5 | ||
+ | auth_param basic realm Web-Proxy | ||
+ | auth_param basic credentialsttl 1 minute | ||
+ | |||
+ | acl ldap-auth proxy_auth REQUIRED | ||
+ | |||
+ | http_access allow ldap-auth | ||
+ | http_access allow localhost | ||
+ | http_access deny all | ||
+ | </ | ||
+ | |||
+ | === ActiveDirectory W2003 - LDAP === | ||
+ | |||
+ | < | ||
+ | auth_param basic program / | ||
+ | </ | ||
+ | |||
+ | ==== Permisos ==== | ||
+ | |||
+ | === Permisos especiales === | ||
+ | |||
+ | |||
+ | == Bloquear MSN apto para 7 y 8 == | ||
+ | |||
+ | MSN Messenger 7 y MSN 8 tienen a buscar por todo lados como conectarse, entonces esto se vuelve algo medio problematico con Squid y mas cuando tenemos muchos grupos LDAP configurados y queremos que algunos si puedan acceder etc. Mi solución por el momento es : | ||
+ | |||
+ | < | ||
+ | acl MSN_Method method POST | ||
+ | acl MSN_Agent browser ^Mozilla.compatible; | ||
+ | acl MSN_Agent browser ^Mozilla/ | ||
+ | acl MSN_Mime req_mime_type ^application/ | ||
+ | acl MSN_Port port 1863 | ||
+ | acl MSN_Dom dstdom_regex -i messenger.hotmail.com 207.46.110.40 gateway.messenger.hotmail.com msn.com local-bay.contacts.msn.com messenger.live.com proxy-sn.contacts.msn.com proxy-bay.contacts.msn.com gateway.edge.messenger.live.com bay.messenger.services.live.com geo.messenger.services.live.com | ||
+ | acl MSN_Url url_regex -i gateway.dll sqmserver.dll ADSAdClient31.dll gateway.dll? | ||
+ | acl MSN_Usr | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | http_access | ||
+ | http_reply_access deny MSN_Agent MSN_Mime MSN_Dom MSN_Url !MSN_Usr | ||
+ | |||
+ | http_access | ||
+ | http_reply_access deny MSN_Method MSN_Url !MSN_Usr | ||
+ | |||
+ | http_access | ||
+ | http_reply_access deny CONNECT MSN_Port !MSN_Usr | ||
+ | </ | ||
+ | |||
+ | El reply acces es para forzar a que si o si se cumpla dicha condición, ya que podemos tener una gran cantidad de ACL's y algunas se pueden superponer, entonces con esto las forzamos. | ||
+ | |||
+ | |||
+ | |||
+ | == Delay pools == | ||
+ | |||
+ | Por ejemplo si tengo usuarios que abusan del uso de internet, dado el caso de que bajan una iso y la dejan horas agotando el ancho de banda, lo que podemos hacer con Squid, es que cuando llegen a un tope, por ejemplo 15MB el ancho de banda baje considerablemente para todo el segmento de red que pasa por squid. | ||
+ | |||
+ | |||
+ | |||
+ | Ejemplo si un usuario baja un archivo ISO, cuando llega a los 15MB la velocidad baja a 16k/s para todo el segmento | ||
+ | < | ||
+ | delay_pools | ||
+ | delay_class | ||
+ | delay_parameters | ||
+ | acl ficheros_iso | ||
+ | delay_access | ||
+ | </ | ||
+ | |||
+ | Se puede hacer tambien | ||
+ | |||
+ | **acl restringir url_regex -i "/ | ||
+ | < | ||
+ | \.ace$ | ||
+ | |||
+ | \.af$ | ||
+ | |||
+ | \.afx$ | ||
+ | |||
+ | \.arj$ | ||
+ | |||
+ | \.asf$ | ||
+ | |||
+ | \.asx$ | ||
+ | |||
+ | \.au$ | ||
+ | |||
+ | [...] | ||
+ | |||
+ | \.xla$ | ||
+ | |||
+ | \.xls$ | ||
+ | |||
+ | \.xlt$ | ||
+ | |||
+ | \.xlw$ | ||
+ | |||
+ | \.z$ | ||
+ | |||
+ | \.zip$ | ||
+ | |||
+ | youtube.com | ||
+ | </ | ||
+ | |||
+ | |||
+ | Delay pool clase 2 para afectar a usuarios individuales | ||
+ | |||
+ | < | ||
+ | delay_pools | ||
+ | delay_class | ||
+ | delay_parameters | ||
+ | delay_access | ||
+ | </ | ||
+ | |||
+ | Ejemplo de Delay pool por horarios | ||
+ | |||
+ | < | ||
+ | acl winupdate dstdomain .windowsupdate.com | ||
+ | acl peakperiod time 10:00-16:00 | ||
+ | delay_pools 1 | ||
+ | delay_class 1 1 | ||
+ | # 64 Kbit/s | ||
+ | delay_parameters 1 8000/8000 | ||
+ | delay_access 1 allow winupdate peakperiod | ||
+ | </ | ||
+ | |||
+ | Sacado de : http:// | ||
+ | |||
+ | |||
+ | Otros ejemplos de delay pools | ||
+ | |||
+ | < | ||
+ | # 157 kB/s | ||
+ | delay_pools 1 | ||
+ | delay_class 1 2 | ||
+ | delay_parameters 1 98304/ | ||
+ | delay_access 1 allow all ancho_de_banda | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # 8 kB/s | ||
+ | delay_pools 1 | ||
+ | delay_class 1 1 | ||
+ | delay_parameters 1 8192/8192 | ||
+ | delay_access 1 allow all ancho_de_banda | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # 32 kB/s | ||
+ | delay_pools 1 | ||
+ | delay_class | ||
+ | delay_parameters 1 32768/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # 50 kB/s | ||
+ | delay_pools 1 | ||
+ | delay_class | ||
+ | delay_parameters 1 65536/ | ||
+ | delay_access 1 allow all ancho_de_banda | ||
+ | </ | ||
+ | |||
+ | **Clases de Delay Pools** | ||
+ | |||
+ | * Clase 1 : Limita el ancho de banda total para todos los que sean afectados por el delay pool | ||
+ | * Clase 2 : Limita el ancho de banda total y por cada usuario | ||
+ | * Clase 3 : Limita en total, por usuario y por red | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === Filtrado === | ||
+ | |||
+ | Dentro del archivo **/ | ||
+ | |||
+ | < | ||
+ | redirect_program / | ||
+ | redirect_children 6 | ||
+ | </ | ||
+ | |||
+ | |||
+ | == Configuración de SquidGuard == | ||
+ | |||
+ | **/ | ||
+ | < | ||
+ | dbhome / | ||
+ | logdir / | ||
+ | |||
+ | destination bl_homerepair { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_gardening { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_culinary { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_porn { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | expressionlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_ringtones { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_whitelist { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_weapons { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_kidstimewasting { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_spyware { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_audio-video { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_webmail { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_financial { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_weather { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_childcare { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_virusinfected { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_chat { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_desktopsillies { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_searchengines { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_naturism { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_aggressive { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_clothing { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_ecommerce { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_marketingware { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_astrology { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_jobsearch { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_gambling { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_updatesites { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_ads { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | expressionlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_entertainment { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_cleaning { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_artnudes { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_vacation { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_sports { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_blog { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_religion { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_mixed_adult { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_frencheducation { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_pets { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_mobile-phone { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_mail { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_dating { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_guns { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_verisign { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_cellphones { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_beerliquorinfo { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_onlinepayment { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_government { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_drugs { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_beerliquorsale { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_hygiene { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_onlineauctions { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_warez { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_dialers { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_antispyware { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_adult { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_instantmessaging { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_news { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_socialnetworking { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_jewelry { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_filehosting { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_reaffected { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_phishing { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_medical { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_violence { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_personalfinance { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_sportnews { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_banking { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_sexuality { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_games { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_sect { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_onlinegames { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_hacking { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_shopping { | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_radio { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination bl_proxy { | ||
+ | urllist blacklists/ | ||
+ | domainlist blacklists/ | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | destination excepciones { | ||
+ | expressionlist excepciones.destexprlist | ||
+ | urllist excepciones.desturllist | ||
+ | domainlist excepciones.destdomainlist | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | destination Restricciones_a_mano { | ||
+ | urllist Restricciones_a_mano.desturllist | ||
+ | domainlist Restricciones_a_mano.destdomainlist | ||
+ | expressionlist Restricciones_a_mano.destexprlist | ||
+ | logfile squidguard.log | ||
+ | } | ||
+ | |||
+ | src admin { | ||
+ | ip | ||
+ | } | ||
+ | | ||
+ | |||
+ | acl { | ||
+ | default { | ||
+ | pass excepciones !denegados_a_mano !bl_audio-video !bl_proxy !bl_warez !bl_porn !bl_filehosting !bl_adult | ||
+ | redirect http:// | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | En el apartado **redirect** indicamos al squidGuard que nos muestre un contenido especial cuando intentamos acceder a ubicaciones filtradas. Cuando vemos **%u** nos referimos a la variable de url, y podemos obtenerla por medio de los datos GET | ||
+ | |||
+ | Otras variables que podemos exportar por GET son : | ||
+ | * **%a** La dirección IP del cliente | ||
+ | * **%i** El nombre de usuario del cliente | ||
+ | * **%n** Dominio al que se intento acceder | ||
+ | * **%p** Variable that holds the REQUEST_URI, | ||
+ | * **%s** Variable that holds the matched source group (client group) or " | ||
+ | * **%t** Variable that holds the matched destination group (target group) or " | ||
+ | * **%u** Variable that holds the requested URL. | ||
+ | |||
+ | |||
+ | |||
+ | == Blacklist == | ||
+ | |||
+ | |||
+ | Listado de sitios prohibidos organizados por categorias. A continuacion describimos cada unas de las mismas: | ||
+ | |||
+ | ^^Categoria^Descripcion^^ | ||
+ | |ads | ||
+ | |adult | ||
+ | |aggressive | ||
+ | |antispyware | ||
+ | |artnudes | ||
+ | |astrology | ||
+ | |audio-video | ||
+ | |banking | ||
+ | |beerliquorinfo | ||
+ | |beerliquorsale | ||
+ | |Blog | ||
+ | |cellphones | ||
+ | |chat | ||
+ | |childcare | ||
+ | |cleaning | ||
+ | |clothing | ||
+ | |culnary | ||
+ | |dating | ||
+ | |desktopsillies | ||
+ | |dialers | ||
+ | |drugs | ||
+ | |ecommerce | ||
+ | |entertainment | ||
+ | |filehosting | ||
+ | |frencheducation | ||
+ | |gambling | ||
+ | |games | ||
+ | |gardening | ||
+ | |government | ||
+ | |guns | ||
+ | |hacking | ||
+ | |homerepair | ||
+ | |hygiene | ||
+ | |instantmessaging | ||
+ | |jewelry | ||
+ | |jobsearch | ||
+ | |kidstimewasting | ||
+ | |mail | ||
+ | |marketingware | ||
+ | |medical | ||
+ | |mixed_adult | ||
+ | |naturism | ||
+ | |news | ||
+ | |onlineauctions | ||
+ | |onlinegames | ||
+ | |onlinepayment | ||
+ | |personalfinance | ||
+ | |pets | ||
+ | |phishing | ||
+ | |porn | ||
+ | |proxy | ||
+ | |radio | ||
+ | |religion | ||
+ | |ringtones | ||
+ | |searchengines | ||
+ | |sect | ||
+ | |sexuality | ||
+ | |shopping | ||
+ | |socialnetworking | ||
+ | |sportnews | ||
+ | |sports | ||
+ | |spyware | ||
+ | |updatesites | ||
+ | |vacation | ||
+ | |violence | ||
+ | |virusinfected | ||
+ | |warez | ||
+ | |weather | ||
+ | |weapons | ||
+ | |webmail | ||
+ | |whitelist | ||
+ | |||
+ | === Referencias === | ||
+ | |||
+ | ^^URL^Descripción^^ | ||
+ | |http:// | ||
+ | |http:// | ||
+ | |http:// | ||
+ | |http:// | ||
+ | |||
+ | ===== Balanceo de Carga y Alta Disponibilidad ===== | ||
+ | |||
+ | ==== LVS (Linux Virtual Server) + Heartbeat ==== | ||
+ | |||
+ | ==== Red Hat Cluster Suite ==== | ||
+ | |||
+ | Supongamos que tenemos dos servidores proxy 10.1.2.103 y 10.1.2.105 y ambos atienden por una ip virtual 10.1.2.106 | ||
+ | |||
+ | === LVS === | ||
+ | |||
+ | Configuracion de la utilidad IPVS de Linux Virtual Server | ||
+ | |||
+ | |||
+ | == / | ||
+ | |||
+ | |||
+ | < | ||
+ | -A -t 10.1.2.106: | ||
+ | -a -t 10.1.2.106: | ||
+ | -a -t 10.1.2.106: | ||
+ | </ | ||
+ | |||
+ | |||
+ | == ipvsadm -L == | ||
+ | |||
+ | < | ||
+ | IP Virtual Server version 1.2.1 (size=4096) | ||
+ | Prot LocalAddress: | ||
+ | -> RemoteAddress: | ||
+ | TCP lvs-proxy.cayu.com.ar: | ||
+ | -> proxy2.cayu.com.ar: | ||
+ | -> proxy1.cayu.com.ar: | ||
+ | </ | ||
+ | |||
+ | El sistema balancea por medio del algoritmo wlc. | ||
+ | |||
+ | === Piranha === | ||
+ | |||
+ | Piranha es un producto de clustering de Red Hat, incluye el demonio de control de LVS de Red Hat, y una herramienta de configuracion web del cluster. | ||
+ | |||
+ | La herramienta de monitoreo de piranha tiene dos caracteristicas principales : | ||
+ | |||
+ | |||
+ | * Soporte integrado de Heartbeat. | ||
+ | * Chequeo de disponibilidad de servicios en los servidores. | ||
+ | |||
+ | |||
+ | La herramienta de monitoreo de piranha usa el proceso heartbeat por medio de mensajes UDP entre los nodos balanceados y un servicio que se encarga de monitorear que ciertos procesos esten corriendo. | ||
+ | |||
+ | Configuracion de Piranha en el servidor primario | ||
+ | |||
+ | == / | ||
+ | |||
+ | |||
+ | <code java> | ||
+ | serial_no = 69 | ||
+ | primary = 10.1.2.103 | ||
+ | service = lvs | ||
+ | backup_active = 1 | ||
+ | backup = 10.1.2.105 | ||
+ | heartbeat = 1 | ||
+ | heartbeat_port = 539 | ||
+ | keepalive = 4 | ||
+ | deadtime = 18 | ||
+ | network = direct | ||
+ | debug_level = NONE | ||
+ | monitor_links = 0 | ||
+ | virtual proxy { | ||
+ | | ||
+ | | ||
+ | | ||
+ | port = 8080 | ||
+ | pmask = 255.255.255.0 | ||
+ | send = "GET cache_object:// | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Configuracion de Piranha en el servidor secundario | ||
+ | |||
+ | == / | ||
+ | |||
+ | |||
+ | <code java> | ||
+ | serial_no = 55 | ||
+ | primary = 10.1.2.103 | ||
+ | service = lvs | ||
+ | backup_active = 1 | ||
+ | backup = 10.1.2.105 | ||
+ | heartbeat = 1 | ||
+ | heartbeat_port = 539 | ||
+ | keepalive = 4 | ||
+ | deadtime = 18 | ||
+ | network = direct | ||
+ | debug_level = NONE | ||
+ | monitor_links = 0 | ||
+ | virtual proxy { | ||
+ | | ||
+ | | ||
+ | | ||
+ | port = 8080 | ||
+ | pmask = 255.255.255.0 | ||
+ | send = "GET cache_object:// | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Se agrego la configuracion para la interface virtual lo:0 / | ||
+ | < | ||
+ | DEVICE=lo:0 | ||
+ | IPADDR=10.1.2.106 | ||
+ | NETMASK=255.255.255.255 | ||
+ | # | ||
+ | # If you're having problems with gated making 127.0.0.0/8 a martian, | ||
+ | # you can change this to something else (255.255.255.255, | ||
+ | # | ||
+ | ONBOOT=yes | ||
+ | NAME=lvsIP | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
===== Referencias ===== | ===== Referencias ===== | ||
- | http:// | + | http:// |
- | http:// | + | http:// |
- | http://es.wikipedia.org/wiki/Squid_(programa) | + | http://wiki.squid-cache.org/ |
+ | http://wiki.squid-cache.org/ | ||
+ | |||
+ | http:// | ||
+ | --- // | ||
manuales/servidor_squid.txt · Última modificación: 2012/04/16 15:39 por cayu