Timeout during connect (likely firewall problem)

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: dhis2.nih.org.pk

I ran this command: sudo certbot-auto --nginx -d dhis2.nih.org.pk

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for dhis2.nih.org.pk
Waiting for verification...
Challenge failed for domain dhis2.nih.org.pk
http-01 challenge for dhis2.nih.org.pk
Cleaning up challenges
Some challenges have failed.

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

   Domain: dhis2.nih.org.pk
   Type:   connection
   Detail: Fetching
   http://dhis2.nih.org.pk/.well-known/acme-challenge/enj2RtrqkMkOxR3AQbkgt84PP45UJIBKwiKskGxl7aY:
   Timeout during connect (likely firewall problem)

   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.

My web server is (include version): nginx/1.14.0 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 18.04

My hosting provider, if applicable, is: Digital Ocean

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

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): 0.31.0

I have had problems previously with renewing certificates on this server but the command used above worked for me last time I think.

This time after trying many options in desperation I have deleted the certificate and tried to create a new one but I am having the same timeout issue. I suspect this is a web server configuration issue rather than a Let’s Encrypt issue but would welcome any help.

My nginx configuration is:

# apply these settings to all backends
proxy_cache_path  /var/cache/nginx  keys_zone=dhis:250m  inactive=1d;
proxy_redirect    off;
proxy_set_header  Host               $host;
proxy_set_header  X-Real-IP          $remote_addr;
proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
proxy_set_header  X-Forwarded-Proto  https;
proxy_cookie_path / "/; secure";
#proxy_cache       dhis;


# redirect http to https server
server {
  listen     80 default_server;
  listen     [::]:80;
  # rewrite    ^ https://$host$request_uri? permanent;
  # redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
  return 301 https://$host$request_uri;
}

# HTTPS server
server {
  listen               443 ssl http2;
  listen               [::]:443 ssl http2 default_server;
  root /home/dhis/tomcat-dhis/webapps/ROOT;
  server_name dhis2.nih.org.pk;
  client_max_body_size 400M;


  # ssl stuff
  ssl                  on;
     ssl_certificate /etc/letsencrypt/live/dhis2.nih.org.pk/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/dhis2.nih.org.pk/privkey.pem; # managed by Certbot
  ssl_session_timeout  30m;
  # ssl_protocols              TLSv1 TLSv1.1 TLSv1.2;
  ssl_session_cache shared:SSL:20m;
  # ssl_prefer_server_ciphers  on;

  # You need to generate the dh parameters before using this setting
  # Command:  openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
  ssl_dhparam /etc/ssl/certs/dhparam.pem;

  # intermediate configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    # HSTS (ngx_http_headers_module is required) (63072000 seconds)
    add_header Strict-Transport-Security "max-age=63072000" always;

    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;

  # Serve static files

  location ~ (\.js|\.css|\.gif|\.woff|\.ttf|\.eot|\.ico|(/dhis-web-commons/|/images/|/icons/).*\.png)$ {
   add_header  Cache-Control public;
    expires     14d;
  }

  # Proxy pass to servlet container

  location / {
    # proxy_pass                http://localhost:8080/;
    proxy_pass                http://127.0.0.1:8080/;
    proxy_redirect            off;
    proxy_set_header          Host               $host;
    proxy_set_header          X-Real-IP          $remote_addr;
    proxy_set_header          X-Forwarded-For    $proxy_add_x_forwarded_for;
    proxy_set_header          X-Forwarded-Proto  https;
    proxy_buffer_size         128k;
    proxy_buffers             8 128k;
    proxy_busy_buffers_size   256k;
    proxy_read_timeout 5m;
  }

  # This is quite strict.  If you have much older windoze browsers
  # to support you might need the line below instead.
  #
  # ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

  # ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";

  # Enable HSTS
  # add_header Strict-Transport-Security max-age=63072000;
  # add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

  # Do not allow this site to be displayed in iframes
 #  add_header X-Frame-Options DENY;

  # Do not permit Content-Type sniffing.
  add_header X-Content-Type-Options nosniff always;

  # inject X-FRAME-OPTIONS in HTTP Header to prevent clickjacking attack.
  # add_header X-Frame-Options SAMEORIGIN;

  # add_header X-XSS-Protection "1;mode=block";

  # add_header Content-Security-Policy "default-src 'self'";
    
  # Breaks things!
  # add_header Content-Security-Policy "default-src 'self'; script-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; frame-src 'self'; connect-src 'self' https://apis.google.com; object-src 'none' ";

  # nominate a backend as the default
  # rewrite ^/$ /dhis/;

  # Proxy pass to servlet containers
  # location /dhis { proxy_pass  http://localhost:8080/dhis; }

}

The site worked fine until the certificate expired. I would set up a cron job if I could find a reliable way of renewing the certificate.

Thanks for any help,

Paul

Edit: obviously I have checked that the site is not behind a firewall.

1 Like

Hi @prcleary

there are checks of your domain, last is ~~one hour old - https://check-your-website.server-daten.de/?q=dhis2.nih.org.pk

Only timeouts:

Domainname Http-Status redirect Sec. G
http://dhis2.nih.org.pk/ 115.186.130.3 -14 10.120 T
Timeout - The operation has timed out
https://dhis2.nih.org.pk/ 115.186.130.3 -14 10.443 T
Timeout - The operation has timed out
http://dhis2.nih.org.pk/.well-known/acme-challenge/check-your-website-dot-server-daten-dot-de 115.186.130.3 -14 10.037 T
Timeout - The operation has timed out
Visible Content:

Works http internal? What says

curl http://dhis2.nih.org.pk/.well-known/acme-challenge/1234

from that machine?

There is (1) a wrong router config and / or (2) a blocking firewall or something else. You have to find that and remove it.

2 Likes

Thanks very much for the quick reply Juergen. The curl command times out. My colleagues in another timezone where this is hosted assured me that they had bypassed the firewall but I have asked them to check the port forwarding as well. I will have to wait to try again tomorrow.

Edit: of course you meant me to run the curl command on the server itself: I get a 301 error from that

1 Like

They did something at the other end (waiting to find out what) and I was able to renew the certificate. Thanks again, Paul

2 Likes

Apparently it was an error in the port forwarding

2 Likes