fernandotrilha
(usa Debian)
Enviado em 16/07/2008 - 08:47h
Pessoal oque pode estar de errado com as linhas abaixo, pois nao consigo navegar, o dhcp distribui tudo certinho, mas nao consigo navegar.Obrigado.
echo
echo " Iniciando Firewall "
echo
sleep 0.3
echo " Definindo Variaveis "
IPTABLES=" /usr/sbin/iptables"
INT="192.168.2.254"
EXT="192.168.0.1"
REDEINT="192.168.2.0/24"
REDEEXT="192.168.0.1/24"
echo " Habilitando o forward entre interfaces "
sleep 0.3
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "Carregando os modulos necessarios"
sleep 0.3
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_tables
/sbin/modprobe ipt_multiport
echo " Limpando as regras da tabela nat "
sleep 0.3
$IPTABLES -t nat -F
$IPTABLES -t nat -X
$IPTABLES -t nat -Z
echo " Limpando as regras da tabela filter "
sleep 0.3
$IPTABLES -F
$IPTABLES -X
$IPTABLES -Z
echo " Definindo as polices "
sleep 0.3
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP
echo " Permitindo conexoes loopback "
sleep 0.3
$IPTABLES -A INPUT -s 127.0.0.1 -j ACCEPT
$IPTABLES -A INPUT -s $EXT -j ACCEPT
$IPTABLES -A INPUT -s $INT -j ACCEPT
echo " Permitindo acesso da internet para o firewall "
sleep 0.3
$IPTABLES -A INPUT -d $EXT -p udp --dport 53 -j ACCEPT
$IPTABLES -A INPUT -d $EXT -p tcp --dport 53 -j ACCEPT
$IPTABLES -A INPUT -d $EXT -p udp --dport 80 -j ACCEPT
$IPTABLES -A INPUT -d $EXT -p udp --dport 443 -j ACCEPT
echo " permitindo acesso da rede interna para o firewall "
sleep 0.3
$IPTABLES -A INPUT -d $INT -m mac --mac-source 00:16:CE:70:7F:37 -j ACCEPT
$IPTABLES -A INPUT -d $INT -p udp --dport 53 -j ACCEPT
$IPTABLES -A INPUT -d $INT -p tcp --dport 53 -j ACCEPT
$IPTABLES -A INPUT -d $INT -p tcp --dport 80 -j ACCEPT
$IPTABLES -A INPUT -d $INT -p tcp --dport 443 -j ACCEPT
$IPTABLES -A INPUT -d $INT -p tcp --dport 8080 -j ACCEPT
echo " Permitindo acesso da rede interna para internet "
sleep 0.3
$IPTABLES -A FORWARD -s $REDEINT -p icmp -j ACCEPT
$IPTABLES -A FORWARD -s $REDEINT -p tcp --dport 80 -j ACCEPT
$IPTABLES -A FORWARD -s $REDEINT -p tcp --dport 53 -j ACCEPT
$IPTABLES -A FORWARD -s $REDEINT -p udp --dport 53 -j ACCEPT
# Acesso full
$IPTABLES -N ACESSOFULL
$IPTABLES -A ACESSOFULL -s 172.16.2.150 -j ACCEPT
echo " habilitando o statefull"
sleep 0.3
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
echo " habilitando o masquerade "
sleep 0.3
$IPTABLES -t nat -A POSTROUTING -s $REDEINT -j MASQUERADE
echo " Permitindo acesso da internet para a rede interan "
sleep 0.3
$IPTABLES -A FORWARD -d $REDEINT -p tcp --dport 5900 -j ACCEPT
echo " Protecao contra ping da morte "
sleep 0.3
$IPTABLES -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
echo " Habilitando proxy transparent "
$IPTABLES -t nat -A PREROUTING -s $REDEINT -p tcp --dport 80 -j REDIRECT --to-port 3128
e o squid esta assim
http_port 3128
# Proxy Transparente
http_port 3128 transparent
visible_hostname
www.incovisa.com.br
acl QUERY urlpath_regex cgi-bin \?
no_cache allow QUERY
cache_mem 32 MB
maximum_object_size 10 MB
minimum_object_size 0 KB
maximum_object_size_in_memory 128 KB
emulate_httpd_log off
cache_dir ufs /var/cache/squid 100 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
#Recommended minimum configuration:
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
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 8080 # http-alt
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 POST method POST
acl GET method GET
acl fernando src 192.168.2.150/255.255.255.255
acl CPD02 src 192.168.12.2/255.255.255.255
acl CPD03 src 192.168.12.3/255.255.255.255
acl CPD04 src 192.168.12.4/255.255.255.255
acl CPD05 src 192.168.12.6/255.255.255.255
acl SUP02 src 192.168.12.7/255.255.255.255
acl redeincovisa src 192.168.2.0/24
#acl redejari src 192.168.200.0/24
acl
[*****] url_regex -i "/etc/squid/acls/
[*****]"
acl urls url_regex -i "/etc/squid/acls/urls"
# Bloqueio MSN
acl HOST_MSN src 192.168.2.0/255.255.255.255
acl MSN req_mime_type -i ^application/x-msn-messenger$
acl msn1 url_regex -i gateway.messenger.com
acl Negar_MSN url_regex "/etc/squid/acls/msn.txt"
acl Negar_MSN2 url_regex "/etc/squid/acls/msn2.txt"
http_access deny Negar_MSN
http_access deny Negar_MSN2
http_access deny msn
http_access deny all MSN
http_access deny all msn1
#Regra de liberacao gtalk por ip
acl gtalk_liberado src "/etc/squid/acls/gtalk_liberado.txt"
http_access allow gtalk_liberado
#Regra para bloqueio google talk
acl gtalk url_regex -i "/etc/squid/acls/gtalk.txt"
http_access deny gtalk all
#Regra para bloqueio de extensao de radios online / arquivos de streaming:
acl streaming rep_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 extensao urlpath_regex -i "/etc/squid/acls/extensoes"
acl permitidos url_regex -i "/etc/squid/acls/permitidos"
acl hora1 time 07:45-12:00
acl hora3 time S 13:30-18:00
#acl bloqJari src 192.168.200.1/255.255.255.255 192.168.200.2/255.255.255.255 192.168.200.3/255.255.255.255 192.168.200.4/255.255.255.255 192.168.200.5/255.255.255.255 192.168.200.8/255.255.255.255 192.168.200.9/255.255.255.255 192.168.200.10/255.255.255.255 192.168.200.11/255.255.255.255
http_access allow fernando
http_access allow CPD02
http_access allow CPD03
http_access allow CPD04
http_access allow CPD05
http_access allow SUP02
http_access deny redeincovisa !hora1
http_access deny redeincovisa !hora3
http_access allow permitidos
http_access deny
[*****]
http_access deny urls
http_access deny gtalk
#http_access deny bloqJari
http_access deny Negar_MSN
http_access deny Negar_MSN2
http_access allow POST
http_access allow GET
http_access allow manager localhost
http_access deny extensao
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow redeincovisa
#http_access allow redejari
http_access allow localhost
http_access allow all
http_reply_access allow all
icp_access allow all