1 (edited by simplecodervt 2016-11-15 02:21:16)

Topic: Error in set up Relayhost using SMTP of Amazonaws

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: CentOS 6.8 x64
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
======== Required information ====
Hi Admin iReadMail!
I set up SMTP using service of Amazonaws and have information of Relayserver such as: relayhost: email-smtp.us-east-2.amazonaws.com:25
IAM User Name: domain.net
Smtp Username: AKIAIA3
Smtp Password: xxxxxx
Then I follow the instruction
http://www.iredmail.org/docs/relayhost.html
In /etc/postfix/main.cf
and add the below line

#SMTP Relay
relayhost = [email-smtp.us-east-1.amazonaws.com]:25
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = login
smtp_sasl_security_options = noanonymous

Then I create a file /etc/postfix/sasl_password,
in this file I add Relayserver and user pass: [email-smtp.us-east-2.amazonaws.com]:25 AKIAIA3:xxxxxx

Then I restart, at the final step, I login Mysql:
mysql>  USE vmail;
INSERT INTO sender_relayhost (account, relayhost) VALUES ('domain.net', '[email-smtp.us-east-2.amazonaws.com]:25');

Eventhough I follow all steps above but I can not send mail successfully, my inbox is shown in the picture
File maillog: /var/log/maillog

Nov 14 18:17:59 mail postfix/smtp[2601]: setting up TLS connection to email-smtp.us-east-1.amazonaws.com[174.129.224.134]:25
Nov 14 18:17:59 mail postfix/smtp[2601]: Trusted TLS connection established to email-smtp.us-east-1.amazonaws.com[174.129.224.134]:25: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Nov 14 18:18:00 mail postfix/smtp[2601]: warning: SASL authentication failure: No worthy mechs found
Nov 14 18:18:00 mail postfix/smtp[2601]: C9A622091: SASL authentication failed; cannot authenticate to server email-smtp.us-east-2.amazonaws.com[174.129.224.134]: no mechanism available

Nov 14 18:18:04 mail postfix/smtp[2601]: warning: SASL authentication failure: No worthy mechs found
Nov 14 18:18:04 mail postfix/smtp[2601]: C9A622091: to=<techwosu.com@gmail.com>, relay=email-smtp.us-east-2.amazonaws.com[184.73.218.23]:25, delay=13, delays=0.02/0.15/12/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server email-smtp.us-east-2.amazonaws.com[184.73.218.23]: no mechanism available)

Post's attachments

error-mail.png
error-mail.png 51.76 kb, 1 downloads since 2016-11-14 

You don't have the permssions to download the attachments of this post.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Error in set up Relayhost using SMTP of Amazonaws

simplecodervt wrote:

Then I restart, at the final step, I login Mysql:
mysql>  USE vmail;
INSERT INTO sender_relayhost (account, relayhost) VALUES ('domain.net', '[email-smtp.us-east-2.amazonaws.com]:25');

This is not required since you have global relay (relayhost=). Please remove this sql record and try again.

3

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:
simplecodervt wrote:

Then I restart, at the final step, I login Mysql:
mysql>  USE vmail;
INSERT INTO sender_relayhost (account, relayhost) VALUES ('domain.net', '[email-smtp.us-east-2.amazonaws.com]:25');

This is not required since you have global relay (relayhost=). Please remove this sql record and try again.

Thank you for your help,
I followed your guidance, below is my log file
File maillog: /var/log/maillog:
Nov 15 09:45:06 maildomain postfix/smtp[8193]: warning: SASL authentication failure: No worthy mechs found
Nov 15 09:45:06 maildomain postfix/smtp[8193]: 61FB22084: to=<hulevan.com@gmail.com>, relay=email-smtp.us-east-1.amazonaws.com[107.21.239.198]:25, delay=2202, delays=2192/0.17/10/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server email-smtp.us-east-2.amazonaws.com[107.21.239.198]: no mechanism available)

4

Re: Error in set up Relayhost using SMTP of Amazonaws

simplecodervt wrote:

relayhost = [email-smtp.us-east-1.amazonaws.com]:25

Does Amazon ask you to use port 25 or 587?

5

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:
simplecodervt wrote:

relayhost = [email-smtp.us-east-1.amazonaws.com]:25

Does Amazon ask you to use port 25 or 587?

I replace port 25 to port 587 but still can not send mail, below is the file /var/log/maillog:

Nov 15 16:45:33 kt postfix/submission/smtpd[4670]: 31267208F: client=mail.ktt.net[127.0.0.1], sasl_method=LOGIN, sasl_username=postmaster@ktt.net
Nov 15 16:45:33 khatran postfix/cleanup[4676]: 31267208F: message-id=<71188d51dd125c6e459a8af9f88d8b11@ktt.net>
Nov 15 16:45:33 kt postfix/qmgr[4585]: 31267208F: from=<postmaster@ktt.net>, size=560, nrcpt=1 (queue active)
Nov 15 16:45:33 kt roundcube: <ene68ogo> User postmaster@ktt.net [173.245.66.60]; Message for hkien@gmail.com; 250: 2.0.0 Ok: queued as 31267208F
Nov 15 16:45:33 kt postfix/smtp[4681]: warning: database /etc/postfix/sasl_password.db is older than source file /etc/postfix/sasl_password
Nov 15 16:45:33 kt postfix/submission/smtpd[4670]: disconnect from mail.ktt.net[127.0.0.1]
Nov 15 16:45:33 kt postfix/smtp[4681]: 31267208F: to=<hkien@gmail.com>, relay=127.0.0.1[127.0.0.1]:10026, delay=0.4, delays=0.13/0.16/0.11/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

6

Re: Error in set up Relayhost using SMTP of Amazonaws

simplecodervt wrote:

Nov 15 16:45:33 kt postfix/smtp[4681]: warning: database /etc/postfix/sasl_password.db is older than source file /etc/postfix/sasl_password

Run "postmap hash:/etc/postfix/sasl_password" first after you modified this "sasl_password" file, then try again.

7

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:
simplecodervt wrote:

Nov 15 16:45:33 kt postfix/smtp[4681]: warning: database /etc/postfix/sasl_password.db is older than source file /etc/postfix/sasl_password

Run "postmap hash:/etc/postfix/sasl_password" first after you modified this "sasl_password" file, then try again.

thank you for your replying, I did follow your instruction but still can not send email, I do not know if this is the error from iRedmail or amazonaws.

File /var/log/maillog:
Nov 16 10:36:53 khtt postfix/submission/smtpd[7702]: 2BEE4209A: client=mail.ktt.net[127.0.0.1], sasl_method=LOGIN, sasl_username=postmaster@ktt.net
Nov 16 10:36:53 khatran postfix/cleanup[7706]: 2BEE4209A: message-id=<3cb60d88deb75ac9f38f7fe627195ee7@ktt.net>
Nov 16 10:36:53 ktt postfix/qmgr[7687]: 2BEE4209A: from=<postmaster@ktt.net>, size=540, nrcpt=1 (queue active)
Nov 16 10:36:53 ktt roundcube: <fu97iesq> User postmaster@ktt.net [27.64.63.27]; Message for huuvt@gmail.com; 250: 2.0.0 Ok: queued as 2BEE4209A
Nov 16 10:36:53 khatran postfix/smtp[7691]: 2BEE4209A: to=<huuvt@gmail.com>, relay=127.0.0.1[127.0.0.1]:10026, delay=0.26, delays=0.16/0/0.1/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])
Nov 16 10:36:53 ktt postfix/submission/smtpd[7702]: disconnect from mail.ktt.net[127.0.0.1]

This is File /etc/postfix/sasl_password:
[email-smtp.us-east-2.amazonaws.com]:587 xxxx:yyyy
I do not know where the error comes from, eventhough I strickly follow the instruction.

8

Re: Error in set up Relayhost using SMTP of Amazonaws

Pasted log is not related to SES.

9

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:

Pasted log is not related to SES.

I do not know where the error comes from, eventhough I strickly follow the instruction.

10

Re: Error in set up Relayhost using SMTP of Amazonaws

If Postfix tries to connect to Amazon server, it will log the Amazon server name or IP address in Postfix log file (/var/log/maillog). Please try again and check Postfix log file.

11 (edited by simplecodervt 2016-11-21 15:41:38)

Re: Error in set up Relayhost using SMTP of Amazonaws

thank you for your replying, I did follow your instruction but still can not send email
File maillog: /var/log/maillog

Nov 21 07:37:39 khtran postfix/submission/smtpd[1901]: AB7542088: client=mail.khtran.net[127.0.0.1], sasl_method=LOGIN, sasl_username=postmaster@khtran.net
Nov 21 07:37:42 khtran postfix/cleanup[1916]: AB7542088: message-id=<7ee61b00041a1c0bb35382537d4e30e9@khtran.net>
Nov 21 07:37:42 khatran postfix/qmgr[1545]: AB7542088: from=<postmaster@khtran.net>, size=546, nrcpt=1 (queue active)
Nov 21 07:37:44 khtran roundcube: <3q3kkoh4> User postmaster@khtran.net [14.185.11.58]; Message for techsu.com@gmail.com; 250: 2.0.0 Ok: queued as AB7542088
Nov 21 07:37:46 khtran postfix/submission/smtpd[1901]: disconnect from mail.khtran.net[127.0.0.1]
Nov 21 07:37:46 khtran postfix/smtp[1921]: AB7542088: to=<techsu.com@gmail.com>, relay=127.0.0.1[127.0.0.1]:10026, delay=9.5, delays=6.5/2.6/0.5/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

12

Re: Error in set up Relayhost using SMTP of Amazonaws

simplecodervt wrote:

Nov 21 07:37:46 khtran postfix/smtp[1921]: AB7542088: to=<techsu.com@gmail.com>, relay=127.0.0.1[127.0.0.1]:10026, delay=9.5, delays=6.5/2.6/0.5/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

Port 10026 is (part of) Amavisd service, and it doesn't require TLS or SSL at all. I'm confused why it requires TLS in your case.

What Amavisd and Postfix settings did you change?

13 (edited by simplecodervt 2016-12-04 02:52:41)

Re: Error in set up Relayhost using SMTP of Amazonaws

hi Guy again, thank you so much for your supporting such a long time
Still I tried and got the error again, this is maillog file:

Dec  3 11:34:41 mail postfix/submission/smtpd[2899]: connect from mail.khatran.net[127.0.0.1]
Dec  3 11:34:41 mail postfix/submission/smtpd[2899]: setting up TLS connection from mail.khatran.net[127.0.0.1]
Dec  3 11:34:41 mail postfix/submission/smtpd[2899]: Anonymous TLS connection established from mail.khatran.net[127.0.0.1]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
Dec  3 11:34:41 mail postfix/submission/smtpd[2899]: 9B4F2208E: client=mail.khatran.net[127.0.0.1], sasl_method=LOGIN, sasl_username=postmaster@khatran.net
Dec  3 11:34:41 mail postfix/cleanup[2907]: 9B4F2208E: message-id=<2e796c766ce12dfd4b1974406ebce787@khatran.net>
Dec  3 11:34:41 mail postfix/qmgr[2849]: 9B4F2208E: from=<postmaster@khatran.net>, size=554, nrcpt=1 (queue active)
Dec  3 11:34:41 mail roundcube: <bdqs4iru> User postmaster@khatran.net [27.64.63.27]; Message for devpogroup@gmail.com; 250: 2.0.0 Ok: queued as 9B4F2208E
Dec  3 11:34:41 mail postfix/smtp[2912]: 9B4F2208E: to=<devpogroup@gmail.com>, relay=127.0.0.1[127.0.0.1]:10026, delay=0.2, delays=0.1/0.08/0.02/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])
Dec  3 11:34:41 mail postfix/submission/smtpd[2899]: disconnect from mail.khatran.net[127.0.0.1]

SMTP Relay configuration  /etc/postfix/main.cf:
relayhost = [email-smtp.us-east-1.amazonaws.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = login

Post's attachments

2016-12-04_015107.png
2016-12-04_015107.png 38.65 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

14

Re: Error in set up Relayhost using SMTP of Amazonaws

The problem is port 10026 on YOUR server, not Amazon.

Did you define port 10026 in /etc/postfix/master.cf? If YES, please comment it out, then restart Postfix, and make sure you have setting below in /etc/amavisd/amavisd.conf:

$inet_socket_port = [10024, 10026, 9998];

15

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:

The problem is port 10026 on YOUR server, not Amazon.

Did you define port 10026 in /etc/postfix/master.cf? If YES, please comment it out, then restart Postfix, and make sure you have setting below in /etc/amavisd/amavisd.conf:

$inet_socket_port = [10024, 10026, 9998];

I did comment as in the attached picture: content_filter = smtp-amavis:[127.0.0.1]:10024 in file  /etc/postfix/master.cf.

then I check /etc/amavisd/amavisd.conf follow your instruction. but still I can not send email successfully.  file maillog:

Dec  6 17:10:17 mail postfix/submission/smtpd[14462]: connect from mail.khatran.net[127.0.0.1]
Dec  6 17:10:17 mail postfix/submission/smtpd[14462]: setting up TLS connection from mail.khatran.net[127.0.0.1]
Dec  6 17:10:17 mail postfix/submission/smtpd[14462]: Anonymous TLS connection established from mail.khatran.net[127.0.0.1]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
Dec  6 17:10:18 mail postfix/submission/smtpd[14462]: 277B520A8: client=mail.khatran.net[127.0.0.1], sasl_method=LOGIN, sasl_username=postmaster@khatran.net
Dec  6 17:10:18 mail postfix/cleanup[14473]: 277B520A8: message-id=<2329a71a3aaeff0c4af0b181ea8b11b9@khatran.net>
Dec  6 17:10:18 mail postfix/qmgr[2727]: 277B520A8: from=<postmaster@khatran.net>, size=541, nrcpt=1 (queue active)
Dec  6 17:10:18 mail roundcube: <opvmnrfd> User postmaster@khatran.net [115.72.225.0]; Message for devpogroup@gmail.com; 250: 2.0.0 Ok: queued as 277B520A8
Dec  6 17:10:18 mail postfix/smtp[14478]: warning: database /etc/postfix/sasl_password.db is older than source file /etc/postfix/sasl_password
Dec  6 17:10:18 mail postfix/submission/smtpd[14462]: disconnect from mail.khatran.net[127.0.0.1]
Dec  6 17:10:18 mail postfix/smtp[14478]: 277B520A8: to=<devpogroup@gmail.com>, relay=127.0.0.1[127.0.0.1]:10026, delay=0.71, delays=0.46/0.15/0.11/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

Post's attachments

erro-mail.png
erro-mail.png 17.94 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

16

Re: Error in set up Relayhost using SMTP of Amazonaws

There's another one in /etc/postfix/master.cf like this:

    -o content_filter=...:10026

BTW, why you comment out content_filter parameter? You will lose spam/virus scanning if you comment it out.

The solution to your issue is making sure you have "$inet_socket_port = [10024, 10026, 9998];" in Amavisd config file, then port 10026 is available and mail flow should be fine.

17

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:

There's another one in /etc/postfix/master.cf like this:

    -o content_filter=...:10026

BTW, why you comment out content_filter parameter? You will lose spam/virus scanning if you comment it out.

The solution to your issue is making sure you have "$inet_socket_port = [10024, 10026, 9998];" in Amavisd config file, then port 10026 is available and mail flow should be fine.

Thank you for your prompt reply

I comment line  #o content_filter=smtp-amavis:[127.0.0.1]:10026 in file /etc/postfix/master.cf

in  file  /etc/amavisd/amavisd.conf has line: $inet_socket_port = [10024, 10026, 9998];

Then I restar  postfix, sent mail succsessfull but can not receive

file mail log:

Dec  8 11:15:04 mail postfix/submission/smtpd[29891]: disconnect from mail.khatran.net[127.0.0.1]
Dec  8 11:17:12 mail postfix/submission/smtpd[29957]: connect from mail.khatran.net[127.0.0.1]
Dec  8 11:17:12 mail postfix/submission/smtpd[29957]: setting up TLS connection from mail.khatran.net[127.0.0.1]
Dec  8 11:17:12 mail postfix/submission/smtpd[29957]: Anonymous TLS connection established from mail.khatran.net[127.0.0.1]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
Dec  8 11:17:12 mail postfix/submission/smtpd[29957]: 360B720AB: client=mail.khatran.net[127.0.0.1], sasl_method=LOGIN, sasl_username=postmaster@khatran.net
Dec  8 11:17:12 mail postfix/cleanup[29965]: 360B720AB: message-id=<9b967d06b9ba54dd485f3ddcd03e0be8@khatran.net>
Dec  8 11:17:12 mail postfix/qmgr[29853]: 360B720AB: from=<postmaster@khatran.net>, size=547, nrcpt=1 (queue active)
Dec  8 11:17:12 mail roundcube: <ojhivj12> User postmaster@khatran.net [115.72.225.0]; Message for devpogroup@gmail.com; 250: 2.0.0 Ok: queued as 360B720AB
Dec  8 11:17:12 mail postfix/smtp[29970]: warning: database /etc/postfix/sasl_password.db is older than source file /etc/postfix/sasl_password
Dec  8 11:17:12 mail postfix/submission/smtpd[29957]: disconnect from mail.khatran.net[127.0.0.1]
Dec  8 11:17:12 mail postfix/smtp[29970]: 360B720AB: to=<devpogroup@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.29, delays=0.15/0.12/0.02/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

Post's attachments

fie-amavisd.png
fie-amavisd.png 61.93 kb, file has never been downloaded. 

master.png
master.png 17.04 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

18

Re: Error in set up Relayhost using SMTP of Amazonaws

simplecodervt wrote:

Dec  8 11:17:12 mail postfix/smtp[29970]: 360B720AB: to=<devpogroup@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.29, delays=0.15/0.12/0.02/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

Why it tried to access to port 10024 now? Comment out 'content_filter' in /etc/postfix/main.cf and restart postfix service.

Next time, please read the log first.

19

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:
simplecodervt wrote:

Dec  8 11:17:12 mail postfix/smtp[29970]: 360B720AB: to=<devpogroup@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.29, delays=0.15/0.12/0.02/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])

Why it tried to access to port 10024 now? Comment out 'content_filter' in /etc/postfix/main.cf and restart postfix service.

Next time, please read the log first.

Thank you for your prompt reply.
I comment line #content_filter = smtp-amavis:[127.0.0.1]:10024
Do you know this error comes from iRedmail or Amazonawss?

File maillog:

Dec  8 14:09:46 mail postfix/smtp[31198]: warning: SASL authentication failure: No worthy mechs found
Dec  8 14:09:46 mail postfix/smtp[31198]: CE97C208E: SASL authentication failed; cannot authenticate to server email-smtp.us-east-1.amazonaws.com[107.21.244.69]: no mechanism available
Dec  8 14:09:47 mail postfix/smtp[31198]: setting up TLS connection to email-smtp.us-east-1.amazonaws.com[54.221.247.194]:587
Dec  8 14:09:48 mail postfix/smtp[31198]: Trusted TLS connection established to email-smtp.us-east-1.amazonaws.com[54.221.247.194]:587: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Dec  8 14:09:48 mail postfix/smtp[31198]: warning: SASL authentication failure: No worthy mechs found
Dec  8 14:09:48 mail postfix/smtp[31198]: CE97C208E: SASL authentication failed; cannot authenticate to server email-smtp.us-east-1.amazonaws.com[54.221.247.194]: no mechanism available
Dec  8 14:09:50 mail postfix/smtp[31198]: setting up TLS connection to email-smtp.us-east-1.amazonaws.com[54.235.77.145]:587
Dec  8 14:09:50 mail postfix/smtp[31198]: Trusted TLS connection established to email-smtp.us-east-1.amazonaws.com[54.235.77.145]:587: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Dec  8 14:09:50 mail postfix/smtp[31198]: warning: SASL authentication failure: No worthy mechs found
Dec  8 14:09:50 mail postfix/smtp[31198]: CE97C208E: to=<devpogroup@gmail.com>, relay=email-smtp.us-east-1.amazonaws.com[54.235.77.145]:587, delay=11, delays=0.22/0.01/11/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server email-smtp.us-east-1.amazonaws.com[54.235.77.145]: no mechanism available)

20

Re: Error in set up Relayhost using SMTP of Amazonaws

It's an error on your side. Please show us output of command "postconf -a". also, try different port number in Postfix "relayhost =" setting, e.g. 25, 587. You should check Amazon doc to make sure you're using correct port number.

21

Re: Error in set up Relayhost using SMTP of Amazonaws

ZhangHuangbin wrote:

It's an error on your side. Please show us output of command "postconf -a". also, try different port number in Postfix "relayhost =" setting, e.g. 25, 587. You should check Amazon doc to make sure you're using correct port number.

This is the result of the command:
[root@mail ~]# postconf -a
cyrus
dovecot
I also try port 25, 465 or 587, then still can not send email
can we use another method instead of amazonaws to avoid sending spam email

Post's attachments

post-on.png
post-on.png 2.45 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.