notas:squid
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| notas:squid [2010/03/29 15:24] – cayu | notas:squid [2018/11/27 13:58] (actual) – [Formato de LOG] cayu | ||
|---|---|---|---|
| Línea 9: | Línea 9: | ||
| ===== Delay pools ===== | ===== 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 | + | 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 |
| - | + | Ejemplo si un usuario baja un archivo ISO, cuando llega a los 15MB la velocidad baja a 16k/s para todo el segmento | |
| - | Ejemplo si un usuario baja un archivo ISO, cuando llega a los 15MB la velocidad baja a 16k/s | + | |
| < | < | ||
| delay_pools | delay_pools | ||
| Línea 54: | Línea 53: | ||
| \.zip$ | \.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 | ||
| + | </ | ||
| + | |||
| + | |||
| + | Ejemplo de dos proxys hermanos (sibling) | ||
| + | |||
| + | **squid.conf** | ||
| + | < | ||
| + | include squid-peers.conf | ||
| + | </ | ||
| + | |||
| + | // | ||
| + | |||
| + | < | ||
| + | cache_peer 10.1.1.2 | ||
| + | cache_peer 192.168.1.2 | ||
| + | cache_peer 192.168.1.3 | ||
| + | </ | ||
| + | |||
| + | // | ||
| + | |||
| + | < | ||
| + | cache_peer 10.1.1.3 | ||
| + | cache_peer 192.168.1.3 | ||
| + | cache_peer 192.168.1.2 | ||
| + | </ | ||
| ===== Bloquear MSN apto para 7 y 8 ===== | ===== Bloquear MSN apto para 7 y 8 ===== | ||
| Línea 62: | Línea 144: | ||
| < | < | ||
| - | acl MSN_Method | + | acl MSN_Method |
| - | acl MSN_Agent | + | acl MSN_Agent |
| - | acl MSN_Agent | + | acl MSN_Agent |
| - | acl MSN_Mime | + | acl MSN_Mime |
| - | acl MSN_Port | + | acl MSN_Port |
| - | acl MSN_Dom | + | acl MSN_Dom |
| - | acl MSN_Url | + | acl MSN_Url |
| acl MSN_Usr | acl MSN_Usr | ||
| </ | </ | ||
| Línea 86: | Línea 168: | ||
| - | ===== Blacklist | + | ===== Autenticacion NTLM ===== |
| + | Para conocer el estado de una cuenta podemos ejecutar | ||
| + | < | ||
| + | # wbinfo -a [domain]\\[user]%[password] | ||
| + | plaintext password authentication failed | ||
| + | error code was NT_STATUS_ACCOUNT_LOCKED_OUT (0xc0000234) | ||
| + | error messsage was: Account locked out | ||
| + | Could not authenticate user GRUPODERED\soporte%Password1234 with plaintext password | ||
| + | challenge/ | ||
| + | error code was NT_STATUS_ACCOUNT_LOCKED_OUT (0xc0000234) | ||
| + | error messsage was: Account locked out | ||
| + | Could not authenticate user GRUPODERED\soporte with challenge/ | ||
| + | </ | ||
| + | |||
| + | Para ver la lista de usuarios del dominio | ||
| + | |||
| + | < | ||
| + | # wbinfo -u | ||
| + | </ | ||
| + | |||
| + | ===== Blacklist ===== | ||
| Listado de sitios prohibidos organizados por categorias. A continuacion describimos cada unas de las mismas: | Listado de sitios prohibidos organizados por categorias. A continuacion describimos cada unas de las mismas: | ||
| - | ^^Categoria^Descripcion^^ | + | ^Categoria^Descripcion^ |
| |ads | |ads | ||
| |adult | |adult | ||
| Línea 163: | Línea 265: | ||
| |webmail | |webmail | ||
| |whitelist | |whitelist | ||
| - | |||
| === Referencias === | === Referencias === | ||
| - | + | ^URL^Descripción^ | |
| - | ^^URL^Descripción^^ | + | |
| |http:// | |http:// | ||
| |http:// | |http:// | ||
| Línea 172: | Línea 272: | ||
| |http:// | |http:// | ||
| + | ===== Formato de LOG ===== | ||
| + | |||
| + | == Cambiar formato de logs == | ||
| + | |||
| + | Agregar la directiva // | ||
| + | |||
| + | == time.sh == | ||
| + | |||
| + | //Script a cual por medio de una pipe se le envia el access.log, lo analiza y nos interpreta el formato de fecha// **UNIX** //a formato de fecha// **Human Readable** :-P. | ||
| + | <code bash> | ||
| + | cat access.log | perl -p -e ' | ||
| + | </ | ||
| + | Otra opción : | ||
| + | <code perl> | ||
| + | # | ||
| + | |||
| + | s/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | Enlace interesante: | ||
| + | |||
| + | ===== 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: | ||
| + | |||
| + | ===== Script para ver los top sites ===== | ||
| + | |||
| + | <code perl> | ||
| + | # | ||
| + | ## | ||
| + | ## Squid Top Sites reporting script. | ||
| + | ## | ||
| + | ## Description: | ||
| + | ## This script will parse the specified squid logfile and count up the | ||
| + | ## | ||
| + | ## sites. | ||
| + | ## | ||
| + | ## Author: | ||
| + | ## Dave Hope - http:// | ||
| + | ## Sava Chankov ( Author of squid-report.pl ) | ||
| + | ## | ||
| + | ## Known Issues: | ||
| + | ## + Requests to the webserver on the proxy give weird results? | ||
| + | ## | ||
| + | ## Changelog: | ||
| + | ## | ||
| + | ## 1.0.1 | ||
| + | ## + Changed to have configuration held in-file. | ||
| + | ## + Removed last-visited date. | ||
| + | ## + Consolidated sites with/ | ||
| + | ## + Improved UI slightly. | ||
| + | ## 1.0.2 | ||
| + | ## + Fixed issue with accessing on ports other than 80. | ||
| + | ## + Fixed promblem with ftp:// entries in log. | ||
| + | ## | ||
| + | ## 1.2.0 | ||
| + | ## + Added ability to sort by size, rather than frequency. | ||
| + | ## | ||
| + | ## License: | ||
| + | ## This program is free software; you can redistribute it and/or modify it | ||
| + | ## under the GNU General Public License. | ||
| + | ## | ||
| + | ## This script is based on ' | ||
| + | ## been adjusted for my specific requirements. | ||
| + | ## | ||
| + | ## The original script can be found here: | ||
| + | ## | ||
| + | ## | ||
| + | |||
| + | use strict; | ||
| + | |||
| + | ## | ||
| + | # Configuration. | ||
| + | ## | ||
| + | my $cfgNumberToShow = 250; | ||
| + | my $cfgLog = "/ | ||
| + | my $cfgOutput = "/ | ||
| + | |||
| + | # by_times_visited_then_name or by_size_then_name | ||
| + | my $cfgSortMethod = " | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Stop editing here unless you know what you're doing. | ||
| + | ## | ||
| + | my $cfgDate = gmtime; | ||
| + | my $row; | ||
| + | my($epoch_time_miliseconds, | ||
| + | my($unknown_integer2, | ||
| + | my($site_url, | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Open output file | ||
| + | ## | ||
| + | open(OUTPUT, | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Print header HTML | ||
| + | ## | ||
| + | print OUTPUT << | ||
| + | < | ||
| + | <html xmlns=" | ||
| + | <head profile=" | ||
| + | < | ||
| + | <meta http-equiv=" | ||
| + | <style type=" | ||
| + | <!-- | ||
| + | body { font: normal 1.0em ' | ||
| + | ul { list-style-type: | ||
| + | ul a { position: absolute; left: 150px } | ||
| + | # | ||
| + | #Footer { color: #cecece; line-height: | ||
| + | --> | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | <p id=" | ||
| + | <ul> | ||
| + | END | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Iterate through lines inaccess.log | ||
| + | ## | ||
| + | open(LOG, " | ||
| + | | ||
| + | while(< | ||
| + | { | ||
| + | $row = $_; | ||
| + | |||
| + | ($epoch_time_miliseconds, | ||
| + | |||
| + | # Not checking for http:// etc because we want to include CONNECT' | ||
| + | # multi-protocol data. | ||
| + | $url =~ s/ | ||
| + | $url =~ s/ | ||
| + | $url =~ s/www.//; | ||
| + | $url =~ s/\/$//; | ||
| + | |||
| + | # If the url is empty (which occurs occasionally in my logs, no idea | ||
| + | # why, then don't add it to the list. | ||
| + | if (!$url ) | ||
| + | { | ||
| + | next; | ||
| + | } | ||
| + | |||
| + | # Patern match data between slashes. | ||
| + | ($site_url) = ($url =~ m{ ([A-Za-z0-9.\-: | ||
| + | |||
| + | # Only match html content. | ||
| + | if($content_type =~ m{text/ | ||
| + | { | ||
| + | # If hash already contains an entry for the exact URL. | ||
| + | if ($sites{$site_url}) | ||
| + | { | ||
| + | | ||
| + | } | ||
| + | # If no matching entry exists, create one. | ||
| + | else | ||
| + | { | ||
| + | $sites{$site_url}-> | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # Update size of content for website regardless of content-type. | ||
| + | if (!$sites{$site_url}-> | ||
| + | { | ||
| + | $sites{$site_url}-> | ||
| + | } | ||
| + | $sites{$site_url}-> | ||
| + | } | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Iterate through visited sites. | ||
| + | ## | ||
| + | foreach $site_url ( sort ($cfgSortMethod keys (%sites) ) ) | ||
| + | { | ||
| + | # Only show top x entries. | ||
| + | if ($cfgNumberToShow > 0) | ||
| + | { | ||
| + | if ($cfgSortMethod eq " | ||
| + | { | ||
| + | print OUTPUT " | ||
| + | } | ||
| + | elsif ($cfgSortMethod eq " | ||
| + | { | ||
| + | print OUTPUT " | ||
| + | } | ||
| + | |||
| + | $cfgNumberToShow--; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Print Footer HTML | ||
| + | ## | ||
| + | print OUTPUT << | ||
| + | </ | ||
| + | <div id=" | ||
| + | </ | ||
| + | </ | ||
| + | END | ||
| + | |||
| + | |||
| + | ## | ||
| + | # Sort sites by frequency visited, then alphabetically. | ||
| + | ## | ||
| + | sub by_times_visited_then_name { | ||
| + | $sites{$b}-> | ||
| + | || | ||
| + | $a cmp $b | ||
| + | } | ||
| + | |||
| + | ## | ||
| + | # Sort by size, then alphabetically. | ||
| + | ## | ||
| + | sub by_size_then_name { | ||
| + | $sites{$b}-> | ||
| + | || | ||
| + | $a cmp $b | ||
| + | } | ||
| + | |||
| + | # | ||
| + | # Version: 1.0 | ||
| + | # Copyright: Bryant H. McGill - 11c Lower Dorset Street, Dublin 1, Ireland | ||
| + | # Web Address: http:// | ||
| + | # Use Terms: Free for non-commercial use, commercial use with notification. | ||
| + | # | ||
| + | # Legal: This code is provided "as is" without warranty of any kind. | ||
| + | # The entire risk of use remains with the recipient. | ||
| + | # In no event shall Bryant McGill be liable for any direct, | ||
| + | # consequential, | ||
| + | # | ||
| + | sub format_size{ | ||
| + | my($bytes) = @_; | ||
| + | |||
| + | return '' | ||
| + | |||
| + | my($size); | ||
| + | $size = $bytes . ' Bytes' if ($bytes < 1024); | ||
| + | $size = sprintf(" | ||
| + | $size = sprintf(" | ||
| + | $size = sprintf(" | ||
| + | $size = sprintf(" | ||
| + | |||
| + | return $size; | ||
| + | } | ||
| + | </ | ||
notas/squid.1269876259.txt.gz · Última modificación: 2010/03/29 15:24 por cayu
