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:diesnatalislaetitia.ddns.net/nextcloud

I ran this command:
acme.sh --issue -d diesnatalislaetitia.ddns.net --keylength 4096 -w
/var/www/letsencrypt
–key-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/key.pem
–ca-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/ca.pem
–cert-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/cert.pem
–fullchain-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/fullchain.pem
–reloadcmd “systemctl reload nginx.service”

It produced this output:Timeout during connect (likely firewall problem)
My web server is (include version): nginx
The operating system my web server runs on is (include version): Ubuntu LTS 16.04 (not sure)
My hosting provider, if applicable, is: myself?
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

I’ve set up an LEMP nextcloud service for myself a while ago (last week of june) then I went on business trip and more trips and in August: the certificate ran out.
So as I arrived home I tried to renew the certificate using the command shown above.
I’m very new to this stuff and only doing as a hobby.

I used this Tutorial to set up my nextcloud server. Even through it’s in german, you can see the commands.

the output of acme.sh DEBUG
I need to shorten it:

tobias@tobias-MS-7636:~$ sudo su
root@tobias-MS-7636:/home/tobias# acme.sh --issue -d diesnatalislaetitia.ddns.net --keylength 4096 -w /var/www/letsencrypt --key-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/key.pem --ca-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/ca.pem --cert-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/cert.pem --fullchain-file /etc/letsencrypt/diesnatalislaetitia.ddns.net/fullchain.pem --reloadcmd “systemctl reload nginx.service” --debug
[Do 5. Sep 15:53:58 CEST 2019] Lets find script dir.
[Do 5. Sep 15:53:58 CEST 2019] SCRIPT=’/root/.acme.sh/acme.sh’
[Do 5. Sep 15:53:58 CEST 2019] _script=’/root/.acme.sh/acme.sh’
[Do 5. Sep 15:53:58 CEST 2019] _script_home=’/root/.acme.sh’
[Do 5. Sep 15:53:58 CEST 2019] Using config home:/root/.acme.sh
https://github.com/Neilpang/acme.sh
v2.8.2
[Do 5. Sep 15:53:58 CEST 2019] _main_domain=‘diesnatalislaetitia.ddns.net
[Do 5. Sep 15:53:58 CEST 2019] _alt_domains=‘no’
[Do 5. Sep 15:53:58 CEST 2019] Using config home:/root/.acme.sh
[Do 5. Sep 15:53:58 CEST 2019] ACME_DIRECTORY=‘https://acme-v02.api.letsencrypt.org/directory
[Do 5. Sep 15:53:58 CEST 2019] DOMAIN_PATH=’/root/.acme.sh/diesnatalislaetitia.ddns.net’
[Do 5. Sep 15:53:58 CEST 2019] Using ACME_DIRECTORY: https://acme-v02.api.letsencrypt.org/directory
[Do 5. Sep 15:53:58 CEST 2019] _init api for server: https://acme-v02.api.letsencrypt.org/directory
[Do 5. Sep 15:53:58 CEST 2019] GET
[Do 5. Sep 15:53:58 CEST 2019] url=‘https://acme-v02.api.letsencrypt.org/directory
[Do 5. Sep 15:53:58 CEST 2019] timeout=
[Do 5. Sep 15:53:58 CEST 2019] _CURL=‘curl -L --silent --dump-header /root/.acme.sh/http.header -g ’
[Do 5. Sep 15:53:59 CEST 2019] ret=‘0’
[Do 5. Sep 15:53:59 CEST 2019] ACME_KEY_CHANGE=‘https://acme-v02.api.letsencrypt.org/acme/key-change
[Do 5. Sep 15:53:59 CEST 2019] ACME_NEW_AUTHZ
[Do 5. Sep 15:53:59 CEST 2019] ACME_NEW_ORDER=‘https://acme-v02.api.letsencrypt.org/acme/new-order
[Do 5. Sep 15:53:59 CEST 2019] ACME_NEW_ACCOUNT=‘https://acme-v02.api.letsencrypt.org/acme/new-acct
[Do 5. Sep 15:53:59 CEST 2019] ACME_REVOKE_CERT=‘https://acme-v02.api.letsencrypt.org/acme/revoke-cert
[Do 5. Sep 15:53:59 CEST 2019] ACME_AGREEMENT=‘https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
[Do 5. Sep 15:53:59 CEST 2019] ACME_NEW_NONCE=‘https://acme-v02.api.letsencrypt.org/acme/new-nonce

[Do 5. Sep 15:53:59 CEST 2019] Check for domain=‘diesnatalislaetitia.ddns.net
[Do 5. Sep 15:53:59 CEST 2019] _currentRoot=’/var/www/letsencrypt’

[Do 5. Sep 15:53:59 CEST 2019] _createcsr

[Do 5. Sep 15:54:00 CEST 2019] Getting webroot for domain=‘diesnatalislaetitia.ddns.net
[Do 5. Sep 15:54:00 CEST 2019] _w=’/var/www/letsencrypt’
[Do 5. Sep 15:54:00 CEST 2019] _currentRoot=’/var/www/letsencrypt’

[Do 5. Sep 15:54:00 CEST 2019] token=‘LjzXXc53BC358DmLvRavwrv6TZION_UyZ3yvVtzVVD4’
[Do 5. Sep 15:54:00 CEST 2019] uri=‘https://acme-v02.api.letsencrypt.org/acme/chall-v3/205528130/cv3Y5g

[Do 5. Sep 15:54:00 CEST 2019] ok, let’s start to verify
[Do 5. Sep 15:54:00 CEST 2019] Verifying: [Tobadin changed this to homepage]
[Do 5. Sep 15:54:00 CEST 2019] d=’[Tobadin changed this to homepage]’

[Do 5. Sep 15:54:00 CEST 2019] writing token:LjzXXc53BC358DmLvRavwrv6TZION_UyZ3yvVtzVVD4 to /var/www/letsencrypt/.well-known/acme-challenge/LjzXXc53BC358DmLvRavwrv6TZION_UyZ3yvVtzVVD4
[Do 5. Sep 15:54:00 CEST 2019] Changing owner/group of .well-known to www-data:www-data

[Do 5. Sep 15:54:01 CEST 2019] _ret=‘0’
[Do 5. Sep 15:54:01 CEST 2019] code=‘200’
… THIS PART REPEATS 7 TIMES
[Do 5. Sep 15:54:06 CEST 2019] diesnatalislaetitia.ddns.net:Verify error:Fetching http://diesnatalislaetitia.ddns.net/.well-known/acme-challenge/LjzXXc53BC358DmLvRavwrv6TZION_UyZ3yvVtzVVD4: Timeout during connect (likely firewall problem)

So i looked for the token, wether or not it was written there:

ls /var/www/letsencrypt/.well-known/acme-challenge/

letsencrypt@tobias-MS-7636:/var/www/letsencrypt/.well-known/acme-challenge$ ls -all
1RkYznQyayUCUgbePYTZySjHYT36OHXHkrYXdKlmPNY
B4Kyqwm140_DELsL7u_tNW7IVnL4ZoWMm3o4t17OTFI
kw-UDqVVapHTT_U-tvqtj3mu1y4wEgi5nmQRUffk3U4
LjzXXc53BC358DmLvRavwrv6TZION_UyZ3yvVtzVVD4
PkJbsw50nbdv9-JoP5fTjm0FnUpuuSUWTdGBQ_xa948
Uqdg-IJptqrhbe1tN43rcB8BPxU4u6VILIrvHMTPh1A
vVJJkCi5m9YjA7bXMiYJ-Ws5f2z8Zi3YyGUhUwx5hfY

so I guess this is working correct as the tokens are there.
when I try to connect to them in the webbrowser: I can't because there is no valid certificate
https://diesnatalislaetitia.ddns.net/.well-known/acme-challenge/LjzXXc53BC358DmLvRavwrv6TZION_UyZ3yvVtzVVD4

Hi @Tobadin

your port 80 doesn't answer - https://check-your-website.server-daten.de/?q=diesnatalislaetitia.ddns.net

Domainname Http-Status redirect Sec. G
http://diesnatalislaetitia.ddns.net/
178.27.98.79 -14 10.030 T
Timeout - The operation has timed out
http://diesnatalislaetitia.ddns.net/
2a02:810d:4d3f:ead8:a9f3:6b32:e117:37e3 -14 10.020 T
Timeout - The operation has timed out
https://diesnatalislaetitia.ddns.net/
178.27.98.79 404 3.150 N
Not Found
Certificate error: RemoteCertificateChainErrors
https://diesnatalislaetitia.ddns.net/
2a02:810d:4d3f:ead8:a9f3:6b32:e117:37e3 -14 10.040 T
Timeout - The operation has timed out
http://diesnatalislaetitia.ddns.net/.well-known/acme-challenge/check-your-website-dot-server-daten-dot-de
178.27.98.79 -14 10.030 T
Timeout - The operation has timed out
Visible Content:
http://diesnatalislaetitia.ddns.net/.well-known/acme-challenge/check-your-website-dot-server-daten-dot-de
2a02:810d:4d3f:ead8:a9f3:6b32:e117:37e3 -14 10.030 T
Timeout - The operation has timed out

Only timeouts, ipv6, ipv4. You need a working port 80 if you want to create a Letsencrypt certificate via http-validation.

Letsencrypt prefers ipv6, so that must work.

If only ipv4 works, remove the AAAA entry.

in the tutorial I had to only accept https requests. Is this the problem? I post my nginx configurations here:

nano /etc/nginx/conf.d/diesnatalislaetitia.ddns.net_letsencrypt.conf
server {
listen 127.0.0.1:81;
server_name 127.0.0.1;

    location ^~ /.well-known/acme-challenge {
            default_type text/plain;
            root /var/www/letsencrypt;
    }

}

That's wrong.

