patrickpfp
(usa CentOS)
Enviado em 14/03/2013 - 21:39h
Boa Noite caros amigos!!!
Estou fazendo uns teste para bloquear alguns sites seguros como do facebook por exemplo, fiz alguns teste mas ele está bloqueando tudo, hoje pela tarde tinha funcionado, mas agora não, sei lah hehehehe.
O que eu fiz foi redirecionar a porta 443 para 8123 no firewall e criei uma acl para liberar os site seguros menos os que estão numa determina lista. Mas ele bloqueia tudo. Vou postar meu iptables e squid:
[quote]#!/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
#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
# Set access for localhost
iptables -t nat -A PREROUTING -s 10.1.1.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth0 -s 10.1.1.0/24 -p tcp --dport 443 -j REDIRECT --to-port 3128
#
# Save settings
#
/sbin/service iptables save
#
# List rules
#
iptables -L -v[quote]
[quote]# Squid Configuracoes
http_port 3128 transparent
visible_hostname Srvfwl
acl manager proto cache_object
acl localhost src 10.0.0.0/24
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
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
#
acl redelocal src 10.1.1.0/24
acl teste src 10.1.1.107
acl bloqueio url_regex -i "/etc/squid/regras/bloqueados"
acl sitessl url_regex -i "/etc/squid/regras/sitessl"
http_access allow teste !bloqueio
http_access allow SSL_ports !sitessl
# 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[quote]