marcosvinicius12
(usa Ubuntu)
Enviado em 01/08/2013 - 14:38h
Olá galera, seguinte
Preciso liberar o acesso dos clientes de email e nao estou conseguindo
Segue as configuracoes do Firewall e do Squid
Meu Firewall
#!/bin/bash
#Variaveis
MODPROBE="/sbin/modprobe"
IPTABLES="/sbin/iptables"
LOGS="/var/log/firewall.log"
#Interfaces#
#Interface para a internet
WAN="eth0"
IP_WAN="IP_WAN"
#Interface para rede Interna
LOCAL="eth1"
IP_LOCAL="192.168.254.1"
#Interface LO
IF_LO="lo"
IP_LO="127.0.0.1"
################################################################################
#Inicio das funcoes
#Regra padrao para o firewall
politica_padrao()
{
${IPTABLES} -P INPUT ACCEPT
${IPTABLES} -P OUTPUT ACCEPT
}
#Funcao para regras de INPUT
###############################################################################
# REGRAS PARA INPUT
###############################################################################
regras_input()
{
#Coloca Firewall em STATEFULL
${IPTABLES} -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#Libera o acesso da maquina local (LO)
${IPTABLES} -A INPUT -d $IP_LO -j ACCEPT
#Libera acesso a internet atraves do proxy
${IPTABLES} -A INPUT -p tcp -i $LOCAL --dport 3128 -j ACCEPT
#Libera conexao remota via SSH
${IPTABLES} -I INPUT -i $WAN -p tcp --dport 22 -j LOG --log-prefix "Acesso via SSH EXT"
${IPTABLES} -A INPUT -i $WAN -p tcp --dport 22 -j ACCEPT
${IPTABLES} -I INPUT -i $LOCAL -p tcp --dport 22 -j LOG --log-prefix "Acesso via SSH LOCAL"
${IPTABLES} -A INPUT -i $LOCAL -p tcp --dport 22 -j ACCEPT
}
##############################################################################
# Regras para FORWARD
##############################################################################
regras_forward()
{
${IPTABLES} -A FORWARD -p tcp --dport 110 -j ACCEPT
${IPTABLES} -A FORWARD -p udp --dport 587 -j ACCEPT
${IPTABLES} -A FORWARD -p tcp --dport 143 -j ACCEPT
${IPTABLES} -A FORWARD -p udp --dport 465 -j ACCEPT
${IPTABLES} -A FORWARD -p tcp --dport 993 -j ACCEPT
}
#regras_output()
#{
#
#}
###############################################################################
# Regars para PREROUTING
###############################################################################
regras_prerouting()
{
#Direciona as requisicoes das portas 80 e 443 para o squid
${IPTABLES} -t nat -A PREROUTING -i $LOCAL -p tcp -m multiport --dport 80 -j REDIRECT --to-port 3128
${IPTABLES} -t nat -A PREROUTING -i $LOCAL -p tcp -m multiport --dport 443 -j REDIRECT --to-port 3128
}
Meu Squid:
http_port 3128
visible_hostname servidor
cache_mgr wemaster@localhost
#Diretorio de pagina de erro
error_directory /usr/share/squid/errors/pt-br
#Cache
hierarchy_stoplist cgi-bin ?
cache_mem 700 MB
maximum_object_size_in_memory 64 KB
maximum_object_size 100 MB
#Local do Cache
cache_dir ufs /var/spool/squid 2048 16 256
#Tempo de vida cache - Proxy atualiza
refresh_pattern ^ftp: 360 20% 10080
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
#Log Proxy
access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
#ACLS
acl localhost src 127.0.0.1/32
acl localnet src 192.168.0.0/24
acl manager proto cache_object
http_access allow manager localhost
http_access deny manager
acl purge method PURGE
http_access allow purge localhost
http_access deny purge
acl Safe_ports port 21 # ftp
acl Safe_ports port 70 # gopher
acl Safe_ports port 80 # http
acl Safe_ports port 210 # wais
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 443 # https
acl Safe_ports port 488 # gss-http
acl Safe_ports port 563 # nntps
acl Safe_ports port 591 # filemaker
acl Safe_ports port 631 # cups
acl Safe_ports port 777 # multiling http
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # swat
acl Safe_ports port 1025-65535 # unregistered ports
http_access deny !Safe_ports
acl connect method CONNECT
acl SSL_ports port 443 # https
acl SSL_ports port 563 # nntps
acl SSL_ports port 873 # rsync
http_access deny connect !SSL_ports
acl dominios_bloq dstdomain "/etc/squid/dominios_bloq"
#bloqueia dominios_bloq
http_access deny dominios_bloq
acl expressao_bloq url_regex -i "/etc/squid/expressao_bloq"
#bloqueia expressa_bloq
http_access deny expressao_bloq
acl extenssao_bloq urlpath_regex -i "/etc/squid/extessao_bloq"
#Bloqueia extenssao_bloq
http_access deny extenssao_bloq
http_access allow localnet
http_access allow localhost
http_access deny all