samoel_oliveira
(usa FreeBSD)
Enviado em 09/05/2016 - 16:53h
Boa tarde.
Estou quebrando a cabeça para bloquear a pagina do Facebook em meu squid.
O squid esta funcionando corretamente bloqueando outros sites, porem sites https, não consigo bloquear.
Estou utilizando proxy transparente.
Alguém poderia me ajudar??
Abaixo esta meu Iptables:
#eth0-eno16777984 (Wan)
#eth1-eno33557248 (Lan)
*nat
:INPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eno16777984 -j MASQUERADE
#PORTA REDIRECIONAMENTO SQUID
-A PREROUTING -p tcp -i eno33557248 --dport 80 -j REDIRECT --to-ports 3128
COMMIT
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3128 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -i eno16777984 -o eno33557248 -m state --state RELATED,ESETABLISHED -j ACCEPT
-A FORWARD -i eno33557248 -o eno16777984 -j ACCEPT
-A FORWARD -i eno16777984 -d 192.168.1.0/24 -p tcp --dport -m string --algo bm --string "facebook.com" -j DROP
-A FORWARD -i eno33557248 -p tcp --dport 443 -m string --algo bm --string "facebook.com" -j DROP
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Fiz algumas pesquisas e coloquei essa regra no iptables para ver se dava certo, porém sem sucesso:
-A FORWARD -i eno16777984 -d 192.168.1.0/24 -p tcp --dport -m string --algo bm --string "facebook.com" -j DROP
-A FORWARD -i eno33557248 -p tcp --dport 443 -m string --algo bm --string "facebook.com" -j DROP
Abaixo meu Squid.conf
acl localnet src 192.168.1.0/24 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
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
acl Sites_bloqueados url_regex -i "/etc/squid/sites_bloqueados.txt"
http_access allow localhost manager
http_access allow manager
http_access allow localhost
http_access deny Sites_bloqueados
http_access allow all
http_port 3128 transparent
cache_dir ufs /var/spool/squid 100 16 256
coredump_dir /var/spool/squid