Linux Correo
-
Upload
karla-techi -
Category
Documents
-
view
192 -
download
0
Transcript of Linux Correo
![Page 1: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/1.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Servicios de correo con GNU/Linux
2011-07-12 (v1.0)
![Page 2: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/2.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Fabian Portantier
● Consultor en Seguridad Informática
● Fanático de GNU/Linux (Debian)
● Mail: [email protected]
● Web: www.portantier.com
![Page 3: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/3.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
¿Qué es el correo electrónico?
![Page 4: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/4.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
MDA MTAsi.com
MTAno.com
MDA
INTERNET
Mailbox
Mailbox
Componentes
![Page 5: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/5.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Protocolos Involucrados
![Page 6: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/6.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
DNS – Jerarquía de nombres
![Page 7: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/7.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
DNS registros involucrados
● MX: Mail Exchange
● PTR: Pointer
![Page 8: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/8.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
DNS en el correo electrónico
● Consulta a registros MX
● Verificación de registros PTR
![Page 9: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/9.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
DNSfabian@debian:~$ dig gmail.com MX
; <<>> DiG 9.7.3 <<>> gmail.com MX;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56005;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:;gmail.com. IN MX
;; ANSWER SECTION:gmail.com. 3567 IN MX 20 alt2.gmail-smtp-in.l.google.com.gmail.com. 3567 IN MX 30 alt3.gmail-smtp-in.l.google.com.
;; Query time: 14 msec;; SERVER: 192.168.0.1#53(192.168.0.1);; WHEN: Mon May 30 00:23:17 2011;; MSG SIZE rcvd: 150
![Page 10: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/10.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
SMTP
● Simple Mail Transfer Protocol
● RFC 821(Original)
● RFC 1123 (Correcciones)
● RFC 2821 (ESMTP)
![Page 11: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/11.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
SMTP
● Basado en intercambio de textos
● Preguntas y Respuestas
● Puerto TCP 25
● Sin autenticación
![Page 12: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/12.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
SMTP-AUTH
● Extensión de SMTP
● Verificación de clientes
● Control de Accesos
![Page 13: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/13.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Telnet a un servidor SMTPfabian@debian:~$ telnet alt2.gmail-smtp-in.l.google.com 25Trying 74.125.77.27...Connected to alt2.gmail-smtp-in.l.google.com.Escape character is '^]'.220 mx.google.com ESMTP s7si8758240eeb.92HELO fabian.debian.org250 mx.google.com at your serviceMAIL FROM: <[email protected]>250 2.1.0 OK s7si8758240eeb.92RCPT TO: <[email protected]>250 2.1.5 OK s7si8758240eeb.92DATA354 Go ahead s7si8758240eeb.92TEXTO QUE QUIEROENVIAR POR CORREO..550-5.7.1 [186.58.27.102] The IP you're using to send mail is not authorized to550-5.7.1 send email directly to our servers. Please use the SMTP relay at your550-5.7.1 service provider instead.
![Page 14: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/14.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Open Source SMTP Servers
● Postfix
● Sendmail
● Exim
● Varios más...
![Page 15: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/15.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
¿Cual elegir?
de tin, marín dedo pingüé...cucara macara piquere...
![Page 16: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/16.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Postfix !
(www.postfix.org)
![Page 17: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/17.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Ventajas de Postfix
● Estable
● Seguro
● Rápido
● Flexible
● Fácil
![Page 18: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/18.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Instalación en Debian GNU/Linux
apt-get install postfix
;)
![Page 19: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/19.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/postfix/main.cf
/etc/postfix/master.cf
Archivos de Configuración
![Page 20: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/20.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
main.cf
myorigin = $myhostname
mydestination = $myhostname localhost.$mydomain localhost $mydomain
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
#delay_warning_time = 4h
readme_directory = no
![Page 21: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/21.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Enviando mails localmente
echo "CONTENIDO DEL CORREO" | mail -s "mail de prueba" fabian
![Page 22: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/22.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Leyendo mails (I)
fabian@debian:~$ cat /var/mail/fabian From [email protected] Tue May 31 16:36:53 2011Return-Path: <[email protected]>X-Original-To: fabianDelivered-To: [email protected]: by debian.localdomain (Postfix, from userid 0)
id 15EB982E35; Tue, 31 May 2011 16:36:53 -0300 (ART)To: [email protected]: mail de pruebaMessage-Id: <[email protected]>Date: Tue, 31 May 2011 16:36:53 -0300 (ART)From: [email protected] (root)Status: ROContent-Length: 21Lines: 1
CONTENIDO DEL CORREO
![Page 23: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/23.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Leyendo mails (II)
mutt
![Page 24: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/24.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Herramientas
● postconf: Consultar / modificar configuración
● postsuper: Gestión de colas y correos
● qshape: Reporta el estado de las colas
● sendmail: Envía correos
● Algunas otras...
![Page 25: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/25.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Tipos de Direcciones
● Correo local: cuentas de shell del propio sistema
● Casillas virtuales: no tienen cuenta de shell, pero somos el destino final de las mismas
● Alias virtuales: Siempre se redirigen, aunque puede que vuelvan al mismo servidor
● Relay: Sólo si actuamos como nodo de reenvío de correo.
![Page 26: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/26.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Bind (I)
/etc/bind/named.conf.local
zone "example.com" { type master; file "/etc/bind/zones/example.com.db"; };
![Page 27: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/27.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Bind (II)
/etc/bind/zones/example.com.db
example.com. IN SOA ns1.example.com. admin.example.com. ( 2006081401 28800 3600 604800 38400 )
example.com. IN NS ns1.example.com.example.com. IN MX 10 mta.example.com.
www IN A 192.168.0.2mta IN A 127.0.0.1ns1 IN A 192.168.0.1
![Page 28: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/28.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Nuestra infraestructura de correo
● Configuración del servidor DNS
● Configuración de dominios en Postfix
● Enviar correos entre servidores
![Page 29: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/29.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Servidor DNS
/etc/bind/named.conf.local
zone "hosted.com" { type master; file "/etc/bind/zones/hosted.com.db"; };
![Page 30: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/30.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Servidor DNS
/etc/bind/named/zones/hosted.com.db
hosted.com. IN SOA ns1.hosted.com. admin.hosted.com. ( 201006071 ; serial 8H ; refresh 2H ; retry 4W ; expire 1D ; minimum TTL )
hosted.com. IN NS ns1.hosted.com.hosted.com. IN MX 10 mta.hosted.com.
www IN A 172.16.66.1mta IN A 172.16.66.1ns1 IN A 172.16.66.1
![Page 31: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/31.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dominios en Postfix
/etc/postfix/main.cf
mydomain = hosted.commyorigin = $mydomainmydestination = $myhostname localhost localhost.$mydomain $mydomain
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = noappend_dot_mydomain = noreadme_directory = no
![Page 32: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/32.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Enviando correos con telnet
telnet mailserver.com 25MAIL FROM: [email protected]: TO: [email protected]
Subject: holaFrom: [email protected] To: [email protected] del mensaje.
![Page 33: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/33.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Encabezados
Date Fecha (requerido)From Emisor (requerido)Message-Id Identificador únicoTo ReceptorSubject AsuntoCc Otros recipientesReply-To A quién responder el mensajeContent-type Estructura del mensajeMIME-Version Cumplimiento RFC1521Received Camino tomadoReturn-Path Identifica el camino de vuelta
![Page 34: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/34.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Encabezados Extendidos
No son estándar, y se utilizan para propósitos informativos. La cantidad total no está documentada.
Ejemplos:
X-Mailer: Ximian Evolution 1.4.3X-Priority: 3X-Spam-Checker-Version: dspam-1.0.3
![Page 35: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/35.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Cuerpo del mensaje (body)
Debe ser sólo texto plano y seguirle inmediamente a los encabezados.
Puede contener archivos adjuntos, preferentemente codificados en 7-bits (para que el MTA no los rompa).
![Page 36: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/36.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Archivos adjuntos
Deben ser convertidos a texto plano(sólo caracteres imprimibles)
![Page 37: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/37.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Codificación MIME Base 64
Multipurpose Internet Mail Extensions
Definida en RFC 1421 y RFC 2045
Permiten convertir archivos binarios a ASCII
Caracteres A-Z, a-z, 0-9, '+' y '/'. ('=' para sufijos.)
Herramientas: mpack, munpack, uudeview.
Usado en casi todos los clientes modernos (v 1.0)
![Page 38: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/38.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Tipos de contenido
El tipo de contenido codificado en MIME, definido por el IANA. (No sólo aplican al email)
Referencias:http://en.wikipedia.org/wiki/Internet_media_typewww.iana.org/assignments/media-types
Ejemplo:Content-type: text/plain
![Page 39: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/39.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Content-type (valores comunes)
text/plainTexto simple. El valor por defecto.
multipart/mixedIndica que hay texto y archivos adjuntos.
message/rfc822Adjunta otro correo electrónico
multipart/alternativeAdjunta una versión alternativa (ejemplo: texto y html)
![Page 40: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/40.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Límite MIME (boundary)
Separa las distintas partes del mensaje
Ejemplo:Content-Type: multipart/mixed; boundary='/9DWx/yDrb'
--/9DWx/yDrbContent-Type: text/plain; charset=us-ascii
--/9DWx/yDrbContent-Type: application/x-zip-compressedContent-Disposition: attachment; filename=”file.zip”Content-Transfer-Encoding: base64
![Page 41: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/41.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Control de contenidos
smtpd_*_restrictionsFiltros para origen y destino
*_checksFiltros para body, headers, attachments
FiltrosMecanismos de filtrado externos
![Page 42: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/42.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Restricciones por origen / destino
● ¿De dónde viene el cliente?
● ¿Quién pretende ser el cliente?
● ¿El cliente tiene privilegios especiales?
● ¿Quién es el remitente?
● ¿Quién es el destinatario?
![Page 43: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/43.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Restricciones por origen / destino
● ¿Se brindó la información de forma adecuada?
● ¿Se brindó en el orden apropiado?
● ¿Se brindó toda la información?
● ¿Es posible corroborar esa información?
![Page 44: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/44.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Restricciones por origen / destino
● El mensaje no es recibido por el servidor
● No se envían notificaciones de rechazo
● La responsabilidad queda en el cliente
![Page 45: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/45.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Restricciones por origen / destino
smtpd_client_restrictionsIP y/o el Hostname del cliente
smtpd_helo_restrictionsEl anterior, más argumento de HELO/EHLO
smtpd_sender_restrictionsEl anterior, más el argumento de 'MAIL FROM'
smtpd_recipient_restrictionsEl anterior, más el argumento de 'RCPT TO'
![Page 46: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/46.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Restricciones por origen / destino
smtpd_data_restrictionsDetecta envío de contenido antes de 'DATA'
smtpd_etrn_restrictionsDefine qué clientes pueden utilizar el comando 'ETRN'
ETRN: Pide al servidor limpiar la cola de mails
![Page 47: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/47.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Tipos de restricción
Genéricas
permitdeferrejectwarn_if_rejectreject_unauth_pipelining
![Page 48: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/48.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Tipos de restricción
Intercambiables
smtpd_helo_required (requiere helo/ehlo)strict_rfc821_envelopes (no recomendado)disable_vrfy_command (deshabilita VRFY)allow_percent_hack (% → @)swap_bangpath (! → @, redes UUCP)
![Page 49: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/49.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Cumplimiento de estándares
smtpd_helo_required = yes
![Page 50: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/50.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Aplicando restricciones
Bloquea las direcciones IP listadas
smtpd_client_restrictions =check_client_access hash:/etc/postfix/clients
![Page 51: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/51.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Aplicando restricciones
Filtra el HELO/EHLO
smtpd_helo_restrictions = check_helo_access pcre:/etc/postfix/helo_checks
![Page 52: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/52.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Aplicando restricciones
Filtra las direcciones del archivo 'senders'Filtra los remitentes de dominios que no existen
smtpd_sender_restrictions =check_sender_access hash:/etc/postfix/sendersreject_unknown_sender_domain
![Page 53: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/53.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Aplicando restricciones
Bloquea si no somos 'forwarders' o 'destinatarios'
smtpd_recipient_restrictions =reject_unauth_destination
![Page 54: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/54.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Aplicando restricciones
Bloquea a los clientes que hacen 'pipelining' sin que el servidor se los haya permitido
smtpd_data_restrictions =reject_unauth_pipelining
![Page 55: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/55.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Peleando contra los virus
![Page 56: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/56.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Clamsmtp
● Utiliza ClamAV para la detección de virus
● Escucha en un puerto TCP
● Recibe los correos, los analiza y los devuelve
● Postfix los toma de nuevo y los procesa
● Permite correr scripts al detectar virus
![Page 57: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/57.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Clamsmtp
apt-get install clamsmtpd
![Page 58: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/58.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/clamsmtpd.conf
OutAddress: 10025
Listen: 127.0.0.1:10026
Header: X-AV-Checked: ClamAV using ClamSMTP
Bounce: off
Quarantine: off
![Page 59: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/59.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/postfix/main.cf
#Define el filtro a utilizarcontent_filter = scan:127.0.0.1:10026
#Procesa el correo sin modificarreceive_override_options = no_address_mappings
![Page 60: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/60.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/postfix/master.cf
# AV scan filter (used by content_filter)scan unix - - n - 16 smtp -o smtp_send_xforward_command=yes
![Page 61: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/61.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/postfix/master.cf
# For injecting mail back into postfix from the filter127.0.0.1:10025 inet n - n - 16 smtpd -o content_filter= -o receive_override_options=
no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=
permit_mynetworks, reject -o mynetworks_style=host -o smtpd_authorized_xforward_hosts=127.0.0.0/8
![Page 62: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/62.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
La prueba EICAR
ftp://download.trendmicro.com/products/eicar-file/eicar.com
![Page 63: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/63.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Logs
postfix/smtp[5450]: 67DC183233: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10026, delay=0.36, delays=0.17/0.08/0.11/0, dsn=2.0.0, status=sent (250 Virus Detected; Discarded Email)
clamsmtpd: 100005: [email protected], [email protected], status=VIRUS:Eicar-Test-Signature
![Page 64: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/64.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Peleando contra el spam
![Page 65: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/65.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Tipos de filtrado
● Sesión SMTP● Origen / Destino● Encabezados / Archivos adjuntos● Búsqueda de patrones● Análisis Bayesiano● DNSBL o RBL
![Page 66: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/66.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
disable_vrfy_command = yessmtpd_helo_required = yessmtpd_recipient_restrictions = reject_unknown_sender_domain reject_unknown_recipient_domain reject_rbl_client list.dsbl.org reject_rbl_client sbl.spamhaus.org reject_rbl_client cbl.abuseat.org reject_rbl_client dul.dnsbl.sorbs.net
/etc/postfix/main.cf
![Page 67: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/67.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/postfix/main.cf
smtpd_helo_restrictions =permit_mynetworksreject_invalid_hostname *reject_unknown_helo_hostname *reject_non_fqdn_hostname *
* Dependiendo del caso, puede no ser recomendable.
![Page 68: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/68.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
/etc/postfix/main.cf
smtpd_client_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/client_restrictions reject_rbl_client sbl-xbl.spamhaus.org reject_rbl_client cn.countries.nerd.dk reject_rbl_client kr.countries.nerd.dk reject_rbl_client pl.countries.nerd.dk reject_rbl_client sa.countries.nerd.dk reject_rbl_client zen.spamhaus.org
![Page 69: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/69.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Recomendado
default_rbl_reply = $rbl_code Service unavailable; $rbl_class [$rbl_what] blocked using $rbl_domain${rbl_reason?; $rbl_reason}. For whitelisting, contact via http://mydomain.dom/blocked.php
![Page 70: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/70.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Almacenamiento de correos
![Page 71: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/71.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
mbox
● Todos los correos en un sólo archivo● Cada correo empieza con “From ”● El final lo marca una línea en blanco● Antiguamente popular● No está definido en ninguna RFC● Presenta problemas de bloqueo
![Page 72: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/72.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
mbox
From [email protected] Sat Aug 03 2002Received: from ... by ... with ESMTP;Subject: PruebaFrom: <[email protected]>To: <[email protected]>
>Desde el principio de los tiempos, la gente ha escrito cartas.
From [email protected] Sun Aug 04 2002Received: from ... by ... with SMTPSubject: IggeretTo: <[email protected]>
Ha iggeret hazot niktava blashon ivrit.
![Page 73: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/73.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Maildir
● Cada correo en un archivo único
● Subdirectorios 'tmp', 'new' y 'cur'
● De 'tmp' los mensajes pasan a 'new'
● Los clientes de correo mueven de 'new' a 'cur'
● Maildir++
![Page 74: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/74.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Protocolo IMAP
![Page 75: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/75.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
IMAP
● Internet Message Access Protocol
● Versión actual: IMAP 4 Revisión 1 (IMAP4rev1)
● RFC 3501 (http://tools.ietf.org/html/rfc3501)
![Page 76: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/76.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Ventajas IMAP vs POP3
● Modos de operación online / offline● Soporte para múltiples clientes simultáneos● Acceso a partes MIME● Estado de los mensajes del lado del servidor● Búsquedas del lado del servidor● Preparado para ser extensible
![Page 77: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/77.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
El Proyecto Dovecot
![Page 78: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/78.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
● Open Source (www.dovecot.org)
● Primera versión: Junio 2002
● Pensado para ser rápido, seguro y fácil
● Soporta mbox y Maildir
![Page 79: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/79.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
apt-get install dovecot-imapd
![Page 80: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/80.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
/etc/dovecot/dovecot.conf
mail_location: mbox:~/mail:INBOX=/var/mail/%u
![Page 81: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/81.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
dovecot -n
![Page 82: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/82.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
# telnet 127.0.0.1 143Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is '^]'.* OK [CAPABILITY IMAP4rev1] Dovecot Ready.. login fabian password. OK [CAPABILITY IMAP4rev1] Logged in
![Page 83: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/83.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
. list "" "*"* LIST (\NoInferiors \Marked) "/" "INBOX". OK List completed.
. status INBOX (messages)* STATUS "INBOX" (MESSAGES 29). OK Status completed.
. select INBOX
![Page 84: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/84.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
. fetch 29 rfc822.header* 29 FETCH (RFC822.HEADER {618}Delivered-To: [email protected]: from debian.example.com (localhost [127.0.0.1])To: [email protected]: mememeDate: Tue, 21 Jun 2011 23:47:53 -0300 (ART)From: [email protected] (root)). OK Fetch completed.
![Page 85: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/85.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Dovecot
. fetch 29 rfc822.text* 29 FETCH (RFC822.TEXT {7}Este es el cuerpo del mensaje). OK Fetch completed.
. logout* BYE LOGOUT received. OK CompletedConnection closed by foreign host.
![Page 86: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/86.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Servicios de Webmail
![Page 87: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/87.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Webmail
● Facilitan el trabajo remoto
● Reemplazan al cliente de correo
● Varios proyectos disponibles
![Page 88: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/88.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Webmail
● Squirrelmail (http://squirrelmail.org)
● Roundcube (http://roundcube.net)
● Horde3 (www.horde.org)
● Muchos más!
![Page 89: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/89.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
● Open Source
● Desarrollado en PHP
● Primera versión en 1999
● Muy estable y utilizado
![Page 90: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/90.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
apt-get install squirrelmail
![Page 91: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/91.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
/etc/squirrelmail/config.php
/etc/squirrelmail/config_local.php
/etc/squirrelmail/conf.pl
![Page 92: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/92.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
copiar:/etc/squirrelmail/apache.conf
a:/etc/apache2/sites-enabled/squirrelmail
![Page 93: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/93.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
/etc/init.d/apache restart
![Page 94: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/94.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
# firefox http://127.0.0.1/squirrelmail
![Page 95: Linux Correo](https://reader034.fdocuments.ec/reader034/viewer/2022051323/547cde3cb4af9f21098b45e4/html5/thumbnails/95.jpg)
Portantier Information Security – Servicios de Correo con GNU/Linux
Squirrelmail
Webmail :)