patrickpfp
(usa CentOS)
Enviado em 03/04/2013 - 21:23h
Boa Noite Pessoal!!!
Montei um pequeno firewall + squid transparante, mas os bloqueios só estão funcionando se eu setar no navegador da máquina, em modo transparente não. Se alguém puder me dar um auxilio, agradeço.
OBS: Estou usando o CentOS 6.3. O arquivo de iptables criei um chamado rc.firewall, dentro de /etc/sysconfig/
IPTABLES
#!/bin/bash
#
#Flush all current rules from iptables
#
iptables -F
#Carregando modulos
iptables=/sbin/iptables
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_nat
/sbin/modprobe iptable_mangle
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_REDIRECT
/sbin/modprobe ipt_MASQUERADE
#Mascaramento
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
#Ativando o redirecionamento de pacotes
echo 1 > /proc/sys/net/ipv4/ip_forward
# Allow SSH connections on tcp port 22
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
# Set access for localhost
iptables -t nat -A PREROUTING -s 10.0.0.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
#
# Save settings
#
/sbin/service iptables save
#
# List rules
#
iptables -L -v
SQUID
# Squid Configuracoes
http_port 3128 transparent
visible_hostname Srvfwl
acl manager proto cache_object
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
#ACLS
acl redelocal src 10.0.0.0/24
acl diretoria src 10.1.1.20
acl negado src 10.1.1.30-10.1.1.40
acl bloqueio url_regex -i "/etc/squid/regras/bloqueados"
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
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
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
http_access deny negado
http_access allow redelocal !bloqueio
http_access allow diretoria
# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 512 16 256
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid
# 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