Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. ## INSTALACION POSTFIX CON DOVECOT
  2. ## POSTFIX - MULTIPLES DOMINIOS & USUARIOS
  3. ## if ! type -path "dig" > /dev/null 2>&1; then yum install bind-utils -y; fi
  4. # Grupo de usuarios virtuales
  5. groupadd vmail -g 2222
  6.  
  7. # Agregamos el usuario (vmail) con el ID 2222 al sistema
  8. useradd vmail -r -g 2222 -u 2222 -d /var/vmail -m -c "mail user"
  9.  
  10. ## INSTALL POSTFIX
  11. yum install postfix cronie
  12.  
  13. ## EDITAMOS LA CONFIGURACION DE POSTFIX
  14. ## vim /etc/postfix/main.cf
  15.  
  16. ## VALIDE QUE LAS SIGUIENTE VARIABLES SE ENCUENTREN CONFIGURADAS CON LOS
  17. ## MISMOS VALORES
  18. queue_directory = /var/spool/postfix
  19. command_directory = /usr/sbin
  20. daemon_directory = /usr/libexec/postfix
  21. data_directory = /var/lib/postfix
  22. mail_owner = postfix
  23. unknown_local_recipient_reject_code = 550
  24. alias_maps = hash:/etc/postfix/aliases
  25. alias_database = $alias_maps
  26.  
  27. inet_interfaces = all
  28. inet_protocols = ipv4
  29. mydestination = $myhostname, localhost.$mydomain, localhost
  30.  
  31. debug_peer_level = 2
  32. debugger_command =
  33. PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
  34. ddd $daemon_directory/$process_name $process_id & sleep 5
  35.  
  36. sendmail_path = /usr/sbin/sendmail.postfix
  37. newaliases_path = /usr/bin/newaliases.postfix
  38. mailq_path = /usr/bin/mailq.postfix
  39. setgid_group = postdrop
  40. html_directory = no
  41. manpage_directory = /usr/share/man
  42. sample_directory = /usr/share/doc/postfix-2.6.6/samples
  43. readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
  44.  
  45. relay_domains = *
  46. virtual_alias_maps=hash:/etc/postfix/vmail_aliases
  47. virtual_mailbox_domains=hash:/etc/postfix/vmail_domains
  48. virtual_mailbox_maps=hash:/etc/postfix/vmail_mailbox
  49.  
  50. virtual_mailbox_base = /var/vmail
  51. virtual_minimum_uid = 2222
  52. virtual_transport = virtual
  53. virtual_uid_maps = static:2222
  54. virtual_gid_maps = static:2222
  55.  
  56. smtpd_sasl_auth_enable = yes
  57. smtpd_sasl_type = dovecot
  58. smtpd_sasl_path = /var/run/dovecot/auth-client
  59. smtpd_sasl_security_options = noanonymous
  60. smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
  61. smtpd_sasl_local_domain = $mydomain
  62. broken_sasl_auth_clients = yes
  63.  
  64. smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
  65. smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
  66.  
  67. mkdir /etc/postfix/vmail_domains
  68. ## vim /etc/postfix/vmail_domains
  69.  
  70. echo "mydomain.com OK" >> /etc/postfix/vmail_domains
  71. echo "my-otherdomain.com OK" >> /etc/postfix/vmail_domains
  72.  
  73. mkdir /etc/postfix/vmail_mailbox
  74. ## vim /etc/postfix/vmail_mailbox
  75.  
  76. echo "info@mydomain.com mydomain.com/info/" >> /etc/postfix/vmail_mailbox
  77. echo "info@my-otherdomain.com my-otherdomain.com/info/" >> /etc/postfix/vmail_mailbox
  78.  
  79. mkdir /etc/postfix/vmail_aliases
  80.  
  81. ## vim /etc/postfix/vmail_aliases
  82.  
  83. echo "info@mydomain.com info@mydomain.com" >> /etc/postfix/vmail_aliases
  84. echo "info@my-otherdomain.com foo@bar.tld" >> /etc/postfix/vmail_aliases
  85.  
  86. postmap /etc/postfix/vmail_domains
  87. postmap /etc/postfix/vmail_mailbox
  88. postmap /etc/postfix/vmail_aliases
  89.  
  90. touch /etc/postfix/aliases
  91. ## vim +/submission /etc/postfix/master.cf
  92. ## Agregar la siguiente linea
  93. ## submission inet n - n - - smtpd
  94. ## <-ENDLINE->
  95.  
  96. ## AHORA INSTALAMOS DOVECOT (POP3, IMAP)
  97. yum install dovecot
  98.  
  99. ## cp /etc/dovecot/dovecot.conf{,.orig}
  100. ## vim /etc/dovecot/dovecot.conf
  101.  
  102. listen = *
  103. ssl = no
  104. protocols = imap lmtp
  105. disable_plaintext_auth = no
  106. auth_mechanisms = plain login
  107. mail_access_groups = vmail
  108. default_login_user = vmail
  109. first_valid_uid = 2222
  110. first_valid_gid = 2222
  111. #mail_location = maildir:~/Maildir
  112. mail_location = maildir:/var/vmail/%d/%n
  113.  
  114. passdb {
  115. driver = passwd-file
  116. args = scheme=SHA1 /etc/dovecot/passwd
  117. }
  118. userdb {
  119. driver = static
  120. args = uid=2222 gid=2222 home=/var/vmail/%d/%n allow_all_users=yes
  121. }
  122. service auth {
  123. unix_listener auth-client {
  124. group = postfix
  125. mode = 0660
  126. user = postfix
  127. }
  128. user = root
  129. }
  130. service imap-login {
  131. process_min_avail = 1
  132. user = vmail
  133. }
  134.  
  135. touch /etc/dovecot/passwd
  136. doveadm pw -s sha1 | cut -d '}' -f2
  137.  
  138. ## vim /etc/dovecot/passwd
  139. ## info@mydomain.com:DOzcsKI8HY0bg8LAuz0DPKwS3WA=
  140. ## info@mydomain.com:<<- PEGAR AQUI STRING GENERADO POR doveadm- >>
  141.  
  142. chown root: /etc/dovecot/passwd
  143. chmod 600 /etc/dovecot/passwd
  144.  
  145. chkconfig postfix on
  146. chkconfig dovecot on
  147.  
  148. service postfix restart
  149. service dovecot restart
  150.  
  151. # you can also use swaks to test your smtp server, for example:
  152. # swaks --to support@mydomain.com --from email@address.net
  153.  
  154. ## PARA CREAR UNA CUENTA NUEVA ########################
  155. ## vim /etc/postfix/vmail_mailbox
  156. ## ...
  157. ## test@dominio.com dominio.com/test/
  158. #######################################################
  159. ## postmap /etc/postfix/vmail_mailbox
  160. ## postmap /etc/postfix/vmail_aliases
  161.  
  162. ## reiniciamos el servicio
  163. ## service postfix restart
  164.  
  165. ### GENERAR PASSWORD ################################
  166. ## doveadm pw -s sha1 | cut -d '}' -f2
  167. ## Incorporamos esa password al directorio de dovecot ##
  168. ## vim /etc/dovecot/passwd
  169. ## ...
  170. ## support@mydomain.com:DOzcsKI8HY0bg8LAuz0DPKwS3WA=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement