marcio_subtil
(usa CentOS)
Enviado em 05/02/2014 - 09:39h
#
# Recommended minimum configuration:
#
# Squid normally listens to port 3128
http_port 3128
acl manager proto cache_object
#####################################################################################################
# tipo de cache (aufs), pasta raiz, tamanho em MB, diretorios pais, diretorios em cada diretorio
cache_dir aufs /var/spool/squid 8196 16 256
# Tamanho da cache para obejtos
cache_mem 512 MB
# Tamanho máximo dos objetos que serão salvos em disco
maximum_object_size 131070 KB
# Tamanho minimo dos objetos que serão salvos em disco
minimum_object_size 0 KB
# Número de entradas na tabela de cache de conversão de IP para FQDN
ipcache_size 16384
# Percentagem de cache baixa - padrão 90
ipcache_low 90
# Percentagem de cache baixa - padrão 95
ipcache_high 95
# manter memória alocada e não usada, para não precisar realocar quando for usar
memory_pools on
# Número de entradas na tabela de cache de DNS
fqdncache_size 16384
# tamanho máximo dos objetos guardados na cache
maximum_object_size_in_memory 8 MB
# Gerar resumo de cache - Ãil somente quando existem squids parceiros deste squid
digest_generation off
# Configurações gerais
# Como tratar o X-Forwared-For no cabeçalho HTTP
forwarded_for off
#logar parametros das URL's
strip_query_terms on
# Força IE 5.5 ou anteior a buscar novas páginas do servido em caso de refresh
ie_refresh on
#Detecta respostas quebradas de conexões persistnes e assuma que o reply foi enviado apos 10 segundos
detect_broken_pconn on
#Tenta executar até 2 requisições em paralelo - Pode quebrar autenticação NTLM/Kerberos
pipeline_prefetch off
# Continua baixando requisições abortadas
quick_abort_min -1 KB
# continua baixando requsições abortadas até o limite de 16KB
quick_abort_max 16 KB
# Quanto tempo manter cache de DNS
positive_dns_ttl 5 minute
# Fechar conexões TCP imediatamente
half_closed_clients off
# timeout de leitura de dados
read_timeout 240 second
# timeout de conexões persistentes
pconn_timeout 240 second
# para agaurdar o fechamento de conexçoes durante encerramento do squid
shutdown_lifetime 1 second
# palavras que será tratadas diretamente por esse squid, ou seja, não serão repassadas para vizinhos
hierarchy_stoplist cgi-bin ?
#####################################################################################################
#add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
######################################################
refresh_pattern -i http.*\.sefaz.*/.* 720 100% 10080 reload-into-ims
refresh_pattern -i http.*\.gov.br/.* 720 100% 7200 reload-into-ims
refresh_pattern -i http.*\.globo.com/.* 720 100% 7200 reload-into-ims
refresh_pattern -i http.*\.terra.com.br/.* 720 100% 7200 reload-into-ims
refresh_pattern -i http.*\.google.*/.* 720 100% 10080 reload-into-ims
refresh_pattern -i http.*\.msn.*/.* 720 100% 10080 reload-into-ims
refresh_pattern -i http.*\.uol.com.*/.* 720 100% 10080 reload-into-ims
refresh_pattern -i http.*\.bol.com.*/.* 720 100% 10080 reload-into-ims
refresh_pattern -i http.*\.lyricsplugin.com.*/.* 720 100% 10080 reload-into-ims
#################################################################################
# Email do administrador
# Host visÃvel
# Linguagem dos erros
error_directory /usr/share/squid/errors/pt-br
# Evita que sejam feitos coredumps.
coredump_dir /var/spool/squid
# Numero de arquivos de log rotacionados a guardar.
logfile_rotate 120
# Logs
#logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %# Log de acesso
access_log /var/log/squid/access.log
# Log de cache
cache_log /var/log/squid/cache.log
# comportamente para espaço em branco nas URLs
uri_whitespace allow
# portas seguras
acl SSL_ports port 443
acl SSL_ports port 8180
acl SSL_ports port 8443
# Demais serviços
acl Safe_ports port 80 # http
acl Safe_ports port 81 # http
acl Safe_ports port 20-21 # ftp
acl Safe_ports port 70 # gopher
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 210 # wais
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 # SWATx
acl Safe_ports port 8017 #sefaz MT
acl Safe_ports port 8080 # http
acl Safe_ports port 8081 # http
acl Safe_ports port 8082 # http
acl Safe_ports port 8088 # http
acl Safe_ports port 8180 # http
acl Safe_ports port 3456 # receita federal - irpf
acl Safe_ports port 3001 # diario oficial
acl Safe_ports port 800 # Squid (for icons)
acl Safe_ports port 8085 # sti
acl Safe_ports port 1000 # clinipam
acl Safe_ports port 8443 # guanabara
acl Safe_ports port 3050 # sefaz mg
#acl Safe_ports port 4110 # sefaz mt
#acl Safe_ports port 4095 # sefaz mt
acl CONNECT method CONNECT
acl purge method PURGE
acl POST method POST
######################################################
#NTLM
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp
auth_param ntlm children 5
auth_param ntlm keep_alive on
auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic
auth_param basic children 5
auth_param basic realm Squid - Digite suas credenciais
auth_param basic credentialsttl 5 hours
###################### Libera office 365 ###############################
acl office_365_site url_regex -i "/etc/squid/acls/office/office_365_site"
acl office_365_dominio dstdomain -i "/etc/squid/acls/office/office_365_dominio"
acl office_365_ip dst "/etc/squid/acls/office/office_365_ip"
http_access allow office_365_ip
http_access allow office_365_site
http_access allow office_365_dominio
######################## Fim office 365 ################################
# acl para obter grupos do AD
external_acl_type grupo_AD ttl=60 %LOGIN /usr/lib64/squid/wbinfo_group.pl
# Grupos do AD
acl acesso_completo external grupo_AD Internet_Acesso_Allow
acl acesso_padrao external grupo_AD Internet_Acesso_Default
acl acesso_bloqueado external grupo_AD Internet_Acesso_Bloqueado
#########################################################
acl ntlm proxy_auth REQUIRED
#http_access allow ntlm
######################################################
acl gtalk dstdomain chatenabled.mail.google.com
http_access deny gtalk
# Bloqueia acesso ao gtalk (goolge)
acl BLOCKTALK url_regex -i mail.google.com/mail/channel/bind
http_access deny BLOCKTALK
# Regra para bloqueio de extensões de rádios online / arquivos de streaming:
acl streaming req_mime_type ^video/x-ms-asf
acl proibir_musica urlpath_regex -i \.aif$ \.aifc$ \.aiff$ \.asf$ \.asx$ \.avi$ \.au$ \.m3u$ \.med$ \.mp3$ \.m1v$ \.mp2$ \.mp2v$ \.mpa$ \.mov$ \.mpe$ \.mpg$ \.mpeg$ \.ogg$ \.pls$ \.ram$ \.ra$ \.ram$ \.snd$ \.wma$ \.wmv$ \.wvx$ \.mid$ \.midi$ \.rmi$
http_access deny proibir_musica
http_reply_access deny streaming
acl extensoes url_regex -i .exe .mp3 .vqf .tar.gz .gz .rpm .zip .rar .avi .mpeg .mpe .mpg .qt .ram .rm .iso .raw .wav .mov .asf .pdf .doc .xls .docx .xlsx .ppt .pptx .pps .ppsx
# Libera alguns sites
acl sites url_regex -i "/etc/squid/acls/sites"
#acl controlar sites (sites-proibidos)
acl sites_proibidos url_regex -i "/etc/squid/acls/sites_proibidos/sites_proibidos"
acl sites_liberados dstdomain -i "/etc/squid/acls/sites_liberados/sites_liberados"
# acl controlar palavras de sexo, baixo calão, etc
acl palavras_proibidas url_regex -i "/etc/squid/acls/palavras_proibidas/palavras_proibidas"
acl palavras_liberadas url_regex -i "/etc/squid/acls/palavras_liberadas/palavras_liberadas"
acl maquinas_proibidas src "/etc/squid/acls/maquinas_proibidas/maquinas_proibidas"
acl maquinas_liberadas src "/etc/squid/acls/maquinas_liberadas/maquinas_liberadas"
# libera método POST sem autenticação. Para evitar problemas
http_access allow POST
http_access allow sites
http_access allow rede_ampla acesso_padrao palavras_liberadas !palavras_proibidas
http_access allow rede_ampla acesso_completo
http_access deny acesso_bloqueado !office_365_site !office_365_dominio !office_365_ip
# regras das acls de portas - bloqueia todas as portas não listadas
http_access deny !Safe_ports
# bloqueia conexões das portas seguras não listadas
http_access deny purge
# HTTP REPLY ACCESS
http_reply_access allow all
http_access deny all
# ICP ACCESS
icp_access deny all
# MISS ACCESS
miss_access allow rede_ampla
miss_access deny all
# Negar cache de cgi-bin
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
# negar cache de POST
acl POSTS method POST
cache deny POSTS
delay_pools 1
delay_class 1 2
delay_parameters 1 -1/-1 15000/25000
delay_access 1 allow extensoes