andre_ramos
(usa openSUSE)
Enviado em 27/07/2009 - 11:41h
Galera!
Estou com problemas com firewall para libera o outlook, eu tinha conseguido mas andei alterando algumas coisas ai bloqueou novamente, nao sei oque eu fiz de errado,
Outra duvida, e que no servidor firewall eu consigo pingar nos sites externos ex:
www.google.com.br mas nas estações eu nao consigo, eu consigo somente na rede interna, ou seja nas estaçoes eu nao consigo pingar em
www.google.com.br. nao sei se tem alguma coisa a ver com o meu problema
segue o script do firewall
#!/bin/bash
iniciar () {
# Autor: Andre Chagas Ramos
# Data criacao: 23/07/2009
# DAta de modificacao: 23/07/2009
# Compartilha a conexao ----------------------------------------
IPTABLES=/usr/sbin/iptables
echo 1 > /proc/sys/net/ipv4/ip_forward
$IPTABLES -t nat -A POSTROUTING -o eth1 -j MASQUERADE
echo "Ativando compartilhamento!"
# Limpando Tabelas ----------------------------------------------
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
# Ativando modulos ----------------------------------------------
modprobe ip_conntrack
modprobe ip_nat_ftp
modprobe iptable_nat
modprobe ip_tables
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe ipt_MASQUERADE
# Proxy tranparente --------------------------------------------
$IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
# Politicas de acesso geral
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
########## loopback #############################################
$IPTABLES -A OUTPUT -p tcp --syn -s 127.0.0.1/255.0.0.0 -j ACCEPT
#----------------------------------------------------------------
# localhost
$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A OUTPUT -o lo -j ACCEPT
################################################################
#######################
## Regras de Filtros ##
#######################
# Manter conexoes ja estabelecidas para nao parar --------------
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED,NEW -j ACCEPT
$IPTABLES -A OUTPUT -m state --state RELATED,ESTABLISHED,NEW -j ACCEPT
$IPTABLES -A FORWARD -m state --state RELATED,ESTABLISHED,NEW -j ACCEPT
######### Conectividade Social ###################################
INTERNA=eth0 #placa de rede ligada a rede interna
CAIXA=200.201.174.0/24 # IP da Caixa a ser liberado para toda a rede
iptables -t nat -A PREROUTING -i $INTERNA -d 200.201.174.0/24 -j ACCEPT
iptables -t filter -A FORWARD -i $INTERNA -d 200.201.174.0/24 -j ACCEPT
########## Tabelas ################################################
# INPUT ( Pacotes que entra na rede)
$IPTABLES -A INPUT -p tcp -s 10.1.1.0/8 -d 201.76.49.33 --dport 110 -j ACCEPT
$IPTABLES -A INPUT -p tcp -s 10.1.1.0/8 -d 201.76.49.33 --dport 25 -j ACCEPT
# ftp
$IPTABLES -A INPUT -p tcp --dport 20 -j ACCEPT
# ftp
$IPTABLES -A INPUT -p tcp --dport 21 -j ACCEPT
# ssh
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
# smtp
$IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT
# dns
$IPTABLES -A INPUT -p udp --dport 53 -j ACCEPT
# pop3
$IPTABLES -A INPUT -p tcp --dport 110 -j ACCEPT
# http
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
# HTTPS
$IPTABLES -A INPUT -p tcp --dport 443 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 563 -j ACCEPT
#--------------------------------------------------------------------
# OUTPUT ( Pacotes que sai da rede)
$IPTABLES -A OUTPUT -p tcp -s 10.1.1.0/8 -d 201.76.49.33 --dport 110 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp -s 10.1.1.0/8 -d 201.76.49.33 --dport 25 -j ACCEPT
# ftp
$IPTABLES -A OUTPUT -p tcp --dport 20 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --sport 20 -j ACCEPT
# ftp
$IPTABLES -A OUTPUT -p tcp --dport 21 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --sport 21 -j ACCEPT
# ssh
$IPTABLES -A OUTPUT -p tcp --dport 22 -j ACCEPT
# smtp
$IPTABLES -A OUTPUT -p tcp --dport 25 -j ACCEPT
# dns
$IPTABLES -A OUTPUT -p udp --dport 53 -j ACCEPT
# pop3
$IPTABLES -A OUTPUT -p tcp --dport 110 -j ACCEPT
# http
$IPTABLES -A OUTPUT -p tcp --dport 80 -j ACCEPT
# HTTPS
$IPTABLES -A OUTPUT -p tcp --dport 443 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 563 -j ACCEPT
#--------------------------------------------------------------------
# FORWARD - REDE LOCAL
# ftp
$IPTABLES -A FORWARD -p tcp --dport 20 -j ACCEPT
# ftp
$IPTABLES -A FORWARD -p tcp --dport 21 -j ACCEPT
# ssh
$IPTABLES -A FORWARD -p tcp --dport 22 -j ACCEPT
# smtp
$IPTABLES -A FORWARD -p tcp --dport 25 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --sport 25 -j ACCEPT
# dns
$IPTABLES -A FORWARD -p udp --dport 53 -j ACCEPT
# pop3
$IPTABLES -A FORWARD -p tcp --dport 110 -j ACCEPT
# POP
$IPTABLES -A FORWARD -p tcp --dport 8333 -j ACCEPT
# http
$IPTABLES -A FORWARD -p tcp --dport 80 -j ACCEPT
# HTTPS
$IPTABLES -A FORWARD -p tcp --dport 443 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 563 -j ACCEPT
# msn
$IPTABLES -A FORWARD -p tcp --dport 1080 -j DROP
$IPTABLES -A FORWARD -s 10.1.1.0/8 -p tcp --dport 1863 -j REJECT
$IPTABLES -A FORWARD -s 10.1.1.0/8 -p tcp --dport 1864 -j REJECT
$IPTABLES -A FORWARD -s 10.1.1.0/8 -j ACCEPT
####################################################################
echo "Firewall Ativado"
}
parar(){
echo "Regras de firewall e compartilhamento desativados"
}
case "$1" in
"start") iniciar ;;
"stop") parar ;;
"restart") parar; iniciar ;;
*) echo "Use os parametros start ou stop"
esac