server {
	listen 80 default_server;
    listen [::]:80 default_server;

That's a port 80 vHost, http.

virtual gatewayserver:
nano /etc/nginx/conf.d/diesnatalislaetitia.ddns.net.conf
upstream php-handler {
server unix:/run/php/php7.2-fpm.sock;
}

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name diesnatalislaetitia.ddns.net 192.168.178.57;

    root /var/www;

    location ^~ /.well-known/acme-challenge {
            proxy_pass http://127.0.0.1:81;
            proxy_redirect off;
    }

    location / {
            # Enforce HTTPS
            # Use this if you always want to redirect to the DynDNS address (no local access).
            return 301 https://$server_name$request_uri;

            # Use this if you also want to access the server by local IP:
            #return 301 https://$server_addr$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name diesnatalislaetitia.ddns.net 192.168.178.57;

    # Certificates used
    ssl_certificate /etc/letsencrypt/diesnatalislaetitia.ddns.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/diesnatalislaetitia.ddns.net/key.pem;

    # Not using TLSv1 will break:
    #       Android <= 4.4.40
    #       IE <= 10
    #       IE mobile <=10
    # Removing TLSv1.1 breaks nothing else!
    # TLSv1.3 is not supported by most clients, but it should be enabled.
    ssl_protocols TLSv1.2 TLSv1.3;

    # Cipher suite from https://cipherli.st/
    # Max. security, but lower compatibility
    ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AE$

    # Cipher suite from https://wiki.mozilla.org/Security/Server_Side_TLS
    # Cipher suite from https://wiki.mozilla.org/Security/Server_Side_TLS
    #ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECD$

    # (Modern) cipher suite from https://mozilla.github.io/server-side-tls/ssl-config-generator/
    #ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECD$

    # Diffie-Hellman parameter for DHE ciphersuites, recommended 4096 bits
    ssl_dhparam /etc/nginx/ssl/dhparams.pem;

    # Use multiple curves.
    # secp521r1: Not supported by Chrome
    # secp384r1: Not supported by Android (DAVdroid)
    ssl_ecdh_curve secp521r1:secp384r1:prime256v1;

    # Server should determine the ciphers, not the client
    ssl_prefer_server_ciphers on;

    # OCSP Stapling
    # fetch OCSP records from URL in ssl_certificate and cache them
    ssl_stapling on;
    ssl_stapling_verify on;

    # This should be ca.pem
    # This should be ca.pem
    # See here: https://certbot.eff.org/docs/using.html
    ssl_trusted_certificate /etc/letsencrypt/diesnatalislaetitia.ddns.net/ca.pem;

    # This is the local DNS server (e.g. the IP of the Router if it is used as DNS server in the local networ$
    resolver 192.168.178.71;

    # SSL session handling
    ssl_session_timeout 24h;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;

    #
    # Add headers to serve security related headers
    #
    # HSTS (ngx_http_headers_module is required)
    # In order to be recoginzed by SSL test, there must be an index.hmtl in the server's root
    add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload;" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header X-Robots-Tag none always;
    add_header X-Download-Options noopen always;
    add_header X-Permitted-Cross-Domain-Policies none always;
    add_header Referrer-Policy no-referrer always;

    # Remove X-Powered-By, which is an information leak
    fastcgi_hide_header X-Powered-By;

    location = / {
    # Disable access to the web root, otherwise nginx will show the default site here.
    #       deny all;
    }

    #
    # Nextcloud
    #
    location ^~ /nextcloud/ {
            # Set max. size of a request (important for uploads to Nextcloud)
            client_max_body_size 10G;
            # Besides the timeout values have to be raised in nginx' Nextcloud config, these values have to b$
            proxy_connect_timeout 3600;
            proxy_send_timeout 3600;
            proxy_read_timeout 3600;
            send_timeout 3600;
            proxy_buffering off;
            send_timeout 3600;
            proxy_buffering off;
            proxy_request_buffering off;
            proxy_max_temp_file_size 10240m;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass http://127.0.0.1:82;
            proxy_redirect off;
    }

    # These two location blocks are needed, otherwise you'll get warnings in the Nextcloud admin UI later on
    location = /.well-known/carddav {
            return 301 $scheme://$host/nextcloud/remote.php/dav;
    }

    location = /.well-known/caldav {
            return 301 $scheme://$host/nextcloud/remote.php/dav;
    }

    # Well-known URL for Webfinger
    # Regardless of this rule, you'll get a warning in the admin UI when the social app is not installed
    location = /.well-known/webfinger {
            return 301 $scheme://$host/nextcloud/public.php?service=webfinger;
            return 301 $scheme://$host/nextcloud/public.php?service=webfinger;
    }

    location ~ /(ocm-provider|ocs-provider)/ {
            return 301 $scheme://$host/nextcloud/$1/;
    }

}

Port TCP 80, 81,443 are opened and forwarded in my router configuration

image

der server usw scheint zu laufen. local ist er erreichbar
auch service nginx, mariadb status funktioniert

That's required, but not enough. Letsencrypt must be able to connect your domain.

So use online tools to check your configuration. Your local checks can't check that.

okay. After 4 weeks on holiday and jetlag my brainfuction came back…
so it really was a rule which was magically dropped from the ufw.

I refreshed the certificate and everything is well now.

Thank you Jürgen

1 Like

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