xlinux
(usa Ubuntu)
Enviado em 09/11/2016 - 12:44h
Boa tarde pessoal,
Estou com um problema aqui na empresa não consegui descobrir ainda o que é, tenho um servidor proxy/firewal com autenticação e tenho uma aplicação que acessada na nuvem, no entanto quando não direciono o pessoal para passar direto pelo proxy não acessa. O Acesso ao aplicação ser dá por um endereço NO-IP, além disso também não consigo fazer TS para fora da rede. Segue abaixo meu firewall de repente alguém vê o que fiz de errado.
Obrigado.
#!/bin/bash
#Limpa todas as regras
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -F
# Carrega modulos do iptables
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ipt_string
# Cria regra default para Chains
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
#Compartilhando a Internet
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/ip_dynaddr
# Libera Rede Interna
iptables -I INPUT -i lo -j ACCEPT
iptables -I INPUT -i eth0 -j ACCEPT
iptables -I INPUT -i eth1 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.4 -j ACCEPT #servidor
iptables -t nat -I PREROUTING -s 192.168.1.17 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.185 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.41 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.38 -j ACCEPT
#iptables -t nat -I PREROUTING -s 192.168.1.37 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.192 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.46 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.160 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.178 -j ACCEPT # Lanuce
iptables -t nat -I PREROUTING -s 192.168.1.139 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.1.150 -j ACCEPT #aquila
iptables -t nat -I PREROUTING -s 192.168.1.157 -j ACCEPT # Cesar
iptables -t nat -I PREROUTING -s 192.168.1.179 -j ACCEPT # Arlete
#iptables -t nat -I PREROUTING -s 192.168.1.120 -j ACCEPT # robério
#iptables -t nat -I PREROUTING -s 192.168.1.180 -j ACCEPT # Renan
#iptables -t nat -I PREROUTING -s 192.168.1.182 -j ACCEPT # miriã
#iptables -t nat -I PREROUTING -s 192.168.1.166 -j ACCEPT # luis
#iptables -t nat -I PREROUTING -s 192.168.1.44 -j ACCEPT # paulo
#iptables -t nat -I PREROUTING -s 192.168.1.183 -j ACCEPT #pedro
#iptables -t nat -I PREROUTING -s 192.168.1.175 -j ACCEPT # larissa
iptables -t nat -I PREROUTING -s 192.168.1.34 -j ACCEPT # Estolano
iptables -t nat -I PREROUTING -s 192.168.1.47 -j ACCEPT # PAINEL
iptables -t nat -I PREROUTING -s 192.168.1.15 -j ACCEPT #kely
# Redireciona porta 80 para porta do proxy
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -A FORWARD -t filter -j ACCEPT
iptables -A FORWARD -t filter -j ACCEPT -m state --state ESTABLISHED,RELATED,NEW
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Libera Terminal Service
iptables -I FORWARD -p tcp -d 192.168.1.1 --dport 3389 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination 192.168.1.4:3389
# Libera Firebird
iptables -I FORWARD -p tcp -d 192.168.1.1 --dport 3050 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 3050 -j DNAT --to-destination 192.168.1.4:3050
# Libera Zebedee
iptables -I FORWARD -p tcp -d 192.168.1.1 --dport 11965 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 11965 -j DNAT --to-destination 192.168.1.4:11965
# Libera Cameras
iptables -I FORWARD -p tcp -d 192.168.1.1 --dport 7000 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 7000 -j DNAT --to-destination 192.168.1.191:7000
# Libera Symac
iptables -I FORWARD -p tcp -d 192.168.1.1 --dport 5910:5922 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 5910:5920 -j DNAT --to-destination 192.168.1.4:5910-5920
# Bloqueio da Porta 80 e 443 TCP
iptables -A FORWARD -p tcp --destination-port 80 -s 192.168.1.0/24 -j DROP
iptables -A FORWARD -p tcp --destination-port 443 -s 192.168.1.0/24 -j DROP
#LIBERA DNS SERVER PARA A REDE
iptables -I FORWARD -p udp --dport 53 -j ACCEPT
iptables -I FORWARD -p tcp --dport 53 -j ACCEPT
# Bloqueio ultra-surf
iptables -A FORWARD -p tcp -d 65.49.2.0/24 -j DROP
iptables -A FORWARD -p tcp -d 65.49.14.0/24 -j DROP
iptables -A FORWARD -p tcp --dport 19769 -j DROP
##PROTECOES
# Protege contra port scanners avan?ados (Ex.: nmap)
iptables -A INPUT -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 20/m -j DROP
# Bloqueando tracertroute
iptables -A INPUT -p udp -s 0/0 -i eth1 --dport 33435:33525 -j DROP
# Protecoes contra ataques
iptables -A INPUT -m state --state INVALID -j DROP
#iMesh:
iptables -A FORWARD -d 216.35.208.0/24 -j DROP
#Bloqueando os -:P2P:- (se voce deseja utilizar um desses softwares, apenas retire o comentario e substitua a condicao de: REJECT, para ACCEPT)
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 6881:6889 -j DNAT --to-dest 192.168.1.1
iptables -A FORWARD -p tcp -i eth1 --dport 6881:6889 -d 192.168.1.1 -j DROP
#BearShare:
iptables -A FORWARD -p tcp --dport 6346 -j DROP
#WinMX:
iptables -A FORWARD -d 209.61.186.0/24 -j DROP
iptables -A FORWARD -d 64.49.201.0/24 -j DROP
#Napigator:
iptables -A FORWARD -d 209.25.178.0/24 -j DROP
#Morpheus:
iptables -A FORWARD -d 206.142.53.0/24 -j DROP
iptables -A FORWARD -p tcp --dport 1214 -j DROP
#Bloqueia utorrent
iptables -A FORWARD -s 192.168.1.0/24 -p udp -j DROP
iptables -A FORWARD -d 192.168.1.0/24 -p udp -j DROP