Sei sulla pagina 1di 4

21/03/13

how to bloquear gmail, hotmail, facebook por 443 con iptables

Bienvenido(a), Visitante. Por favor, ingresa o regstrate.


Ingresar

Marzo 21, 2013, 06:42:49 pm


Buscar... Noticias: irc : ifg.ircnode.com , channel : #undersec

Inicio

Ayuda

Ingresar

Registrarse

MitM Labs Networking General (Moderador: r4c3) how to bloquear gmail, hotmail, facebook por 443 con iptables

anterior prximo Pginas: [1]


I M P RI M I R

Autor

Tema: how to bloquear gmail, hotmail, facebook por 443 con iptables (Ledo 1423 veces) how to bloquear gmail, hotmail, facebook por 443 con iptables
en: Julio 28, 2011, 01:29:56 pm

r4c3
Moderator Newbie Mensajes: 2

Esta guia esta basada solo para Red hat based si quieren usarla en otras distribuciones hacer los cambios pertinentes. Estimados despues de buscar y buscar y que casi me llegara un penkeo supremo del olimpo por no tener la pega echa xD encontre la forma de bloquear hotmail, gmail, facebook que se conectan por conexiones seguras.

mi escenario es el siguiente. Server proxy con centos+squid transparente+dansguardian+dhcpd para esta guia tienen que tener todos los servicios funcionando y ya previa mente configurando no entrare en detalle ya que la guia detalla como bloquear paginas seguras Advertencia: mitm no se responsabiliza por cualquier tipo de dao o bullying laboral que sufra el lector al aplicar esta guia en su trabajo

Empecemos primero bloquearemos el facebook con iptables dropeando el rango de ip que ocupan estos cauros. Para eso usamos nuestro amigo dig para ver las ip que tienen.

[ r o o t @ f w~ ] #d i gf a c e b o o k . c o m Cdigo: [Seleccionar] ;< < > >D i G9 . 3 . 6 P 1 R e d H a t 9 . 3 . 6 1 6 . P 1 . e l 5< < > >f a c e b o o k . c o m ; ;g l o b a lo p t i o n s : p r i n t c m d ; ;G o ta n s w e r : ; ;> > H E A D E R < < -o p c o d e :Q U E R Y ,s t a t u s :N O E R R O R ,i d :7 9 7 ; ;f l a g s :q rr dr a ;Q U E R Y :1 ,A N S W E R :3 ,A U T H O R I T Y :0 ,A D D I T I O N A L :0 ; ;Q U E S T I O NS E C T I O N : ; f a c e b o o k . c o m . ; ;A N S W E RS E C T I O N : f a c e b o o k . c o m . f a c e b o o k . c o m . f a c e b o o k . c o m .

I N

2 6 6 3 2 6 6 3 2 6 6 3

I N I N I N

A A A

6 9 . 6 3 . 1 8 9 . 1 1 6 9 . 6 3 . 1 8 1 . 1 2 6 9 . 6 3 . 1 8 9 . 1 6

; ;Q u e r yt i m e :1 7 1m s e c ; ;S E R V E R :8 . 8 . 8 . 8 # 5 3 ( 8 . 8 . 8 . 8 ) ; ;W H E N :T h uJ u l2 80 9 : 5 7 : 4 72 0 1 1 ; ;M S GS I Z E r c v d :7 8

vemos bien que ocupan los siguientes rangos 69.63.181.0 y 69.63.181.0 asi que procedemos a bloquearlos y usaremos iptables con iprange para poder hacer los bloqueos . entramos a nuestro archivo de iptables que se encuentra en /etc/sysconfig/iptables con nuestro editor favorito
Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #n a n o/ e t c / s y s c o n f i g / i p t a b l e s

y agregamos lo siguiente.
Cdigo: [Seleccionar]

forum.mitm.cl/index.php?topic=25.0

1/4

21/03/13
# b l o q u e of a c e b o o k

how to bloquear gmail, hotmail, facebook por 443 con iptables

AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g ed s t r a n g e 6 9 . 6 3 . 1 8 9 . 0 -6 9 . 6 3 . 1 8 9 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g ed s t r a n g e6 9 . 6 3 . 1 8 1 . 0 6 9 . 6 3 . 1 8 1 . 5 5jD R O P

reiniciamos iptables
Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #s e r v i c ei p t a b l e sr e s t a r t F l u s h i n gf i r e w a l lr u l e s : [ S e t t i n gc h a i n st op o l i c yA C C E P T :m a n g l ef i l t e rn a t [ U n l o a d i n gi p t a b l e sm o d u l e s : [ A p p l y i n gi p t a b l e sf i r e w a l lr u l e s : [ L o a d i n ga d d i t i o n a li p t a b l e sm o d u l e s :i p _ c o n n t r a c k _ n e t b i o s _ n [ O K O K O K O K O K ] ] ] ] ]

Ahora revisamos en los pc y vemos si podemos entrar si todo esta ok la pagina tratara de cargar y despues de un rato mandara el error que supero el tiempo de espera . Revisar bien en todos los pc ya que me paso que solo un pc podia entrar a facebook asi que si nos pasa eso hacemos lo siguiente Ojala con poco trafico en la red.. veremos las conexiones del pc que entra a facebook con tcpdump para ver a que ip se esta conectando.
Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #t c p d u m pie t h 0n" p o r t4 4 3 "v v v t c p d u m p :l i s t e n i n go ne t h 0 ,l i n k t y p eE N 1 0 M B( E t h e r n e t ) ,c a p t u r es i z e9 6b y t e s 1 0 : 1 7 : 5 8 . 4 1 5 1 3 4I P( t o s0 x 0 ,t t l1 2 7 ,i d5 8 9 3 3 ,o f f s e t0 ,f l a g s[ D F ] ,p r o t o :T C P( 6 ) ,l e n g t h :7 7 )1 9 2 . 1 6 8 . 1 . 1 3 1 . m t q p > 6 9 . 1 7 1 . 2 2 8 . 1 4 4 . h t t p s :P ,c k s u m0 x d d 8 a( c o r r e c t ) ,1 7 5 2 9 3 2 1 : 1 7 5 2 9 3 5 8 ( 3 7 )a c k9 4 8 2 0 0 4 5 7w i n6 3 8 6 2

Vemos que el equipo se conecta a una ip que no estabamos bloqueando asi que pasamos a agregarla al archivo. Qedando asi las reglas para facebook.
Cdigo: [Seleccionar]
# b l o q u e of a c e b o o k AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g ed s t r a n g e2 0 4 . 1 5 . 2 0 . 0 2 0 4 . 1 5 . 2 3 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g ed s t r a n g e6 9 . 6 3 . 1 7 6 . 0 6 9 . 6 3 . 1 9 1 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g ed s t r a n g e6 6 . 2 2 0 . 1 4 4 . 0 6 6 . 2 2 0 . 1 5 9 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g ed s t r a n g e6 9 . 1 7 1 . 2 2 8 . 0 6 9 . 1 7 1 . 2 2 8 . 2 5 5jD R O P

Volvemos a reiniciar iptables para que tome los cambios


Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #s e r v i c ei p t a b l e sr e s t a r t F l u s h i n gf i r e w a l lr u l e s : [ S e t t i n gc h a i n st op o l i c yA C C E P T :m a n g l ef i l t e rn a t [ U n l o a d i n gi p t a b l e sm o d u l e s : [ A p p l y i n gi p t a b l e sf i r e w a l lr u l e s : [ L o a d i n ga d d i t i o n a li p t a b l e sm o d u l e s :i p _ c o n n t r a c k _ n e t b i o s _ n [ O K O K O K O K O K ] ] ] ] ]

Ahora los mismos pasos para las demas paginas.

En mi caso este bloqueo es solo para un grupo de personas asi que pesque a ese grupo y lo deje en un rango de ip que es el siguiente 192.168.1.130-192.168.1.135 dejando que el dhcp les entregue las ip dentro de ese rango. Usamos dig con Gmail. y con google ya que ocupan las mismas ip no habran problemas para entrar a google ya que el bloqueo es solo por el puerto 443
Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #d i gg m a i l . c o m ;< < > >D i G9 . 3 . 6 P 1 R e d H a t 9 . 3 . 6 1 6 . P 1 . e l 5< < > >g m a i l . c o m ; ;g l o b a lo p t i o n s : p r i n t c m d ; ;G o ta n s w e r : ; ;> > H E A D E R < < -o p c o d e :Q U E R Y ,s t a t u s :N O E R R O R ,i d :5 4 7 6 ; ;f l a g s :q rr dr a ;Q U E R Y :1 ,A N S W E R :4 ,A U T H O R I T Y :0 ,A D D I T I O N A L :0 ; ;Q U E S T I O NS E C T I O N : ; g m a i l . c o m . ; ;A N S W E RS E C T I O N : g m a i l . c o m . g m a i l . c o m . g m a i l . c o m . g m a i l . c o m .

I N

1 1 6 1 1 6 1 1 6 1 1 6

I N I N I N I N

A A A A

7 4 . 1 2 5 . 2 3 4 . 2 3 7 4 . 1 2 5 . 2 3 4 . 2 1 7 4 . 1 2 5 . 2 3 4 . 2 4 7 4 . 1 2 5 . 2 3 4 . 2 2

; ;Q u e r yt i m e :1 6 6m s e c ; ;S E R V E R :8 . 8 . 8 . 8 # 5 3 ( 8 . 8 . 8 . 8 ) ; ;W H E N :T h uJ u l2 81 0 : 2 7 : 5 12 0 1 1 ; ;M S GS I Z E r c v d :9 1

Cdigo: [Seleccionar]

forum.mitm.cl/index.php?topic=25.0

2/4

21/03/13

how to bloquear gmail, hotmail, facebook por 443 con iptables


[ r o o t @ f w~ ] #d i gg o o g l e . c o m ;< < > >D i G9 . 3 . 6 P 1 R e d H a t 9 . 3 . 6 1 6 . P 1 . e l 5< < > >g o o g l e . c o m ; ;g l o b a lo p t i o n s : p r i n t c m d ; ;G o ta n s w e r : ; ;> > H E A D E R < < -o p c o d e :Q U E R Y ,s t a t u s :N O E R R O R ,i d :5 7 6 2 9 ; ;f l a g s :q rr dr a ;Q U E R Y :1 ,A N S W E R :5 ,A U T H O R I T Y :0 ,A D D I T I O N A L :0 ; ;Q U E S T I O NS E C T I O N : ; g o o g l e . c o m . ; ;A N S W E RS E C T I O N : g o o g l e . c o m . g o o g l e . c o m . g o o g l e . c o m . g o o g l e . c o m . g o o g l e . c o m .

I N

3 0 0 3 0 0 3 0 0 3 0 0 3 0 0

I N I N I N I N I N

A A A A A

7 4 . 1 2 5 . 2 2 9 . 1 1 3 7 4 . 1 2 5 . 2 2 9 . 1 1 2 7 4 . 1 2 5 . 2 2 9 . 1 1 6 7 4 . 1 2 5 . 2 2 9 . 1 1 5 7 4 . 1 2 5 . 2 2 9 . 1 1 4

; ;Q u e r yt i m e :1 8 6m s e c ; ;S E R V E R :8 . 8 . 8 . 8 # 5 3 ( 8 . 8 . 8 . 8 ) y Ahora procedemos a bloquear ; ;W H E N :T h uJ u l2 81 0 : 2 8 : 1 92 0 1 1 ; ;M S GS I Z E r c v d :1 0 8

Abrimos el archivo de iptables y agreamos


Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #n a n o/ e t c / s y s c o n f i g / i p t a b l e s # b l o q u e og m a i lp o rg r u p o s AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g es r c r a n g e1 9 2 . 1 6 8 . 1 . 1 3 0 1 9 2 . 1 6 8 . 1 . 1 3 5d s t r a n g e 7 4 . 1 2 5 . 2 3 4 . 0 7 4 . 1 2 5 . 2 3 4 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g es r c r a n g e1 9 2 . 1 6 8 . 1 . 1 3 0 1 9 2 . 1 6 8 . 1 . 1 3 5d s t r a n g e 7 4 . 1 2 5 . 2 2 9 . 0 7 4 . 1 2 5 . 2 2 9 . 2 5 5jD R O P

reiniciamos iptables
Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #s e r v i c ei p t a b l e sr e s t a r t F l u s h i n gf i r e w a l lr u l e s : [ S e t t i n gc h a i n st op o l i c yA C C E P T :m a n g l ef i l t e rn a t [ U n l o a d i n gi p t a b l e sm o d u l e s : [ A p p l y i n gi p t a b l e sf i r e w a l lr u l e s : [ L o a d i n ga d d i t i o n a li p t a b l e sm o d u l e s :i p _ c o n n t r a c k _ n e t b i o s _ n [ O K O K O K O K O K ] ] ] ] ]

y ahora con hotmail vemos las ip.


Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #d i gh o t m a i l . c o m ;< < > >D i G9 . 3 . 6 P 1 R e d H a t 9 . 3 . 6 1 6 . P 1 . e l 5< < > >h o t m a i l . c o m ; ;g l o b a lo p t i o n s : p r i n t c m d ; ;G o ta n s w e r : ; ;> > H E A D E R < < -o p c o d e :Q U E R Y ,s t a t u s :N O E R R O R ,i d :3 4 2 0 1 ; ;f l a g s :q rr dr a ;Q U E R Y :1 ,A N S W E R :4 ,A U T H O R I T Y :0 ,A D D I T I O N A L :0 ; ;Q U E S T I O NS E C T I O N : ; h o t m a i l . c o m . ; ;A N S W E RS E C T I O N : h o t m a i l . c o m . h o t m a i l . c o m . h o t m a i l . c o m . h o t m a i l . c o m . h o t m a i l . c o m

I N

5 9 6 5 9 6 5 9 6 5 9 6 5 9 6

I N I N I N I N I N

A A A A A

6 5 . 5 5 . 7 2 . 1 8 3 6 5 . 5 5 . 7 2 . 1 3 5 6 5 . 5 5 . 7 2 . 1 5 1 6 5 . 5 5 . 7 2 . 1 6 7 6 5 . 5 4 . 1 8 6 . 1 5 4

; ;Q u e r yt i m e :1 6 3m s e c ; ;S E R V E R :8 . 8 . 8 . 8 # 5 3 ( 8 . 8 . 8 . 8 ) ahora bloqueamos ; ;W H E N :T h uJ u l2 81 0 : 4 1 : 1 02 0 1 1 ; ;M S GS I Z E r c v d :9 3

Cdigo: [Seleccionar]
[ r o o t @ f w~ ] #n a n o/ e t c / s y s c o n f i g / i p t a b l e s # b l o q u e oh o t m a i l AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g es r c r a n g e1 9 2 . 1 6 8 . 1 . 1 3 0 1 9 2 . 1 6 8 . 1 . 1 3 5d s t r a n g e 6 5 . 5 4 . 1 6 5 . 0 6 5 . 5 4 . 1 6 5 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g es r c r a n g e1 9 2 . 1 6 8 . 1 . 1 3 0 1 9 2 . 1 6 8 . 1 . 1 3 5d s t r a n g e 6 5 . 5 4 . 1 8 6 . 0 6 5 . 5 4 . 1 8 6 . 2 5 5jD R O P AF O R W A R Dpt c pmt c pd p o r t4 4 3mi p r a n g es r c r a n g e1 9 2 . 1 6 8 . 1 . 1 3 0 1 9 2 . 1 6 8 . 1 . 1 3 5d s t r a n g e 6 5 . 5 5 . 7 2 . 0 6 5 . 5 5 . 7 2 . 2 5 5jD R O P

reiniciamos iptables
Cdigo: [Seleccionar]

forum.mitm.cl/index.php?topic=25.0

3/4

21/03/13

how to bloquear gmail, hotmail, facebook por 443 con iptables


[ r o o t @ f w~ ] #s e r v i c ei p t a b l e sr e s t a r t F l u s h i n gf i r e w a l lr u l e s : [ S e t t i n gc h a i n st op o l i c yA C C E P T :m a n g l ef i l t e rn a t [ U n l o a d i n gi p t a b l e sm o d u l e s : [ A p p l y i n gi p t a b l e sf i r e w a l lr u l e s : [ L o a d i n ga d d i t i o n a li p t a b l e sm o d u l e s :i p _ c o n n t r a c k _ n e t b i o s _ n [ O K O K O K O K O K ] ] ] ] ]

Y listo tenemos todo bloqueados.. Yo recomendaria revisar los bloqueos periodicamente ya que si se les para la raja pueden comprar otro rango de ips..

Ahora preparence para las puteas en la oficina por ser el Sysadmin Pesao que bloquea los sitios entretenidos Saludos y que les sirva...

En lnea

ksha
Administrator Newbie Mensajes: 22

Re: how to bloquear gmail, hotmail, facebook por 443 con iptables
Respuesta #1 en: Julio 29, 2011, 12:57:19 pm

tu solucion es buena pero recomiendo mejor hacer un tcpdump conectandote a alguno de esos sitios y obteniendo el certificado. realizas las siguientes rules.
Cdigo: [Seleccionar]
i p t a b l e sII N P U Tms t r i n ga l g ob mh e x s t r i n g ' | 4 7 6 f 6 f 6 7 6 c 6 5 2 0 4 9 6 e 6 3 3 1 1 8 3 0 1 6 0 6 0 3 5 5 0 4 0 3 1 4 0 f 6 d 6 1 6 9 6 c 2 e 6 7 6 f 6 f 6 7 6 c 6 5 2 e 6 3 6 f 6 d 3 0 8 1 9 f 3 0 | ' jD R O P

curl --connect-timeout 60 https://mail.google.com/ curl: (28) SSL connection timeout


En lnea Pginas: [1]
I M P RI M I R

anterior prximo
MitM Labs Networking General (Moderador: r4c3) how to bloquear gmail, hotmail, facebook por 443 con iptables

Ir a: => Ge ne ral

ir

SMF 2.0.1 | SMF 2011, Simple Machines


Reference by, Crip XHTML RSS WAP2

forum.mitm.cl/index.php?topic=25.0

4/4

Potrebbero piacerti anche