Enviado em 11/04/2016 - 08:54h
Tudo bem com vocês Pessoal?#CONFIGURACAO SQUID3
#BY AUGUSTO
http_port 3128
visible_hostname Servidor-Atacado
##################### CACHE ###########################
cache_mem 512 MB
maximum_object_size_in_memory 128 KB
maximum_object_size 128 MB
minimum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /var/spool/squid3 2048 16 256
logformat squid3 %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %un %Sh/%<A %mt
cache_access_log /var/log/squid3/access.log
cache_mgr suporte@cndatacado.com.br
error_directory /usr/share/squid3/errors/pt-br
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280
#CACHE WINDOWS UPDATE
refresh_pattern -i update.microsoft.com/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip|dsft) 4320 80% 432000 reload-into-ims
refresh_pattern -i microsoft.com/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip|dsft) 4320 80% 432000 reload-into-ims
refresh_pattern -i windowsupdate.com/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip|dsft) 4320 80% 432000 reload-into-ims
refresh_pattern -i windows.com/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip|dsft) 4320 80% 432000 reload-into-ims
refresh_pattern -i c2r.microsoft.com/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip|dsft) 4320 80% 432000 reload-into-ims
refresh_pattern -i download.windowsupdate.com/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip|dsft) 4320 80% 432000 reload-into-ims
# FIM CACHE WINDOWS
##################### FIM #############################
############# AUTENTICACAO DOS USUARIOS ###############
auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/passwd
auth_param basic children 10
auth_param basic realm Digite seu login e senha para acessar a Internet!
auth_param basic credentialsttl 3 hours
auth_param basic casesensitive on
####################### FIM ###########################
############# PORTAS SEGURAS PARA O PROXY #############
acl SSL_ports port 443 563 873 # https
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 407 # msn
acl Safe_ports port 25 # smtp
acl Safe_ports port 110 # pop
######################### FIM ########################
################## ACLs DE AUTETICACAO ###############
acl usuarios proxy_auth REQUIRED
acl usuarios proxy_auth "/etc/squid3/passwd"
acl usuarios_full proxy_auth "/etc/squid3/full"
acl usuarios_diretoria proxy_auth "/etc/squid3/diretoria"
acl usuarios_suporte proxy_auth "/etc/squid3/suporte"
acl usuarios_operacional proxy_auth "/etc/squid3/operacional"
acl usuarios_adm proxy_auth "/etc/squid3/administracao"
###################### FIM ############################
########## REGRAS PARA CONTROLE DE ACESSO #############
acl sexo_regex url_regex -i "/etc/squid3/listas/sexo_regex"
acl extensoes urlpath_regex -i "/etc/squid3/listas/extensoes"
acl redes_sociais_regex url_regex -i "/etc/squid3/listas/redes_sociais_regex"
acl stream_regex url_regex -i "/etc/squid3/listas/stream_regex"
#acl skype url_regex -i "/etc/squid3/skype"
acl windowsupdate dstdomain .microsoft.com .windowsupdate.com c2r.microsoft.com download.windowsupdate.com windows.com update.microsoft.com
acl sexo dstdomain "/etc/squid3/listas/sexo"
acl redes_sociais dstdomain "/etc/squid3/listas/redes_sociais"
acl diversos dstdomain "/etc/squid3/listas/diversos"
acl stream dstdomain "/etc/squid3/listas/stream"
####################### FIM ##########################
acl CONNECT method CONNECT
acl lan src 192.168.101.0/24
######## ACL QUE CRIAM GRUPO E NIVEL DE ACESSO #######
http_access allow windowsupdate
#http_access allow skype
http_access allow usuarios_full !sexo !sexo_regex
http_access allow usuarios_diretoria !sexo !extensoes
http_access allow usuarios_suporte !sexo !sexo_regex
http_access allow usuarios_operacional !sexo !sexo_regex !extensoes !redes_sociais !redes_sociais_regex !stream !stream_regex
http_access allow usuarios_adm !sexo !sexo_regex !extensoes !stream !stream_regex
######################## FIM ##########################
################### ACLs PADRAO #######################
http_access allow manager localhost
http_access allow localhost
http_access allow lan
http_access deny CONNECT !SSL_ports
http_access deny !Safe_ports
http_access deny manager
######################## FIM ##########################
################### CONTROLE DE BANDA #################
acl limite_20k src "/etc/squid3/limite_20k"
delay_pools 2
delay_class 1 2
delay_access 1 allow limite_20k
delay_access 2 2
delay_access 2 allow lan
delay_parameters 1 -1/-1 20000/20000
delay_parameters 2 -1/-1 32000/32000
######################## FIM ##########################
######### Se nao se enquadra em nada Nega tudo ########
http_access deny all
################### FIM DA CONFG SQUID3 ###############
#!/bin/sh
modprobe iptable_nat
iptables -F
iptables -t nat -F
iptables -X
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -i eth2 --dport 80 -j REDIRECT --to 3128