Created
August 30, 2017 13:33
-
-
Save cerealskill/ec044b7a1ddb0f1a7a6dca52baf23664 to your computer and use it in GitHub Desktop.
Configuración Servidor Correo Postfix DOVECOT (Virtual Domain, Aliases, Users)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## INSTALACION POSTFIX CON DOVECOT | |
| ## POSTFIX - MULTIPLES DOMINIOS & USUARIOS | |
| ## if ! type -path "dig" > /dev/null 2>&1; then yum install bind-utils -y; fi | |
| # Grupo de usuarios virtuales | |
| groupadd vmail -g 2222 | |
| # Agregamos el usuario (vmail) con el ID 2222 al sistema | |
| useradd vmail -r -g 2222 -u 2222 -d /var/vmail -m -c "mail user" | |
| ## INSTALL POSTFIX | |
| yum install postfix cronie | |
| ## EDITAMOS LA CONFIGURACION DE POSTFIX | |
| ## vim /etc/postfix/main.cf | |
| ## VALIDE QUE LAS SIGUIENTE VARIABLES SE ENCUENTREN CONFIGURADAS CON LOS | |
| ## MISMOS VALORES | |
| queue_directory = /var/spool/postfix | |
| command_directory = /usr/sbin | |
| daemon_directory = /usr/libexec/postfix | |
| data_directory = /var/lib/postfix | |
| mail_owner = postfix | |
| unknown_local_recipient_reject_code = 550 | |
| alias_maps = hash:/etc/postfix/aliases | |
| alias_database = $alias_maps | |
| inet_interfaces = all | |
| inet_protocols = ipv4 | |
| mydestination = $myhostname, localhost.$mydomain, localhost | |
| debug_peer_level = 2 | |
| debugger_command = | |
| PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin | |
| ddd $daemon_directory/$process_name $process_id & sleep 5 | |
| sendmail_path = /usr/sbin/sendmail.postfix | |
| newaliases_path = /usr/bin/newaliases.postfix | |
| mailq_path = /usr/bin/mailq.postfix | |
| setgid_group = postdrop | |
| html_directory = no | |
| manpage_directory = /usr/share/man | |
| sample_directory = /usr/share/doc/postfix-2.6.6/samples | |
| readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES | |
| relay_domains = * | |
| virtual_alias_maps=hash:/etc/postfix/vmail_aliases | |
| virtual_mailbox_domains=hash:/etc/postfix/vmail_domains | |
| virtual_mailbox_maps=hash:/etc/postfix/vmail_mailbox | |
| virtual_mailbox_base = /var/vmail | |
| virtual_minimum_uid = 2222 | |
| virtual_transport = virtual | |
| virtual_uid_maps = static:2222 | |
| virtual_gid_maps = static:2222 | |
| smtpd_sasl_auth_enable = yes | |
| smtpd_sasl_type = dovecot | |
| smtpd_sasl_path = /var/run/dovecot/auth-client | |
| smtpd_sasl_security_options = noanonymous | |
| smtpd_sasl_tls_security_options = $smtpd_sasl_security_options | |
| smtpd_sasl_local_domain = $mydomain | |
| broken_sasl_auth_clients = yes | |
| smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination | |
| smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination | |
| mkdir /etc/postfix/vmail_domains | |
| ## vim /etc/postfix/vmail_domains | |
| echo "mydomain.com OK" >> /etc/postfix/vmail_domains | |
| echo "my-otherdomain.com OK" >> /etc/postfix/vmail_domains | |
| mkdir /etc/postfix/vmail_mailbox | |
| ## vim /etc/postfix/vmail_mailbox | |
| echo "info@mydomain.com mydomain.com/info/" >> /etc/postfix/vmail_mailbox | |
| echo "info@my-otherdomain.com my-otherdomain.com/info/" >> /etc/postfix/vmail_mailbox | |
| mkdir /etc/postfix/vmail_aliases | |
| ## vim /etc/postfix/vmail_aliases | |
| echo "info@mydomain.com info@mydomain.com" >> /etc/postfix/vmail_aliases | |
| echo "info@my-otherdomain.com foo@bar.tld" >> /etc/postfix/vmail_aliases | |
| postmap /etc/postfix/vmail_domains | |
| postmap /etc/postfix/vmail_mailbox | |
| postmap /etc/postfix/vmail_aliases | |
| touch /etc/postfix/aliases | |
| ## vim +/submission /etc/postfix/master.cf | |
| ## Agregar la siguiente linea | |
| ## submission inet n - n - - smtpd | |
| ## <-ENDLINE-> | |
| ## AHORA INSTALAMOS DOVECOT (POP3, IMAP) | |
| yum install dovecot | |
| ## cp /etc/dovecot/dovecot.conf{,.orig} | |
| ## vim /etc/dovecot/dovecot.conf | |
| listen = * | |
| ssl = no | |
| protocols = imap lmtp | |
| disable_plaintext_auth = no | |
| auth_mechanisms = plain login | |
| mail_access_groups = vmail | |
| default_login_user = vmail | |
| first_valid_uid = 2222 | |
| first_valid_gid = 2222 | |
| #mail_location = maildir:~/Maildir | |
| mail_location = maildir:/var/vmail/%d/%n | |
| passdb { | |
| driver = passwd-file | |
| args = scheme=SHA1 /etc/dovecot/passwd | |
| } | |
| userdb { | |
| driver = static | |
| args = uid=2222 gid=2222 home=/var/vmail/%d/%n allow_all_users=yes | |
| } | |
| service auth { | |
| unix_listener auth-client { | |
| group = postfix | |
| mode = 0660 | |
| user = postfix | |
| } | |
| user = root | |
| } | |
| service imap-login { | |
| process_min_avail = 1 | |
| user = vmail | |
| } | |
| touch /etc/dovecot/passwd | |
| doveadm pw -s sha1 | cut -d '}' -f2 | |
| ## vim /etc/dovecot/passwd | |
| ## info@mydomain.com:DOzcsKI8HY0bg8LAuz0DPKwS3WA= | |
| ## info@mydomain.com:<<- PEGAR AQUI STRING GENERADO POR doveadm- >> | |
| chown root: /etc/dovecot/passwd | |
| chmod 600 /etc/dovecot/passwd | |
| chkconfig postfix on | |
| chkconfig dovecot on | |
| service postfix restart | |
| service dovecot restart | |
| # you can also use swaks to test your smtp server, for example: | |
| # swaks --to support@mydomain.com --from email@address.net | |
| ## PARA CREAR UNA CUENTA NUEVA ######################## | |
| ## vim /etc/postfix/vmail_mailbox | |
| ## ... | |
| ## test@dominio.com dominio.com/test/ | |
| ####################################################### | |
| ## postmap /etc/postfix/vmail_mailbox | |
| ## postmap /etc/postfix/vmail_aliases | |
| ## reiniciamos el servicio | |
| ## service postfix restart | |
| ### GENERAR PASSWORD ################################ | |
| ## doveadm pw -s sha1 | cut -d '}' -f2 | |
| ## Incorporamos esa password al directorio de dovecot ## | |
| ## vim /etc/dovecot/passwd | |
| ## ... | |
| ## support@mydomain.com:DOzcsKI8HY0bg8LAuz0DPKwS3WA= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment