Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 KB | None | 0 0
  1. TUTORIAL: http://freelinuxtutorials.com/quick-tips-and-tricks/configure-postfix-to-use-gmail-in-rhelcentos/
  2.  
  3.  
  4. usuario@wicope:~$ ssh root@192.168.1.121
  5. Last login: Thu Jul 23 10:17:09 2015 from 192.168.1.110
  6. [root@a3ee360fa35a ~]# vi /etc/postfix/main.cf
  7. [root@a3ee360fa35a ~]# service postfix restart
  8. Shutting down postfix: [FAILED]
  9. Starting postfix: [ OK ]
  10. [root@a3ee360fa35a ~]# yum install cyrus-sasl-plain
  11. Failed to set locale, defaulting to C
  12. Complementos cargados:fastestmirror
  13. Configurando el proceso de instalaci?n
  14. Loading mirror speeds from cached hostfile
  15. epel/metalink | 24 kB 00:00
  16. * base: mirror.trueinter.net
  17. * epel: mirror1.babylon.network
  18. * extras: mirror.trueinter.net
  19. * updates: mirror.trueinter.net
  20. Tuleap | 2.9 kB 00:00
  21. base | 3.7 kB 00:00
  22. epel | 4.4 kB 00:00
  23. epel/primary_db | 6.7 MB 00:02
  24. extras | 3.4 kB 00:00
  25. updates | 3.4 kB 00:00
  26. Resolviendo dependencias
  27. --> Ejecutando prueba de transacci?n
  28. ---> Package cyrus-sasl-plain.x86_64 0:2.1.23-15.el6_6.2 will be instalado
  29. --> Resoluci?n de dependencias finalizada
  30.  
  31. Dependencias resueltas
  32.  
  33. =========================================================================================================
  34. Paquete Arquitectura Versi?n Repositorio Tama?o
  35. =========================================================================================================
  36. Instalando:
  37. cyrus-sasl-plain x86_64 2.1.23-15.el6_6.2 updates 31 k
  38.  
  39. Resumen de la transacci?n
  40. =========================================================================================================
  41. Instalar 1 Paquete(s)
  42.  
  43. Tama?o total de la descarga: 31 k
  44. Tama?o instalado: 37 k
  45. Est? de acuerdo [s/N]:s
  46. Descargando paquetes:
  47. cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64.rpm | 31 kB 00:00
  48. Ejecutando el rpm_check_debug
  49. Ejecutando prueba de transacci?n
  50. La prueba de transacci?n ha sido exitosa
  51. Ejecutando transacci?n
  52. Instalando : cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64 1/1
  53. Verifying : cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64 1/1
  54.  
  55. Instalado:
  56. cyrus-sasl-plain.x86_64 0:2.1.23-15.el6_6.2
  57.  
  58. ?Listo!
  59. [root@a3ee360fa35a ~]# vi /etc/postfix/main.cf
  60. [root@a3ee360fa35a ~]# mkdir /etc/postfix/sasl
  61. [root@a3ee360fa35a ~]# vi /etc/postfix/sasl/passwd
  62. [root@a3ee360fa35a ~]# chmod 600 /etc/postfix/sasl/passwd
  63. [root@a3ee360fa35a ~]# postmap /etc/postfix/sasl/passwd
  64. [root@a3ee360fa35a ~]#
  65. [root@a3ee360fa35a ~]# cd /etc/pki/tls/certs
  66. [root@a3ee360fa35a certs]# make hostname.pem
  67. locale: Cannot set LC_CTYPE to default locale: No such file or directory
  68. locale: Cannot set LC_MESSAGES to default locale: No such file or directory
  69. locale: Cannot set LC_ALL to default locale: No such file or directory
  70. umask 77 ; \
  71. PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
  72. PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
  73. /usr/bin/openssl req -newkey rsa:2048 -keyout $PEM1 -nodes -x509 -days 365 -out $PEM2 -set_serial 0 ; \
  74. cat $PEM1 > hostname.pem ; \
  75. echo "" >> hostname.pem ; \
  76. cat $PEM2 >> hostname.pem ; \
  77. rm -f $PEM1 $PEM2
  78. Generating a 2048 bit RSA private key
  79. .........................+++
  80. ......+++
  81. writing new private key to '/tmp/openssl.xYIt1F'
  82. -----
  83. You are about to be asked to enter information that will be incorporated
  84. into your certificate request.
  85. What you are about to enter is what is called a Distinguished Name or a DN.
  86. There are quite a few fields but you can leave some blank
  87. For some fields there will be a default value,
  88. If you enter '.', the field will be left blank.
  89. -----
  90. ......data
  91. [root@a3ee360fa35a certs]# cp /etc/pki/tls/certs/hostname.pem /etc/postfix/cacert.pem
  92. [root@a3ee360fa35a certs]#
  93. [root@a3ee360fa35a certs]# # Borrar log
  94. [root@a3ee360fa35a certs]# echo "" > /var/log/maillog
  95. [root@a3ee360fa35a certs]# echo "" > /var/spool/mail/root
  96. [root@a3ee360fa35a certs]# # Borrar cola de email
  97. [root@a3ee360fa35a certs]# postsuper -d ALL
  98. [root@a3ee360fa35a certs]# # Enviar email
  99. [root@a3ee360fa35a certs]# #echo "Body" | mail -s "Title NO SPAM" "alfreditospowerspam@gmail.com"
  100. [root@a3ee360fa35a certs]# echo "Body" | mail -s "Title NO SPAM" "alfreditospower@gmail.com"
  101. [root@a3ee360fa35a certs]# sleep 3
  102. [root@a3ee360fa35a certs]# cat /var/log/maillog
  103.  
  104. [root@a3ee360fa35a certs]# cat /var/spool/mail/root
  105.  
  106. [root@a3ee360fa35a certs]# # Ver configuración de /etc/postfix/main.cf:
  107. [root@a3ee360fa35a certs]# postconf -n
  108. alias_database = hash:/etc/aliases,hash:/etc/aliases.codendi,hash:/etc/aliases.codendi,hash:/etc/aliases.codendi
  109. alias_maps = hash:/etc/aliases,hash:/etc/aliases.codendi,hash:/etc/aliases.codendi,hash:/etc/aliases.codendi
  110. command_directory = /usr/sbin
  111. config_directory = /etc/postfix
  112. daemon_directory = /usr/libexec/postfix
  113. data_directory = /var/lib/postfix
  114. debug_peer_level = 2
  115. html_directory = no
  116. inet_interfaces = localhost
  117. inet_protocols = all
  118. mail_owner = postfix
  119. mailq_path = /usr/bin/mailq.postfix
  120. manpage_directory = /usr/share/man
  121. mydestination = $myhostname, localhost.$mydomain, localhost
  122. myhostname = localhost
  123. newaliases_path = /usr/bin/newaliases.postfix
  124. queue_directory = /var/spool/postfix
  125. readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
  126. relayhost = [smtp.gmail.com]:587
  127. sample_directory = /usr/share/doc/postfix-2.6.6/samples
  128. sendmail_path = /usr/sbin/sendmail.postfix
  129. setgid_group = postdrop
  130. smtp_sasl_auth_enable = yes
  131. smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
  132. smtp_sasl_security_options = noanonymous
  133. smtp_tls_CAfile = /etc/postfix/cacert.pem
  134. smtp_use_tls = yes
  135. unknown_local_recipient_reject_code = 550
  136. [root@a3ee360fa35a certs]# # To list the mail queue:
  137. [root@a3ee360fa35a certs]# mailq
  138. Mail queue is empty
  139. [root@a3ee360fa35a certs]#
  140.  
  141.  
  142. BEFORE...
  143. # Go to gmail:
  144. https://www.google.com/settings/security/lesssecureapps
  145. Acceso de aplicaciones menos seguras: Activar <--------- (ACTIVE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement