The Wiki has moved to new hardware, and the old server died.
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
es:howtos:network_services:postfix_with_cyrus [2019/02/16 15:37 (UTC)] pedro.herrero |
es:howtos:network_services:postfix_with_cyrus [2019/02/16 16:38 (UTC)] pedro.herrero Finished. Comments and corrections welcome |
||
---|---|---|---|
Línea 1: | Línea 1: | ||
- | <note important>Site under translation, please wait (pedro.herrero)</note> | + | ====== Creación de un servidor de correo Slackware ====== |
+ | Este artículo muestra cómo hacer de una máquina Slackware su servidor de correo personal. Este HOWTO es para Slackware 64 13.37, pero con pocos cambios puedes adaptarlo al miembro más nuevo de la familia Slackware 14. | ||
- | ====== Making Slackware Mail Server ====== | + | Antes de empezar debo decir que se necesita una instalación normal de Slackware, sin ningún paquete especial. Los paquetes que necesitaremos para crear el servidor de correo los descargaremos e instalaremos manualmente desde Slackbuilds.org. Prefiero el método de autenticación Cyrus SASL y Cyrus IMAP para el inicio de sesión remoto, en lugar de otras alternativas como qpopper o dovecot. |
- | This article shows how to make an Slackware machine your personal Mail Server. This howto is for Slackware 64 13.37, but with few changes you can adapt it to the newest member of Slackware familly Slackware 14. | + | Comencemos entonces, necesitaremos instalar Cyrus-SASL, Postfix, Cyurs-IMAP y luego configurarlos todos para que usen certificados para encriptar los paquetes de correo que atraviesan Internet. |
- | Before we begin I must say that you need a normal installation of Slackware, without any special packages. The packages we will need to make the Mail Server we will manually download and install from Slackbuilds.org. I preffer the Cyrus SASL authentication method and Cyrus IMAP for remote login, insted of other alternatives like qpopper or dovecot. | ||
- | Let's get started then , we will need to install Cyrus-SASL, Postfix, Cyurs-IMAP and then configure them all to use Certificates for encrypting the mail packages that traverse the Internet. | ||
- | ====== Installing Cyrus-SASL ====== | + | ====== Instalación de Cyrus-SASL ====== |
Línea 24: | Línea 23: | ||
# joe cyrus-sasl.SlackBuild | # joe cyrus-sasl.SlackBuild | ||
| | ||
- | and add the following lines after "--disable static" | + | y añada las siguientes líneas después de "--disable static" |
| | ||
--enable-plain \ | --enable-plain \ | ||
Línea 33: | Línea 32: | ||
- | ====== Installing Postfix ====== | + | ====== Instalación de Postfix ====== |
# cd /tmp | # cd /tmp | ||
Línea 48: | Línea 47: | ||
# joe postfix.Slackbuild | # joe postfix.Slackbuild | ||
| | ||
- | Edit the following line and replace "dovecot" with "cyrus" like this | + | Edite la siguiente línea y sustituya "dovecot" por "cyrus" de la siguiente manera |
SASL=${SASL:-cyrus} | SASL=${SASL:-cyrus} | ||
| | ||
- | In order to begin Postfix installation you will need to create postfix user and group (also keep in mind that we need to add user postfix and user cyrus to the same group, mail group that is). | + | Para comenzar la instalación de Postfix necesitará crear un usuario y un grupo de postfix (también tenga en cuenta que necesitamos añadir el usuario postfix y el usuario cyrus al mismo grupo, es decir, al mismo grupo de correo). |
# groupadd -g 200 postfix | # groupadd -g 200 postfix | ||
Línea 60: | Línea 59: | ||
# installpkg /tmp/postfix-2.8.3-x86_64-1_SBo.tgz | # installpkg /tmp/postfix-2.8.3-x86_64-1_SBo.tgz | ||
- | Before we continue with installation of IMAP server we need to assure that Postfix is working and we can authenticate with sasl. Let's make some basic Postfix configuration and some basic SASL configuration. I will be explaining plain auth because later on we will use it togheter with SASL to authenticate. | + | Antes de continuar con la instalación del servidor IMAP necesitamos asegurarnos de que Postfix funciona y que podemos identificarnos con sasl. Vamos a hacer una configuración básica de Postfix y una configuración básica de SASL. Explicaré la identificación simple porque más tarde la usaremos junto con SASL para identificarnos. |
- | First of all we need to make our aliases and tell Postfix to use aliases maps from /etc/postfix/aliases, so : | + | En primer lugar tenemos que hacer nuestros alias y decirle a Postfix que utilice los mapas de alias de /etc/postfix/aliases, así que: |
# joe /etc/postfix/main.cf | # joe /etc/postfix/main.cf | ||
| | ||
- | Edit these lines and make them look like this : | + | Edite estas líneas y haga que tengan el siguiente aspecto: |
alias_maps = hash:/etc/postfix/aliases | alias_maps = hash:/etc/postfix/aliases | ||
alias_database = hash:/etc/postfix/aliases | alias_database = hash:/etc/postfix/aliases | ||
| | ||
- | Now let's add a user to the Slackware machine, a user who will also can read and send mail. | + | Ahora vamos a añadir un usuario a la máquina Slackware, un usuario que también pueda leer y enviar correo. |
# adduser | # adduser | ||
| | ||
Login name for new user []: slackware_user | Login name for new user []: slackware_user | ||
- | User ID ('UID') [ defaults to next available ]: press ENTER | + | User ID ('UID') [ defaults to next available ]: pulse ENTER |
Initial group [ users ]: 200 | Initial group [ users ]: 200 | ||
- | Home directory [ /home/xxxxxx ]: press ENTER | + | Home directory [ /home/xxxxxx ]: pulse ENTER |
Shell [ /bin/bash ]: /bin/false | Shell [ /bin/bash ]: /bin/false | ||
Do you wish to change the sheel? (Y/n): n | Do you wish to change the sheel? (Y/n): n | ||
- | Expiry date (YYYY-MM-DD) []: press ENTER | + | Expiry date (YYYY-MM-DD) []: pulse ENTER |
- | Press ENTER and imput full name and other account relates stuff. Also specify an password for your newly created user. | + | Presione ENTER e introduzca el nombre completo y otras cosas relacionadas con la cuenta. También especifique una contraseña para el usuario recién creado. |
| | ||
- | Now edit /etc/postfix/aliases and modifiy it to your needs : | + | Ahora edite /etc/postfix/aliases y modifíquelo según sus necesidades: |
root : slackware_user | root : slackware_user | ||
office: slackware_user | office: slackware_user | ||
| | ||
- | Now update your aliases database issuing the command : | + | Ahora actualice su base de datos de alias con el comando..: |
# postalias hash:/etc/postfix/aliases | # postalias hash:/etc/postfix/aliases | ||
- | It is now time to make our important configurations for Postfix in order for it to run. | + | Ahora es el momento de hacer nuestras configuraciones importantes para Postfix para que funcione. |
# joe /etc/postfix/main.cf | # joe /etc/postfix/main.cf | ||
- | myhostname = mx.yourdomain.tld | + | myhostname = mx.tudominio.tld |
- | mydomain = yourdomain.tld | + | mydomain = tudominio.tld |
myorigin = $mydomain | myorigin = $mydomain | ||
inet_interfaces = all | inet_interfaces = all | ||
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain | mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain | ||
mynetworks = 127.0.0.0/8 | mynetworks = 127.0.0.0/8 | ||
- | Let's now configure Postfix to authenticate users using SASL | + | Ahora configuremos Postfix para autenticar usuarios usando SASL |
# mkdir /etc/sasl2 | # mkdir /etc/sasl2 | ||
# cd /etc/sasl2 | # cd /etc/sasl2 | ||
Línea 108: | Línea 107: | ||
pwcheck_method: saslauthd | pwcheck_method: saslauthd | ||
mech_list: PLAIN LOGIN | mech_list: PLAIN LOGIN | ||
- | Now let's configure Postfix to have users authenticate using SASL. Edit /etc/postfix/main.cf and add the folowing code to the end of the file : | + | Ahora vamos a configurar Postfix para que los usuarios se identifiquen usando SASL. Edite /etc/postfix/main.cf y añada el siguiente código al final del archivo: |
smtpd_sasl_auth_enable = yes | smtpd_sasl_auth_enable = yes | ||
broken_sasl_auth_clients = yes | broken_sasl_auth_clients = yes | ||
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination | smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination | ||
- | Let's start the daemons and test our configurations until now: | + | Iniciemos los demonios y probemos nuestras configuraciones hasta ahora: |
# saslauthd -a shadow | # saslauthd -a shadow | ||
# postfix start | # postfix start | ||
- | Then from another machine telnet into your mail server on port 25 and issue the following commands : | + | Luego, desde otra máquina haga telnet a su servidor de correo en el puerto 25 y ejecute los siguientes comandos : |
# telnet mx.mailserver.com 25 | # telnet mx.mailserver.com 25 | ||
ehlo user.mailserver.tld | ehlo user.mailserver.tld | ||
Línea 140: | Línea 139: | ||
250 2.0.0 Ok: queued as 4C0EE221E93 | 250 2.0.0 Ok: queued as 4C0EE221E93 | ||
QUIT | QUIT | ||
- | <note>In order to find out the string after AUTH PLAIN enter the command ''printf 'user\0user\0password' | mmencode'' on your mail server, where user is your username and password is your password</note> | + | <note>Para encontrar la cadena después de AUTH PLAIN introduzca el comando ''printf 'user\0user\0password' | mmencode'' en su servidor de correo, donde usuario es su nombre de usuario y contraseña es su contraseña.</note> |
- | <note important>Rember to put the "." at the end so the mail can be sent to qeue daemon </note> | + | <note important>Recuerde poner el "." al final para que el correo pueda ser enviado a la cola del demonio. </note> |
- | ====== Installing Mail Delivery and Cyrus IMAP ====== | + | ====== Instalación de Mail Delivery y Cyrus IMAP ====== |
# cd /tmp | # cd /tmp | ||
Línea 171: | Línea 170: | ||
# /usr/doc/cyrus-imapd-2.4.12/tools/mkimap | # /usr/doc/cyrus-imapd-2.4.12/tools/mkimap | ||
# su - root | # su - root | ||
- | Edit /etc/imapd.conf and add the following lines: | + | Edite /etc/imapd.conf y añada las siguientes líneas: |
sasl_mech_list: PLAIN LOGIN | sasl_mech_list: PLAIN LOGIN | ||
allowplaintext: yes | allowplaintext: yes | ||
- | Edit /etc/postfix/main.cf and at mailbox_transport add the following: | + | Edite el archivo /etc/postfix/main.cf y añada lo siguiente en mailbox_transport: |
mailbox_transport = lmtp:unix:/var/imap/socket/lmtp | mailbox_transport = lmtp:unix:/var/imap/socket/lmtp | ||
- | The last step to do is to add users to your imap server. For that you need to issue these commands : | + | El último paso es añadir usuarios a su servidor imap. Para ello es necesario que ejecute el siguiente comando: |
# passwd cyrus | # passwd cyrus | ||
- | and add a password for cyrus user | + | y añada una contraseña para el usuario cyrus |
# cyradm --user cyrus --server localhost --auth plain | # cyradm --user cyrus --server localhost --auth plain | ||
localhost>cm user.slackware_user | localhost>cm user.slackware_user | ||
localhost>lm | localhost>lm | ||
localhost> quit | localhost> quit | ||
- | <note>slackware_user is the user you have created in your slackware machine</note> | + | <note>slackware_user es el usuario que haya creado en su máquina slackware</note> |
- | At this point we have an functional Mail Server but with users authenticating in plain text . So the next step is innevitabile. | + | En este punto tenemos un servidor de correo funcional pero con usuarios identificándose en texto plano. Así que el siguiente paso es inevitable. |
- | ====== SSL / TLS Postfix and Cyrus ====== | + | ====== SSL / TLS en Postfix y Cyrus ====== |
- | Let's start by creating our certificates and configuring POSTFIX to use STARTTLS. | + | Comencemos por crear nuestros certificados y configurar POSTFIX para usar STARTTLS. |
# cd /etc/ssl | # cd /etc/ssl | ||
- | # misc/CA.pl -newca ( complete all entries) | + | # misc/CA.pl -newca ( complete todas las entradas) |
# openssl req -new -nodes -keyout mailkey.pem -out mailreq.pem -days 36500 | # openssl req -new -nodes -keyout mailkey.pem -out mailreq.pem -days 36500 | ||
# openssl ca -out mail_signed_cert.pem -infiles mailreq.pem | # openssl ca -out mail_signed_cert.pem -infiles mailreq.pem | ||
Línea 198: | Línea 197: | ||
# chmod 400 /etc/postfix/mailkey.pem | # chmod 400 /etc/postfix/mailkey.pem | ||
# cp /etc/ssl/demoCA/cacert.pem /etc/postfix | # cp /etc/ssl/demoCA/cacert.pem /etc/postfix | ||
- | Now add the followings to /etc/postfix/main.cf : | + | Ahora agregue lo siguiente a /etc/postfix/main.cf: |
smtpd_use_tls = yes | smtpd_use_tls = yes | ||
smtpd_tls_key_file = /etc/postfix/mailkey.pem | smtpd_tls_key_file = /etc/postfix/mailkey.pem | ||
smtpd_tls_cert_file = /etc/postfix/mail_signed_cert.pem | smtpd_tls_cert_file = /etc/postfix/mail_signed_cert.pem | ||
smtpd_tls_CAfile = /etc/postfix/cacert.pem | smtpd_tls_CAfile = /etc/postfix/cacert.pem | ||
- | <note important>In /etc/postfix/master.cf delete the "#" sign from smtps and the next two columns from it | + | <note important>En /etc/postfix/master.cf borre el signo "#" de smtps y las siguientes dos columnas suyas. |
smtps inet n - n - - smtpd | smtps inet n - n - - smtpd | ||
-o smtpd_tls_wrappermode=yes | -o smtpd_tls_wrappermode=yes | ||
-o smtpd_sasl_auth_enable=yes | -o smtpd_sasl_auth_enable=yes | ||
</note> | </note> | ||
- | Now let's configure IMAP to use STARTTLS | + | Ahora vamos a configurar IMAP para usar STARTTLS |
# openssl req -new -nodes -out req.pem -keyout key.pem | # openssl req -new -nodes -out req.pem -keyout key.pem | ||
# openssl rsa -in key.pem -out new.key.pem | # openssl rsa -in key.pem -out new.key.pem | ||
Línea 221: | Línea 220: | ||
# echo tls_key_file: /var/imap/server.pem >> /etc/imapd.conf | # echo tls_key_file: /var/imap/server.pem >> /etc/imapd.conf | ||
| | ||
- | ====== Adding daemons to rc.local ====== | + | ====== Agregar demonios a rc.local ====== |
| | ||
- | Now the last step is to add all daemons to rc.local so they can start when machine boots. So open /etc/rc.d/rc.local and add these lines : | + | Ahora el último paso es añadir todos los demonios a rc.local para que puedan iniciarse cuando la máquina arranque. Así que abra /etc/rc.d/rc.local y añada estas líneas : |
- | # Starting saslauthd daemon | + | # Iniciando el demonio saslauthd |
if [ ! -r /var/state/saslauthd/saslauthd.pid ]; then | if [ ! -r /var/state/saslauthd/saslauthd.pid ]; then | ||
echo "Starting SASL authentication daemon: /usr/sbin/saslauthd -a shadow" | echo "Starting SASL authentication daemon: /usr/sbin/saslauthd -a shadow" | ||
Línea 230: | Línea 229: | ||
fi | fi | ||
- | # Starting IMAP daemon | + | # Iniciando el demonio IMAP |
if [ -x /usr/libexec/cyrus/master ]; then | if [ -x /usr/libexec/cyrus/master ]; then | ||
echo "Starting Cyrus IMAP daemon: /usr/libexec/cyrus/master" | echo "Starting Cyrus IMAP daemon: /usr/libexec/cyrus/master" | ||
Línea 236: | Línea 235: | ||
fi | fi | ||
- | # Starting POSTFIX daemon | + | # Iniciando el demonio POSTFIX |
/etc/rc.d/rc.postfix start | /etc/rc.d/rc.postfix start | ||
Línea 243: | Línea 242: | ||
- | ====== Sources ====== | + | ====== Fuentes ====== |
Postfix The Definitive Guide, Kyle D. Dent, O'Reilly | Postfix The Definitive Guide, Kyle D. Dent, O'Reilly | ||
Managing IMAP, Dianna Mullet & Kevin Mullet, O'Reilly | Managing IMAP, Dianna Mullet & Kevin Mullet, O'Reilly | ||
- | Official Postfix Documentation, [[http://www.postfix.org/documentation.html]] | + | La Documentación Oficial de Postfix, [[http://www.postfix.org/documentation.html]] |
{{tag>howtos author_badirca}} | {{tag>howtos author_badirca}} | ||
+ | |||
+ | Traducido por --- //[[wiki:user:pedro.herrero|Pedro Herrero García]] 2019/02/16 16:31 (UTC)// |