silva_carlos
(usa Debian)
Enviado em 28/05/2013 - 12:53h
# Porta que aceitara requisicoes:
http_port 3128 transparent
# Mensagens de erro:
error_directory /usr/share/squid3/errors/Portuguese
# Nome do servidor configurado nas mensagens de erro
visible_hostname proxy-camanor
# Configuracoes do cache
cache_mem 128 MB
maximum_object_size_in_memory 128 KB
maximum_object_size 750 MB
minimum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
request_body_max_size 0 KB
# Espaco maximo utilizado para cache de disco (10gb):
cache_dir ufs /var/spool/squid3 10000 16 256
cache_access_log /var/log/squid3/access.log
cache_log /var/log/squid3/cache.log
cache_store_log /var/log/squid3/store.log
emulate_httpd_log on
# Mantem no cache objetos referenciados mais recentemente
cache_replacement_policy lru
memory_replacement_policy lru
# Opcoes DEFAULT do squid:
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
#acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/32
# Rede interna
acl rede_interna src 192.168.0.0/16
# Proxy autenticado
# Autenticacao de usuarios no PDC Windows 2008 Server
# authenticate_program /usr/sbin/smb_auth -W ESCRITORIO -U 192.168.
# auth_param basic program /usr/sbin/smb_auth -W ESCRITORIO -U 192.168.
# auth_param basic children 5
# auth_param basic realm teste: Todos os acessos sao monitorados.
# auth_param basic credentialsttl 2 hours
# acl autenticados proxy_auth REQUIRED
# Opcoes DEFAULT do squid (continuacao...)
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
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 CONNECT method CONNECT
# ACL's de controle de acesso
acl full_desktops_mac arp "/etc/squid3/full_desktops_mac"
acl full_desktops src "/etc/squid3/full_desktops"
acl good_sites dstdom_regex -i "/etc/squid3/good_sites"
acl bad_desktops_mac arp "/etc/squid3/bad_desktops_mac"
acl bad_desktops src "/etc/squid3/bad_desktops"
acl bad_downloads urlpath_regex -i "/etc/squid3/bad_downloads"
acl bad_sites dstdom_regex -i "/etc/squid3/bad_sites"
acl bad_subsites url_regex -i "/etc/squid3/bad_subsites"
acl bad_words urlpath_regex -i "/etc/squid3/bad_words"
# Opcoes DEFAULT do squid (continuacao...)
http_access allow localhost
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# Acoes referentes as ACL's de controle de acesso
http_access allow full_desktops_mac
http_access allow full_desktops
http_access allow good_sites
http_access deny bad_desktops_mac
http_access deny bad_desktops
http_access deny bad_downloads
http_access deny bad_sites
http_access deny bad_subsites
http_access deny bad_words
# http_access allow autenticados
http_access allow rede_interna
http_access deny all
http_reply_access allow all
icp_access allow all
coredump_dir /var/spool/squid3
#sqstat
acl manager proto cache_object
# replace 192.168.1.0 with your webserver IP
acl webserver src
http_access allow manager webserver
http_access deny manager
Regra de firewall: #!/bin/sh
# Limpando
iptables -F FORWARD
iptables -t nat -F
#Liberando receita.fazenda.gov.br:
iptables -A FORWARD -d 161.148.231.100 -j ACCEPT
# Liberando acesso a internet apenas para nossas redes
iptables -A FORWARD -s 192.168.0.0/16 -j ACCEPT
iptables -A FORWARD -d 192.168.0.0/16 -j ACCEPT
# Conectividade Social - Ainda não necessário
#iptables -A FORWARD -d 200.252.47.237 -s 192.168.4.0/24 -j ACCEPT
#iptables -A FORWARD -d 200.252.47.234 -s 192.168.4.0/24 -j ACCEPT
# Bloqueando o restante
iptables -P FORWARD DROP
# Proxy
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -s 192.168.4.0/24 -j DNAT --to-destination 192.168..:3128
# NAT
iptables -t nat -A POSTROUTING -o eth1 -s 192.168../24 -j MASQUERADE
# Port forwarding
# TS
#iptables -t nat -A PREROUTING -p tcp --dport 3389 -d -j DNAT --to-destination...:3389
Estou utilizando o csf com um script do iptables, rodo o firewall dentro dele.