Firewall con Software Libre

45
FIREWALL CON SOFTWARE LIBRE (DHCP, IPTABLES, SQUID, VSFTPD y SELINUX) Remigio Salvador S´ anchez BugCON 2012 [email protected] BugCon 2012 IPN. DF

description

Slide del taller Firewall con Software Libre presentado como parte de las actividades de el BugCon 2012, realizado en el D.F. el día 02 de febrero de 2012

Transcript of Firewall con Software Libre

Page 1: Firewall con Software Libre

FIREWALL CON SOFTWARE LIBRE(DHCP, IPTABLES, SQUID, VSFTPD y SELINUX)

Remigio Salvador Sanchez

BugCON 2012

[email protected] BugCon 2012 IPN. DF

Page 2: Firewall con Software Libre

”La mejor medicina es el vacıo de todo”Filosofıa Budista

[email protected] BugCon 2012 IPN. DF

Page 3: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 4: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 5: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 6: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 7: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 8: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 9: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 10: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 11: Firewall con Software Libre

Contenido

1.- Instalacion

2.- Configuracion

3.- IPTABLES

4.- DHCP

5.- SQUID

6.- VSFTPD

7.- SELINUX

8.- Recomendaciones

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 12: Firewall con Software Libre

1.- INSTALACION

[email protected] BugCon 2012 IPN. DF

Page 13: Firewall con Software Libre

Instalacion

[email protected] BugCon 2012 IPN. DF

Page 14: Firewall con Software Libre

Instalacion

[email protected] BugCon 2012 IPN. DF

Page 15: Firewall con Software Libre

Instalacion

[email protected] BugCon 2012 IPN. DF

Page 16: Firewall con Software Libre

Instalacion

[email protected] BugCon 2012 IPN. DF

Page 17: Firewall con Software Libre

2.- CONFIGURACION

[email protected] BugCon 2012 IPN. DF

Page 18: Firewall con Software Libre

Configuracion

Deshabilitar Selinux- vi /etc/selinux/config- setenforce 0

Parar servicios innecesarios- chkconfig ip6tables off- chkconfig sendmail off- chkconfig netfs off

Configurar nuestro hostname- vi /etc/sysconfig/network

[email protected] BugCon 2012 IPN. DF

Page 19: Firewall con Software Libre

Configuracion

configurar tarjetas de red (eth0 y p1p1)- eth0 (ip dinamica)- pxxx (puente-LAN) (ip estatica 192.168.0.1)

less /etc/sysconfig/network-scripts/ifcfg-INTERNETless /etc/sysconfig/network-scripts/ifcfg-LAN

Habilitar desde el inicio:chkconfig network on

service network (start stop restart status)

[email protected] BugCon 2012 IPN. DF

Page 20: Firewall con Software Libre

Configuracion

Activando el bit de forwarding-vi /etc/sysctl.confnet.ipv4.ip forward = 0

Ejecutar sysctl -p para que tome el cambio de inmediato

[email protected] BugCon 2012 IPN. DF

Page 21: Firewall con Software Libre

3.- IPTABLES

[email protected] BugCon 2012 IPN. DF

Page 22: Firewall con Software Libre

IPTABLES

iptables -Fiptables -t nat -Fiptables -P INPUT ACCEPTiptables -P OUTPUT ACCEPTiptables -P FORWARD ACCEPTiptables -t nat -A POSTROUTING -s 192.168.0.0/24 -jMASQUERADE

service iptables save/usr/libexec/iptables.init save

service iptables (start stop restart status)

chkconfig iptables on

[email protected] BugCon 2012 IPN. DF

Page 23: Firewall con Software Libre

4.- DHCP

[email protected] BugCon 2012 IPN. DF

Page 24: Firewall con Software Libre

DHCP

yum -y install dhcp

Archivo de configuracion:- vi /etc/dhcp/dhcpd.conf

[email protected] BugCon 2012 IPN. DF

Page 25: Firewall con Software Libre

DHCP

/etc/sysconfig/dhcpdDHCPDARGS=”pxxx”

service dhcpd (start stop restart status)

tail -100 /var/log/messages

chkconfig dhcpd on

[email protected] BugCon 2012 IPN. DF

Page 26: Firewall con Software Libre

5.- SQUID

[email protected] BugCon 2012 IPN. DF

Page 27: Firewall con Software Libre

SQUID

yum -y install squid

vi /etc/squid/squid.conf

vi /etc/squid/PNP

vi /etc/squid/exts

service squid (start stop restart status)

chkconfig squid on

[email protected] BugCon 2012 IPN. DF

Page 28: Firewall con Software Libre

3.- IPTABLES

[email protected] BugCon 2012 IPN. DF

Page 29: Firewall con Software Libre

IPTABLES

iptables -t nat -A PREROUTING -i pXXX -p tcp –dport 80 -jREDIRECT –to-port 3128

service iptables save/usr/libexec/iptables.init save

service iptables (start stop restart status)

[email protected] BugCon 2012 IPN. DF

Page 30: Firewall con Software Libre

5.- SQUID

[email protected] BugCon 2012 IPN. DF

Page 31: Firewall con Software Libre

SQUID

tail /var/log/squid/access.logtail /var/log/messages

[email protected] BugCon 2012 IPN. DF

Page 32: Firewall con Software Libre

6.- VSFTPD

[email protected] BugCon 2012 IPN. DF

Page 33: Firewall con Software Libre

VSFTPD

yum -y install vsftpd

vi /etc/vsftpd/vsftpd.conf

touch /etc/vsftpd/chroot list

service vsftpd (start stop restart status)

chkconfig vsftpd on

[email protected] BugCon 2012 IPN. DF

Page 34: Firewall con Software Libre

6.- SELINUX

[email protected] BugCon 2012 IPN. DF

Page 35: Firewall con Software Libre

SELINUX

setenforce 1

setsebool -P ftp home dir 1

systemctl

[email protected] BugCon 2012 IPN. DF

Page 36: Firewall con Software Libre

Contenido

8.- Recomendaciones

[email protected] BugCon 2012 IPN. DF

Page 37: Firewall con Software Libre

RECOMENDACIONES

1.- DHCP

2.- IPTABLES

3.- SQUID

4.- vsFTPD

5.- Esto es solo la punta del Icebergsigue adelante, sigue aprendiendo ;)

[email protected] BugCon 2012 IPN. DF

Page 38: Firewall con Software Libre

RECOMENDACIONES

1.- DHCP

2.- IPTABLES

3.- SQUID

4.- vsFTPD

5.- Esto es solo la punta del Icebergsigue adelante, sigue aprendiendo ;)

[email protected] BugCon 2012 IPN. DF

Page 39: Firewall con Software Libre

RECOMENDACIONES

1.- DHCP

2.- IPTABLES

3.- SQUID

4.- vsFTPD

5.- Esto es solo la punta del Icebergsigue adelante, sigue aprendiendo ;)

[email protected] BugCon 2012 IPN. DF

Page 40: Firewall con Software Libre

RECOMENDACIONES

1.- DHCP

2.- IPTABLES

3.- SQUID

4.- vsFTPD

5.- Esto es solo la punta del Icebergsigue adelante, sigue aprendiendo ;)

[email protected] BugCon 2012 IPN. DF

Page 41: Firewall con Software Libre

RECOMENDACIONES

1.- DHCP

2.- IPTABLES

3.- SQUID

4.- vsFTPD

5.- Esto es solo la punta del Icebergsigue adelante, sigue aprendiendo ;)

[email protected] BugCon 2012 IPN. DF

Page 42: Firewall con Software Libre

9.- Preguntas

[email protected] BugCon 2012 IPN. DF

Page 43: Firewall con Software Libre

Preguntas

PreguntasDudas

Comentarios

[email protected]@remitos

http://vkn-side.blogspot.com

[email protected] BugCon 2012 IPN. DF

Page 44: Firewall con Software Libre

Dedicado:A mi familia

yamigos

[email protected] BugCon 2012 IPN. DF

Page 45: Firewall con Software Libre

Gracias:A los organizadores por las facilidades

ya ustedes por su atencion

[email protected] BugCon 2012 IPN. DF