Pregunta IPTABLES
Hola, tengo el siguiente script para configurar las IPTABLES, y me
gustaria saber vuestra opinión para saber si debo añadir algo más que no
esté... Soy bastante novato en IPTABLES :-(
--- BEGIN SCRIPT
#!/bin/bash
#
# Última modificación: 09/07/2007
#
printf "\n#################################\n";
printf "# Configuración de las IPTABLES #\n";
printf "#################################\n\n";
# DEFINICIÓN DE VARIABLES
IPT="sudo /sbin/iptables"; # Ruta al ejecutable del IPTABLES
IFCONFIG="/sbin/ifconfig"; # Ruta al ejecutable del IFCONFIG
EXT_IF="eth0"; # Interfaz de red a proteger
LAN="192.168.0.0/16"; # Parte de la red correspondiente a la LAN
IP=`$IFCONFIG $EXT_IF | grep "inet addr" | cut -d ":" -f 2 | cut -d " "
-f 1`; # Detectamos la IP asignada
PUERTOS_ABIERTOS=( # Especifica los puertos ENTRANTES que se abrirán
"SSH:22"
"HTTP:80"
"HTTPS:443"
"WEBCACHE:8080"
"STICKIES:52673"
);
printf "* Detectada IP: $IP\n";
# POR DEFECTO DESECHAMOS TODOS LOS PAQUETES
printf "* Desechando TODOS los paquetes ... ";
$IPT -P INPUT DROP > /dev/null 2>&1 && $IPT -P OUTPUT DROP > /dev/null
2>&1 && $IPT -P FORWARD DROP > /dev/null 2>&1 && printf "OK\n" || printf
"FALLÓ\n";
# LIMPIAMOS LAS REGLAS ANTERIORES
printf "* Limpiando reglas anteriormente definidas ... ";
$IPT -F > /dev/null 2>&1 && printf "OK\n" || printf "FALLÓ\n";
# PERMITIMOS TRÁFICO LOOPBACK
printf "* Permitiendo tráfico de loopback ... ";
$IPT -A INPUT -i lo -j ACCEPT > /dev/null 2>&1 && $IPT -A OUTPUT -o lo
-j ACCEPT > /dev/null 2>&1 && printf "OK\n" || printf "FALLÓ\n";
# PERMITIMOS CONEXIONES YA ESTABLECIDAS
printf "* Permitiendo conexiones YA establecidas ... ";
$IPT -A INPUT -i $EXT_IF -p all -m state --state ESTABLISHED,RELATED -j
ACCEPT > /dev/null 2>&1 && printf "OK\n" || printf "FALLÓ\n";
# PERMITIMOS TODO EL TRÁFICO HACIA AFUERA
printf "* Permitiendo TODO el tráfico hacia afuera ... ";
$IPT -A OUTPUT -o $EXT_IF -j ACCEPT > /dev/null 2>&1 && printf "OK\n" ||
echo "FALLÓ\n";
# PERMITIMOS ALGUNAS CONEXIONES ENTRANTES
printf "* Permitiendo conexiones desde la intranet: ";
for i in ${PUERTOS_ABIERTOS[@]}
do
nombre_puerto=`echo $i | cut -d ":" -f 1`;
puerto=`echo $i | cut -d ":" -f 2`;
$IPT -A INPUT -i $EXT_IF -s ${LAN} -d $IP -p tcp --dport
${puerto} --syn -m state --state NEW -j ACCEPT > /dev/null 2>&1 &&
printf "${nombre_puerto} " || printf "¬${nombre_puerto} ";
done
printf "\n\n";
--- END SCRIPT
Muchas gracias....
--
.---------------------------------------------------------------------.
| Miguel J. Jiménez |
| Programador Senior |
| Área de Internet/XSL/PHP |
| migueljose.jimenez@isotrol.com |
:---------------------------------------------------------------------:
| ISOTROL, S.A. |
| Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta. |
| Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP). |
| Teléfono: +34 955 036 800 - Fax: +34 955 036 849 |
| http://www.isotrol.com |
:---------------------------------------------------------------------:
| "It's kind of like trying to sing the lyrics to The Macarena. You |
| can send out the words but you have no idea what you're singing." |
| Ronald McKay, Stargate Atlantis (3x12) - Echoes |
'---------------------------------------------------------------------'
begin:vcard
fn;quoted-printable:Miguel J. Jim=C3=A9nez Jim=C3=A9nez
n;quoted-printable:Jim=C3=A9nez Jim=C3=A9nez;Miguel J.
org:ISOTROL, S.A.;XSL / PHP
adr;quoted-printable;quoted-printable;quoted-printable:Parque Tecnol=C3=B3gico Cartuja 93;;C/ Isaac Newton 3, 4=C2=AA;Sevilla;Sevilla;41092;Espa=C3=B1a
email;internet:mjjimenez@isotrol.com
title:Programador Senior
tel;work:+34 955 036 800 (ext. 1805)
tel;fax:+34 955 036 849
tel;cell:+34 607 44 87 64
x-mozilla-html:TRUE
url:http://www.isotrol.com
version:2.1
end:vcard
Reply to: