Proxy Transparente

1. Proxy Transparente

Apio Carnielo e Silva
karniello

(usa Outra)

Enviado em 15/04/2020 - 00:17h

Boa Noite.

Sou prof. de Informática e estava ensinando meus alunos a montarem um servidor Proxy com squid transparent.
Segue o meu squid.conf

http_port 3128 transparent
visible_hostname stone
error_directory /usr/share/squid/errors/pt-br/

cache_mem 64 MB
maximum_object_size_in_memory 64 KB
maximum_object_size 512 MB
minimum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /var/spool/squid 2048 16 256
cache_access_log /var/log/squid/access.log
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280
#acl all src 0.0.0.0/0.0.0.0 substituida por acl all src
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
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 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 901 # swat
acl Safe_ports port 1025-65535 # portas altas
acl purge method PURGE
acl CONNECT method CONNECT

############################BLOQUEANDO PALAVRAS#######################################################################
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

######################################LIMITANDO DOWNLOAD##############################################################
#acl acessocontrolado src "/etc/squid/estacoes/acessocontrolado.txt"
#acl acessototal src "/etc/squid/estacoes/acessototal.txt"
#acl semacesso src "/etc/squid/estacoes/semacesso.txt"
#acl servico src "/etc/squid/estacoes/servico.txt"
######################################RESTINGINDO ACESSO##############################################################
acl bloqueados dstdom_regex "/etc/squid/bloqueados"
acl blacklist dstdom_regex "/etc/squid/blacklist"
acl spybootlist dstdom_regex "/etc/squid/spybootlist"
######################################RESTINGINDO DOWNLOAD##############################################################
#reply_body_max_size 1 MB semacesso

acl redelocal1 src 192.168.68.0/24

http_access deny bloqueados redelocal1
http_access deny blacklist redelocal1
http_access deny spybootlist redelocal1

http_access deny bloqueados localhost
http_access deny blacklist localhost
http_access deny spybootlist localhost

http_access allow localhost
http_access allow redelocal1

###################BLOQUEIA ACESSOS EXTERNOS##################################
http_access deny all

E esse eh meu firewall
#!/bin/bash

#####################
#CARREGANDO MODULOS #
#####################
modprobe iptable_nat

### LIMPANDO AS TABELAS E REGRAS #####
iptables -F
iptables -t nat -F
iptables -X


##Habilitando IP Forward
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT

##########
## NAT ##
##########
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE

#Proxy transparente
iptables -t nat -A PREROUTING -s 192.168.68.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
#iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

Estou usando o ubuntu 18.04 lts.
O problema que eu estou tendo, eh que qdo coloco a configuração de de proxy nas maquinas elas funcionam normalmente, mas qdo tento usar o proxy trnaparente ele não funciona.
Alguém pode me ajudar?!!?


  






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts