1 (edited by andreluizpr 2014-04-17 03:50:05)

Topic: Amazon EC2 with iRedMail and Amazon SES

==== Required information ====
- iRedMail version: 0.8.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Linux/BSD distribution name and version: CentOS 6.5 x86_64
- Related log if you're reporting an issue:
====

Hello all,


I am a new iRedMail user and this is my scenario:

New EC2 instance with CentOS and iRedMail...

I would like to do this: my EC2 instance send to Amazon SES and Amazon SES delivery message to end user (relayhost). I followed all steps on Amazon website but message is not delivered and I receive this error on maillog.

Apr 16 15:04:18 mx01 roundcube: SMTP Error: SMTP error: Authentication failure: SMTP server does not support authentication (Code: ) in /var/www/roundcubemail-0.9.5/program/include/rcmail.php on line 1035 (POST /mail/?_unlock=loading1397671459936&_lang=undefined?_task=mail&_action=send)

Reference: http://docs.aws.amazon.com/ses/latest/D … stfix.html

Someone already to did? What do I need to do?

Thanks

Andre

2

Re: Amazon EC2 with iRedMail and Amazon SES

Did you change any setting in Postfix/Dovecot and Roundcube? Also, please show us output of below two commands:

# postconf -n
# dovecot -n

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: Amazon EC2 with iRedMail and Amazon SES

Oh, i see Amazon requires this setting in Postfix:

smtp_tls_security_level = encrypt

So you have to update Roundcube to use TLS instead of normal smtp protocol on port 25. Please find below parameters in /var/www/roundcubemail/config/main.inc.php and update them to below values:

$config['smtp_server'] = 'tls://127.0.0.1';
$config['smtp_port'] = 587;

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

4

Re: Amazon EC2 with iRedMail and Amazon SES

Hello ZhangHuangbin,

Thank you very much for your reply. Bellow my configs:

postconf -n
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
allow_percent_hack = no
biff = no
bounce_queue_lifetime = 4h
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
delay_warning_time = 0h
disable_vrfy_command = yes
enable_original_recipient = no
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailbox_command = /usr/libexec/dovecot/deliver
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maximal_backoff_time = 4000s
maximal_queue_lifetime = 4h
message_size_limit = 15728640
minimal_backoff_time = 300s
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
mydomain = nocadmin.com
myhostname = mx01.nocadmin.com.br
mynetworks = 127.0.0.0/8
mynetworks_style = host
myorigin = mx01.nocadmin.com.br
newaliases_path = /usr/bin/newaliases.postfix
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
queue_directory = /var/spool/postfix
queue_run_delay = 300s
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
recipient_bcc_maps = proxy:pgsql:/etc/postfix/pgsql/recipient_bcc_maps_user.cf, proxy:pgsql:/etc/postfix/pgsql/recipient_bcc_maps_domain.cf
recipient_delimiter = +
relay_domains = $mydestination, proxy:pgsql:/etc/postfix/pgsql/relay_domains.cf
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sender_bcc_maps = proxy:pgsql:/etc/postfix/pgsql/sender_bcc_maps_user.cf, proxy:pgsql:/etc/postfix/pgsql/sender_bcc_maps_domain.cf
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
smtp_tls_CAfile = $smtpd_tls_CAfile
smtp_tls_security_level = may
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10031
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_helo_access pcre:/etc/postfix/helo_access.pcre
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, check_policy_service inet:127.0.0.1:10031, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_path = ./dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:pgsql:/etc/postfix/pgsql/sender_login_maps.cf
smtpd_sender_restrictions = permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated
smtpd_tls_CAfile = /etc/pki/tls/certs/iRedMail_CA.pem
smtpd_tls_cert_file = /etc/pki/tls/certs/iRedMail_CA.pem
smtpd_tls_key_file = /etc/pki/tls/private/iRedMail.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
swap_bangpath = no
tls_random_source = dev:/dev/urandom
transport_maps = proxy:pgsql:/etc/postfix/pgsql/transport_maps_user.cf, proxy:pgsql:/etc/postfix/pgsql/transport_maps_domain.cf
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = proxy:pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf, proxy:pgsql:/etc/postfix/pgsql/domain_alias_maps.cf, proxy:pgsql:/etc/postfix/pgsql/catchall_maps.cf, proxy:pgsql:/etc/postfix/pgsql/domain_alias_catchall_maps.cf
virtual_gid_maps = static:2000
virtual_mailbox_base = /srv/mail/nocadmin/vmai
virtual_mailbox_domains = proxy:pgsql:/etc/postfix/pgsql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:pgsql:/etc/postfix/pgsql/virtual_mailbox_maps.cf
virtual_minimum_uid = 2000
virtual_transport = dovecot
virtual_uid_maps = static:2000




# 2.1.17: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-431.el6.x86_64 x86_64 CentOS release 6.5 (Final)
auth_master_user_separator = *
auth_mechanisms = PLAIN LOGIN
dict {
  acl = pgsql:/etc/dovecot/dovecot-share-folder.conf
  quotadict = pgsql:/etc/dovecot/dovecot-used-quota.conf
}
first_valid_uid = 2000
last_valid_uid = 2000
listen = *
log_path = /var/log/dovecot.log
mail_gid = 2000
mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
mail_plugins = quota
mail_uid = 2000
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
namespace {
  inbox = yes
  location =
  prefix =
  separator = /
  type = private
}
namespace {
  list = children
  location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
  prefix = Shared/%%u/
  separator = /
  subscriptions = yes
  type = shared
}
passdb {
  args = /etc/dovecot/dovecot-pgsql.conf
  driver = sql
}
passdb {
  args = /etc/dovecot/dovecot-master-users-password
  driver = passwd-file
  master = yes
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  auth_socket_path = /var/run/dovecot/auth-master
  autocreate = INBOX
  autocreate2 = Sent
  autocreate3 = Trash
  autocreate4 = Drafts
  autocreate5 = Junk
  autosubscribe = INBOX
  autosubscribe2 = Sent
  autosubscribe3 = Trash
  autosubscribe4 = Drafts
  autosubscribe5 = Junk
  quota = dict:user::proxy::quotadict
  quota_rule = *:storage=1G
  quota_warning = storage=85%% quota-warning 85 %u
  quota_warning2 = storage=90%% quota-warning 90 %u
  quota_warning3 = storage=95%% quota-warning 95 %u
  sieve = /%Lh/sieve/dovecot.sieve
  sieve_dir = /%Lh/sieve
  sieve_global_dir = /srv/mail/nocadmin/vmai/sieve
  sieve_global_path = /srv/mail/nocadmin/vmai/sieve/dovecot.sieve
}
protocols = pop3 imap sieve
service auth {
  unix_listener /var/spool/postfix/dovecot-auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-master {
    group = vmail
    mode = 0666
    user = vmail
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service dict {
  unix_listener dict {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  process_limit = 500
  service_count = 1
}
service pop3-login {
  service_count = 1
}
service quota-warning {
  executable = script /usr/local/bin/dovecot-quota-warning.sh
  unix_listener quota-warning {
    group = vmail
    mode = 0660
    user = vmail
  }
}
ssl = required
ssl_cert = </etc/pki/tls/certs/iRedMail_CA.pem
ssl_key = </etc/pki/tls/private/iRedMail.key
userdb {
  args = /etc/dovecot/dovecot-pgsql.conf
  driver = sql
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  lda_mailbox_autocreate = yes
  log_path = /var/log/sieve.log
  mail_plugins = quota sieve autocreate
  postmaster_address = root
}
protocol imap {
  imap_client_workarounds = tb-extra-mailbox-sep
  mail_plugins = quota imap_quota autocreate
}
protocol pop3 {
  mail_plugins = quota
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  pop3_uidl_format = %08Xu%08Xv
}

5

Re: Amazon EC2 with iRedMail and Amazon SES

Does updating Roundcube setting fix your issue?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

6

Re: Amazon EC2 with iRedMail and Amazon SES

Yes, I updated.

main.inc.php

$rcmail_config['smtp_server'] = "tls://127.0.0.1";
$rcmail_config['smtp_port'] = 587;

I put in my main.cf this:

smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
relayhost = email-smtp.us-west-2.amazonaws.com:25
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes


and in my master.cf

-o smtp_tls_security_level=none

on  smtp-amavis unix -  -   -   -   2  smtp and 127.0.0.1:10025 inet n  -   -   -   -  smtpd

The maillog file report this error:

Apr 17 09:08:47 mx01 postfix/smtp[2581]: warning: SASL authentication failure: No worthy mechs found
Apr 17 09:08:47 mx01 postfix/smtp[2581]: 4156F2308B: SASL authentication failed; cannot authenticate to server email-smtp.us-west-2.amazonaws.com[54.213.254.236]: no mechanism available
Apr 17 09:08:49 mx01 postfix/smtp[2581]: warning: SASL authentication failure: No worthy mechs found
Apr 17 09:08:49 mx01 postfix/smtp[2581]: 4156F2308B: SASL authentication failed; cannot authenticate to server email-smtp.us-west-2.amazonaws.com[54.213.255.181]: no mechanism available
Apr 17 09:08:50 mx01 postfix/smtp[2581]: warning: SASL authentication failure: No worthy mechs found
Apr 17 09:08:50 mx01 postfix/smtp[2581]: 4156F2308B: to=<andreluizpr@gmail.com>, relay=email-smtp.us-west-2.amazonaws.com[54.213.212.25]:25, delay=5.5, delays=0.23/0.09/5.2/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server email-smtp.us-west-2.amazonaws.com[54.213.212.25]: no mechanism available)

7 (edited by andreluizpr 2014-04-17 21:33:35)

Re: Amazon EC2 with iRedMail and Amazon SES

Hello ZhangHuangbin,

Thank you for your great help. After my last post I searched in Google and I found the solution to maillog error reported:

yum install cyrus-sasl-plain

Now, it's fine. Below my complete solution to integrate iRedMail with Amazon SES

- Change this lines in your main.inc.php (/var/www/roundcube/config)
$rcmail_config['smtp_server'] = "tls://127.0.0.1";
$rcmail_config['smtp_port'] = 587;


- Put this lines in main.cf (according Amazon)
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
relayhost = MailServerAmazon:25 ---------------> change to your preferred Amazon smtp server
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes

- Create sasl_passwd file in /etc/postfix with this content:
MailServerAmazon:25 USERNAME:PASSWORD ----------------> provided by Amazon

- Add following lines in master.cf

smtp-amavis unix -  -   -   -   2  smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20
    -o smtp_tls_security_level=none --------------------> add this line

127.0.0.1:10025 inet n  -   -   -   -  smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_tls_security_level=none
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_end_of_data_restrictions=
    -o mynetworks_style=host
    -o mynetworks=127.0.0.0/8
    -o strict_rfc821_envelopes=yes
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
    -o smtp_tls_security_level=none  --------------------> add this line

Reference: http://docs.aws.amazon.com/ses/latest/D … stfix.html

Cheers!

André

8

Re: Amazon EC2 with iRedMail and Amazon SES

Thanks for your sharing. smile

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee