Nginx mail server failing authorization "Connection reset by peer"

My domain is: mail.kiltandblade.com

I ran this command: sudo certbot --nginx certonly --dry-run

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: mail.kiltandblade.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for mail.kiltandblade.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. mail.kiltandblade.com (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Connection reset by peer

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: mail.kiltandblade.com
   Type:   connection
   Detail: Connection reset by peer

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

My web server is (include version): nginx/1.10.3

The operating system my web server runs on is (include version): Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-98-generic x86_64)

My hosting provider, if applicable, is: OVH (SSD VPS)

I can login to a root shell on my machine (yes or no, or I don’t know): yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no

Started following an Ars Technica tutorial/walkthrough for setting up a mail server, but decided to deviate on where I procured the SSL/TLS certificate due to issues with StartCom. Nginx was set up automatically as part of the mail-stack-delivery package and as such I’m not entirely familiar with its configuration. Also, sudo ufw status returns Status: inactive, and if I enable it I get

Status: active

To                         Action      From
--                         ------      ----
443                        ALLOW       Anywhere
443 (v6)                   ALLOW       Anywhere (v6)

As I manually allowed https in a previous attempt to get certbot to work. (But is disabled currently so shouldn’t be interfering with anything)

Additionally the /etc/nginx/sites-enabled/default (or sites-available/default) file is listening of 443
i.e.

listen 443 ssl default_server;
listen [::]:443 ssl default_server;

I’m not sure what else I should be looking for, or need to tweak. Does anyone here know what’s causing the “connection reset by peer”?

I don’t, but are you sure the DNS settings and networking situation are okay? Could OVH have a firewall upstream?

mail.kiltandblade.com.  (signed)  1800  A     151.80.58.16
mail.kiltandblade.com.  (signed)  1799  A     176.31.162.179
mail.kiltandblade.com.  (signed)  1799  AAAA  2001:41d0:302:2200::250a

$ nc -vz 2001:41d0:302:2200::250a 443
nc: connect to 2001:41d0:302:2200::250a port 443 (tcp) failed: No route to host
$ nc -vz 176.31.162.179 443
Connection to 176.31.162.179 443 port [tcp/https] succeeded!
$ nc -vz 151.80.58.16 443
nc: connect to 151.80.58.16 port 443 (tcp) failed: Connection refused
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.