POP3 Polling SSL Issue

AI-generated summary

Users angus and gerhard reported a POP3 polling SSL issue in Discourse, where the Poll Mailbox job failed with the error: “SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)”. Despite using a valid Let’s Encrypt certificate and Gmail’s POP3 server (pop.gmail.com:995), the issue arose unexpectedly after months of stable operation. angus confirmed that disabling “pop3 polling openssl verify” resolved the issue, though this is not ideal for security. gerhard identified the root cause as an incompatibility between TLS 1.3 and Ruby, and committed a workaround to address it. He also agreed that POP3 errors (not just timeouts or auth failures) should be visible in the admin UI to prevent silent failures affecting email import. This issue highlights a need for better error visibility and upstream fixes for TLS/Ruby compatibility.

Doing a regular check of the logs on a production Discourse I noticed the Poll Mailbox job was failing with this error:

Job exception: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)

Some relevant notes:

  • This instance is a standard Discourse installation on Digital Ocean with a LetsEncrypt certificate. There’s nothing else on the server.
  • Pop3 email importation has been working on it without any issues for a number of months.
  • There’s no indication of any issues on the gmail side (i.e. suspcious sign-in etc)

There is an interesting topic here that mentions the same error, but it seems that that concerns an installation that actually has a self signed certificate: Reply by email SSL self signed certificate error.

The relevant site settings were:

pop3 polling enabled: true
pop3 polling ssl: true
pop3 polling openssl verify: true
pop3 polling period mins: 5
pop3 polling host: pop.gmail.com
pop3 polling port: 995
pop3 polling username: // a gmail username
pop3 polling password: // a gmail password
pop3 polling delete from server: true

I initially tried toggling pop3 polling enabled, but this did nothing (and no errors were returned). I also rebuilt the container. Finally, I changed pop3 polling openssl verify to false and the Poll Mailbox job now works again.

I’m not sure what to make of this atm, but thought I might report it for now.

As a side note, if the Poll Mailbox job is failing it might be good to log it somewhere in the admin UI, as a “silent” failure there, and a failure to import messages, can cause a bit of an issue.

3 Likes

I’m seeing the same problem on one of my sites. I’m having a look…

2 Likes

This was caused by an incompatibility between TLS 1.3 and Ruby. I’ve committed a workaround and will try to get this fixed upstream.

And I agree, we should show all POP3 errors in the admin dashboard, not just timeouts and auth errors. I’ll fix that as well.

10 Likes