postal icon indicating copy to clipboard operation
postal copied to clipboard

TLS Negotiation failed: FAILED_PRECONDITION: starttls error (0): protocol error

Open mjml1982 opened this issue 6 years ago • 14 comments

Hi,

I have set the routing endpoint to gsuite email address for the sending email address(as there is no physical mailbox exists for the sender email address) so that whenever a person replies to the email it should be sent to the routing endpoint email address.

The problem I'm facing is whenever i send emails from any gmail or gsuite emaill address these emails are not delivering to an endpoint email address and giving this error message "TLS Negotiation failed: FAILED_PRECONDITION: starttls error (0): protocol error ".

However they are delivering fine from outlook, zoho and other email clients.

I also do not see emails sent from gmail as incoming messages in dashboard, it seems to me that messages sent from gmail/gsuite are not reaching to Postal.

Any help would be highly appreciated.

Thanks.

mjml1982 avatar Oct 07 '20 17:10 mjml1982

Where are you seeing that error message?

willpower232 avatar Oct 09 '20 08:10 willpower232

It came to my gmail account from where i'm sending email.

mjml1982 avatar Oct 09 '20 10:10 mjml1982

can you share a screenshot?

willpower232 avatar Oct 12 '20 14:10 willpower232

@willpower232 Here is the screenshot

Firefox_Screenshot_2020-10-12T16-15-25 571Z

mjml1982 avatar Oct 12 '20 19:10 mjml1982

It might be that you haven't set up Postals SMTP to use a real certificate and gmail is the only provider that is strict in this regard which is good to know.

Have you configured these settings in your postal.yml? https://github.com/postalhq/postal/blob/2595481b266199d8e29347dea2764f2c10202805/config/postal.defaults.yml#L75-L77

willpower232 avatar Oct 13 '20 10:10 willpower232

@willpower232 I have set up the Let's Encrypt free SSL certificate for nginx and Postal, this is how Postal configuration looks.

smtp:
  # Specify an SMTP server that can be used to send messages from the Postal management
  # system to users. You can configure this to use a Postal mail server once the
  # your installation has been set up.
  host: 127.0.0.1
  port: 25
  username: # Complete when Postal is running and you can
  password: # generate the credentials within the interface.
  from_name: Postal
  from_address: [email protected]
  
smtp_server:
  tls_enabled: true
  tls_certificate_path: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
  tls_private_key_path: /etc/letsencrypt/live/mail.mydomain.com/privkey.pem

mjml1982 avatar Oct 13 '20 10:10 mjml1982

@willpower232 When i disable/remove these lines, it works fine but how we can get it work with the letsencrypt real SSL.

smtp_server:
  tls_enabled: true
  tls_certificate_path: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
  tls_private_key_path: /etc/letsencrypt/live/mail.mydomain.com/privkey.pem

mjml1982 avatar Oct 13 '20 13:10 mjml1982

Out of curiousity, do you have any firewalls or proxying present?

willpower232 avatar Oct 14 '20 08:10 willpower232

No, there is no firewall or proxy present on my server.

mjml1982 avatar Oct 14 '20 11:10 mjml1982

You could try using this command to verify how well Postal is using SSL openssl s_client -connect your.postal.server.ip:25 -starttls smtp, I'm not really qualified to understand the output but if that command errors or does not talk about Lets Encrypt then you might have a clue what is wrong.

willpower232 avatar Oct 18 '20 11:10 willpower232

When I changed the certificate path to a self-signed certificate the output of this command shows the result saying it's using a self-signed certificate, but in same location (/opt/postal/config/) I only see lets_encrypt.pem file which I'm not sure if it's a cert file or key file, I have used the same file for both tls_certificate_path and tls_private_key_path but it's giving me an error message.

smtp_server:
  tls_enabled: true
  tls_certificate_path: /opt/postal/config/fast_server.cert
  tls_private_key_path: /opt/postal/config/fast_server.key

cert

When I use the following SSL location it does not give any error message, it says no SSL has been configured or found.

tls_enabled: true
 tls_certificate_path: /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
 tls_private_key_path: /etc/letsencrypt/live/mail.mydomain.com/privkey.pem

Hope this information will help!

Thank you s much for the help so far 👍

mjml1982 avatar Oct 18 '20 12:10 mjml1982

That implies that Postal is unable to access the files or that file path is not correct. You might have to change the permissions on the folders to allow Postal to read the files.

willpower232 avatar Oct 18 '20 12:10 willpower232

It worked! Thank you so much for the great support!

mjml1982 avatar Oct 18 '20 15:10 mjml1982

no problemo, feel free to close the issue if you have no more queries

willpower232 avatar Oct 19 '20 17:10 willpower232