SMTP – Why UFW Blocks SMTP Plugin from Dokuwiki

smtpufw

I have on a virtual server (Ubuntu 20.4) Dokuwiki (2020-07-29 "Hogfather") with the SMTP plugin (Last updated on 2020-11-21) installed. My pages are delivered HTTPS encrypted, using certbot.

I want to use the SMTP plugin from dokuwiki with an existing mail server from my provider. I filled in the necessary credentials: username, SMTP server address, port 465 and SSL.

I get this debug message from dokuwiki with UFW enabled:

There was an unexpected problem communicating with SMTP: Could not open SMTP Port.
SMTP log:

Set: the server
Set: the auth
Set: a message will be sent
Connecting to mysmtp.mailout.server.de at 465

When I deactivate UFW (sudo ufw disable) , dokuwiki sends e-mails.

So I think my UFW rules are too strict:

sudo ufw status numbered

results in:

Status: active

 To Action From
 - ------ ----
[1] OpenSSH ALLOW IN Anywhere
[2] Apache Full ALLOW IN Anywhere
[3] 21 / tcp ALLOW IN Anywhere

What did I forget or did not understand?

Best Answer

If you have UFW running on your machine, then it means that all connections (except the ones you define) are going to be blocked. So in order to ensure that SMTP plugin works, you have to ensure that you are allowing communications on the default SMTP ports. Now, I'm not quite sure which one of them is used by your plugin, but it should be one of these: 25, 465, 587 or 2525.

Possibly check the documentation for more information about on which port your SMTP is running on, or you can possibly check the logs/tcpdump, or if you looking for an easier way enable all and see if its working, then remove the rules one-by-one until the sending fails.

Related Topic