Настройка postfix с релеем через Gmail
ПИШУ БОЛЬШИМИ БУКВАМИ, т.к. ВРЕМЕНИ на ЭТУ ЕРУНДУ БЫЛО ПОТРАЧЕНО ДОСТАТОЧНО МНОГО.
ПРИЧЕМ ПОТРАЧЕНО НЕ РАБОЧЕЕ ВРЕМЯ А МОЕ ЛИЧНОЕ!!!
ОШИБКА:
SASL authentication failed; cannot authenticate to server smtp.gmail.com: no mechanism available
решается следующим способом:
В RedHat:
# yum install -y \
cyrus-sasl \
cyrus-sasl-md5 \
cyrus-sasl-plain
В Ubuntu:
# aptitude install libsasl2-modules
http://support.google.com/mail/bin/answer.py?hl=ru&answer=13287
Сервер исходящей почты (SMTP) – требуется TLS или SSL:
smtp.gmail.com
Использовать аутентификацию: да
Порт для TLS/STARTTLS: 587
Порт для SSL: 465
Сервер входящей почты (IMAP) – требуется SSL
imap.gmail.com
Порт: 993
Требуется SSL: да
Сервер исходящей почты (SMTP) – требуется TLS
smtp.gmail.com
Порт: 465 или 587
Требуется SSL: да
Требуется аутентификация: да
Используются параметры сервера входящей почты.
# yum install -y \
postfix \
ca-certificates
# cp /etc/postfix/main.cf /etc/postfix/main.cf.bkp
# cp /etc/postfix/transport /etc/postfix/transport.bkp
# cp /etc/postfix/generic /etc/postfix/generic.bkp
# vi /etc/postfix/main.cf
relayhost= [smtp.gmail.com]:587
smtp_destination_rate_delay = 60
relay_destination_rate_delay = 60
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_sasl_security_options = noanonymous
transport_maps = hash:/etc/postfix/transport
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
# vi /etc/postfix/transport
* smtp:[smtp.gmail.com]:587
# vi /etc/postfix/sasl_password
[smtp.gmail.com]:587 [email protected]:password
# vi /etc/postfix/generic
[email protected] [email protected]
root@hostname [email protected]
root@localhost [email protected]
[email protected] [email protected]
# chmod 400 /etc/postfix/sasl_password
# postmap /etc/postfix/sasl_password
# postmap /etc/postfix/transport
# postmap /etc/postfix/generic
Работа с сертификатами:
# cd /etc/ssl/certs/
# vi /etc/ssl/certs/Equifax_Secure_CA.pem
-----BEGIN CERTIFICATE-----
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
zgK5F7WF0bnj4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N9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm
SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf
8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t
UCemDaYj+bvLpgcUQg==
-----END CERTIFICATE-----
# cat /etc/ssl/certs/Equifax_Secure_CA.pem >> /etc/postfix/cacert.pem
# echo >> /etc/postfix/cacert.pem
# cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem >> /etc/postfix/cacert.pem
# service postfix restart
# sendmail -bv [email protected]
# tail /var/log/maillog
Использовал материалы:
Настройка postfix с релеем через Gmail в Debian Linux
http://rascal.su/blog/2010/10/20/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-postfix-%D1%81-%D1%80%D0%B5%D0%BB%D0%B5%D0%B5%D0%BC-%D1%87%D0%B5%D1%80%D0%B5%D0%B7-gmail-%D0%B2-debian-linux/
Fixing Postfix “certificate verification failed for gmail untrusted issuer” Error Message
http://stevejenkins.com/blog/2011/06/fixing-postfix-certificate-verification-failed-for-gmail-untrusted-issuer-error-message/
HowTos/Complete Postfix
http://www.scalix.com/wiki/index.php?title=HowTos/Complete_Postfix