I'm new to all this. I try to set up Postfix on Ubuntu Server 16.04TLS
My situation requires to use a relay server to send external mails
Main.cf:
#RELAY STUFF
#enable SASL authentication
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_wrappermode = yes
smtp_tls_security_level = encrypt
relayhost = [mailgate.myisp.net]:465
This configuration works fine and I can send and receive mails both locally and to other domains.
However as soon as I try to activate Amavis with the following line:
content_filter = amavis:[127.0.0.1]:10024
I get errors on my log:
Dec 20 13:21:41 iserv postfix/qmgr[4628]: 54AFB8408F7: from=<mail1@mydomain.net>, size=358, nrcpt=1 (queue active)
Dec 20 13:21:41 iserv postfix/smtp[4678]: SSL_connect error to 127.0.0.1[127.0.0.1]:10024: -1
Dec 20 13:21:41 iserv postfix/smtp[4678]: warning: TLS library problem: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:
Dec 20 13:21:41 iserv postfix/smtp[4678]: 54AFB8408F7: to=<mail2@mydomain.net>, relay=127.0.0.1[127.0.0.1]:10024, delay=33, delays=33/0.03/0.01/0, dsn=4.7.5, status=deferred (Cannot start TLS: handshake failure)
Dec 20 13:21:44 iserv postfix/smtpd[4674]: disconnect from localhost[::1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5smtp[7450]: warning: TLS library problem: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:
Does anyone knows any solution to this ? It seems that postfix tries to use TLS with Amavis as well.
On my Master.cf I tried:
amavis unix - - - - 2 smtp
-o smtp_tls_security_level=none
-o smtpd_tls_security_level=none
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o smtpd_tls_security_level=none
-o smtp_tls_security_level=none
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o mynetworks=127.0.0.0/8
-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
As you can see I tried to override amavis with
-o smtp_tls_security_level=none
-o smtpd_tls_security_level=none
I also tried to modify smtps:
smtps inet n - y - - smtpd
# -o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtp_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
Now I get these errors:
Dec 20 17:06:05 iserv postfix/smtpd[11186]: connect from localhost[::1]
Dec 20 17:06:41 iserv postfix/smtpd[11186]: DA28F840BD8: client=localhost[::1]
Dec 20 17:06:51 iserv postfix/cleanup[11190]: DA28F840BD8: message-id=<20161220150641.DA28F840BD8@mail.mydomain.net>
Dec 20 17:06:51 iserv postfix/qmgr[11142]: DA28F840BD8: from=<mail1@mydomain.net>, size=333, nrcpt=1 (queue active)
Dec 20 17:06:51 iserv postfix/smtp[11191]: warning: smtp_tls_wrappermode requires "smtp_tls_security_level = encrypt" (or stronger)
Dec 20 17:06:51 iserv postfix/smtp[11191]: DA28F840BD8: to=<mail2@mydomain.net>, relay=none, delay=22, delays=22/0.02/0/0, dsn=4.3.0, status=deferred (server unavailable or unable to receive mail)
Dec 20 17:07:32 iserv postfix/smtpd[11186]: 79388840BDA: client=localhost[::1]
Dec 20 17:07:41 iserv postfix/cleanup[11190]: 79388840BDA: message-id=<20161220150732.79388840BDA@mail.mydomain.net>
Dec 20 17:07:41 iserv postfix/qmgr[11142]: 79388840BDA: from=<mail1@mydomain.net>, size=334, nrcpt=1 (queue active)
Dec 20 17:07:41 iserv postfix/smtp[11191]: warning: smtp_tls_wrappermode requires "smtp_tls_security_level = encrypt" (or stronger)
Dec 20 17:07:41 iserv postfix/smtp[11191]: 79388840BDA: to=<myemail@gmail.com>, relay=none, delay=20, delays=20/0/0/0, dsn=4.3.0, status=deferred (server unavailable or unable to receive mail)
Dec 20 17:07:44 iserv postfix/smtpd[11186]: disconnect from localhost[::1] ehlo=1 mail=2/3 rcpt=2 data=2 quit=1 commands=8/9
If I remove amavis
#content_filter = amavis:[127.0.0.1]:10024
Then it all works!
PS: If I don't setup the relay server and use the "default" values for Amavis that I find all over the net then everything works besides sending mail to external domains.
After more searching it seems that it's the
smpt_tls_wrappermode=yes
option that brakes things up. Without it my mail server works but I get an error when trying to communicate with the relay server:
Dec 20 19:43:36 iserv postfix/smtp[18270]: SMTPS wrappermode (TCP port 465) requires setting "smtp_tls_wrappermode = yes", and "smtp_tls_security_level = encrypt" (or stronger)
Dec 20 19:44:36 iserv postfix/smtp[18270]: 9BBD5840C1C: to=<myemail@gmail.com>, relay=mailgate.myisp.net[62.103.147.202]:465, delay=60, delays=0/0.03/60/0, dsn=4.4.2, status=deferred (conversation with mailgate.myisp.net[XXX.XXX.XXX.XXX] timed out while receiving the initial server greeting)
Any help ?
Currently I'm completely lost. Thank you!