removido
(usa Nenhuma)
Enviado em 18/07/2012 - 08:44h
Iaê brother! Beleza?
Usa esse como base:
http://www.vivaolinux.com.br/artigo/Hotspot-rapido-com-Coovachilli/?pagina=1
Quando tudo estiver funcionando, você configura o squid. Aqui criamos uma interface própria para administração com php, mas pode usar o Daloradius.
Nossa adaptação para uso do squid3 transparente:
# vi /etc/chilli/up.sh
#!/bin/sh
##############################--> VARIÁVEIS <--########################################
IPT=`which iptables`
#######################################################################################
$IPT -F
$IPT -F -t nat
$IPT -F -t mangle
$IPT -X
$IPT -X -t nat
$IPT -Z
$IPT -Z -t nat
###### INICIO DAS REGRAS DO COOVACHILLI - Regras originais da instalacao ########
. /etc/chilli/functions
[ -e "/var/run/chilli.iptables" ] && sh /var/run/chilli.iptables 2>/dev/null
rm -f /var/run/chilli.iptables 2>/dev/null
IF=$(basename $DEV)
ipt() {
opt=$1; shift
echo "iptables -D $*" >> /var/run/chilli.iptables
iptables $opt $*
}
ipt_in() {
ipt -I INPUT -i $IF $*
}
[ -n "$DHCPIF" ] && {
[ -n "$UAMPORT" -a "$UAMPORT" != "0" ] && \
ipt_in -p tcp -m tcp --dport $UAMPORT --dst $ADDR -j ACCEPT
[ -n "$UAMUIPORT" -a "$UAMUIPORT" != "0" ] && \
ipt_in -p tcp -m tcp --dport $UAMUIPORT --dst $ADDR -j ACCEPT
[ -n "HS_TCP_PORTS" ] && {
for port in $HS_TCP_PORTS; do
ipt_in -p tcp -m tcp --dport $port --dst $ADDR -j ACCEPT
done
}
ipt_in -p udp -d 255.255.255.255 --destination-port 67:68 -j ACCEPT
ipt_in -p udp --dst $ADDR --dport 53 -j ACCEPT
ipt -A INPUT -i $IF --dst $ADDR -j DROP
ipt -A INPUT -i $IF -j DROP
ipt -I FORWARD -i $DHCPIF -j DROP
ipt -I FORWARD -o $DHCPIF -j DROP
ipt -I FORWARD -i $IF -j ACCEPT
ipt -I FORWARD -o $IF -j ACCEPT
# Help out conntrack to not get confused
ipt -I PREROUTING -t raw -j NOTRACK -i $DHCPIF
ipt -I OUTPUT -t raw -j NOTRACK -o $DHCPIF
# Help out MTU issues with PPPoE or Mesh
ipt -I FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
ipt -I FORWARD -t mangle -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
[ "$HS_LAN_ACCESS" != "on" -a "$HS_LAN_ACCESS" != "allow" ] && \
ipt -I FORWARD -i $IF -o \! $HS_WANIF -j DROP
[ "$HS_LOCAL_DNS" = "on" ] && \
ipt -I PREROUTING -t nat -i $IF -p udp --dport 53 -j DNAT --to-destination $ADDR
}
# site specific stuff optional
[ -e /etc/chilli/ipup.sh ] && . /etc/chilli/ipup.sh
###### FIM DAS REGRAS DO COOVACHILLI - Regras originais da instalacao ########
###### REGRAS CRIADAS PELO AMARILDO #########
modprobe ipt_layer7
modprobe iptable_nat
modprobe ip_queue
# Ativa roteamento
echo 1 > /proc/sys/net/ipv4/ip_forward
# Permitir que tudo na interface loopback
$IPT -A INPUT -i lo -j ACCEPT
# Aceitar todas as conexões previamente estabelecidas
$IPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Proxy transparente
$IPT -I INPUT 1 -d 192.168.172.1/32 -p tcp -m tcp --dport 3128 -j ACCEPT
$IPT -t nat -A PREROUTING -s 192.168.172.0/24 -d ! 192.168.172.1/32 -p tcp -m multiport --dports 80,8080 -j REDIRECT --to-ports 3128
$IPT -t mangle -A PREROUTING -s 192.168.172.0/24 -d ! 192.168.172.1/32 -p tcp -m multiport --dports 80,8080 -j MARK --set-xmark 0x100/0xffffffff
$IPT -t mangle -A INPUT -p tcp -m tcp --dport 3128 -m mark --mark 0x100 -j ACCEPT
$IPT -t mangle -A INPUT -p tcp -m tcp --dport 3128 -j DROP
#Ativar NAT no dispositivo de saída
$IPT -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# BLOQUEIOS COM LAYER7
$IPT -A FORWARD -m layer7 --l7proto tor -j DROP
$IPT -A FORWARD -m layer7 --l7proto fasttrack -j DROP
$IPT -A FORWARD -m layer7 --l7proto gnutella -j DROP
$IPT -A FORWARD -m layer7 --l7proto bittorrent -j DROP
$IPT -A FORWARD -m layer7 --l7proto ares -j DROP
$IPT -A FORWARD -m layer7 --l7proto soulseek -j DROP
$IPT -A FORWARD -m layer7 --l7proto edonkey -j DROP
$IPT -A INPUT -m layer7 --l7proto tor -j DROP
$IPT -A INPUT -m layer7 --l7proto fasttrack -j DROP
$IPT -A INPUT -m layer7 --l7proto gnutella -j DROP
$IPT -A INPUT -m layer7 --l7proto bittorrent -j DROP
$IPT -A INPUT -m layer7 --l7proto ares -j DROP
$IPT -A INPUT -m layer7 --l7proto soulseek -j DROP
$IPT -A INPUT -m layer7 --l7proto edonkey -j DROP
$IPT -A OUTPUT -m layer7 --l7proto tor -j DROP
$IPT -A OUTPUT -m layer7 --l7proto fasttrack -j DROP
$IPT -A OUTPUT -m layer7 --l7proto gnutella -j DROP
$IPT -A OUTPUT -m layer7 --l7proto bittorrent -j DROP
$IPT -A OUTPUT -m layer7 --l7proto ares -j DROP
$IPT -A OUTPUT -m layer7 --l7proto soulseek -j DROP
$IPT -A OUTPUT -m layer7 --l7proto edonkey -j DROP
Outra modificação em relação a essa documentação é a versão do Coovachilli. Estamos usando a versão:
coova-chilli_1.2.1