Cant access the website at https after obtaining the certificate

Hi, I am facing the following issue:

  1. Before obtaining the certificate I can access the website at http://www.badianyihou.com/
  2. I am using dokku letsencrypt plugin to obtain the certificate for my domain badianyihou.com
  3. After that I can't access the website anymore. And I get Conection timeout error in the browser.
  4. When I run curl https://badianyihou.com command in the terminal, I get this output:
    LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to badianyihou.com:443
  5. Output of dokku letsencrypt:list is
    -----> App name Certificate Expiry Time before expiry Time before renewal
    zfw-rails 2022-01-24 14:18:43 89d, 21h, 55m, 13s 59d, 21h, 55m, 13s
  6. Output of dokku certs:report
    root@iZuf6d553vzl5isdk61egyZ:~# dokku certs:report
    O = Digital Signature Trust Co., CN = DST Root CA X3
    error 10 at 3 depth lookup: certificate has expired
    =====> zfw-rails ssl information
    Ssl dir: /home/dokku/zfw-rails/tls
    Ssl enabled: true
    Ssl hostnames: badianyihou.com www.badianyihou.com
    Ssl expires at: Jan 24 06:18:43 2022 GMT
    Ssl issuer: C = US, O = Let's Encrypt, CN = R3
    Ssl starts at: Oct 26 06:18:44 2021 GMT
    Ssl subject: subject=CN = badianyihou.com
    Ssl verified: self signed
  7. Output of dokku proxy:report zfw-rails
    =====> zfw-rails proxy information
    Proxy enabled: true
    Proxy port map: http:80:5000 https:443:5000
    Proxy type: nginx

The details are below:

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. crt.sh | 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:
badianyihou.com
I ran this command:
dokku letsencrypt:enable zfw-rails
It produced this output:

Getting letsencrypt certificate for zfw-rails...
- Domain 'badianyihou.com'
- Domain 'www.badianyihou.com'
2021/10/26 07:18:27 No key found for account info@badianyihou.com. Generating a P256 key.
2021/10/26 07:18:27 Saved key to /certs/accounts/acme-v02.api.letsencrypt.org/info@badianyihou.com/keys/info@badianyihou.com.key
2021/10/26 07:18:28 [INFO] acme: Registering account for info@badianyihou.com
!!!! HEADS UP !!!!

   Your account credentials have been saved in your Let's Encrypt
   configuration directory at "/certs/accounts".

   You should make a secure backup of this folder now. This
   configuration directory will also contain certificates and
   private keys obtained from Let's Encrypt so making regular
   backups of this folder is ideal.
   2021/10/26 07:18:28 [INFO] [badianyihou.com, www.badianyihou.com] acme: Obtaining bundled SAN certificate
   2021/10/26 07:18:30 [INFO] [badianyihou.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/43386173710
   2021/10/26 07:18:30 [INFO] [www.badianyihou.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/43386173720
   2021/10/26 07:18:30 [INFO] [badianyihou.com] acme: Could not find solver for: tls-alpn-01
   2021/10/26 07:18:30 [INFO] [badianyihou.com] acme: use http-01 solver
   2021/10/26 07:18:30 [INFO] [www.badianyihou.com] acme: Could not find solver for: tls-alpn-01
   2021/10/26 07:18:30 [INFO] [www.badianyihou.com] acme: use http-01 solver
   2021/10/26 07:18:30 [INFO] [badianyihou.com] acme: Trying to solve HTTP-01
   2021/10/26 07:18:30 [INFO] [badianyihou.com] Served key authentication
   2021/10/26 07:18:30 [INFO] [badianyihou.com] Served key authentication
   2021/10/26 07:18:30 [INFO] [badianyihou.com] Served key authentication
   2021/10/26 07:18:31 [INFO] [badianyihou.com] Served key authentication
   2021/10/26 07:18:36 [INFO] [badianyihou.com] The server validated our request
   2021/10/26 07:18:36 [INFO] [www.badianyihou.com] acme: Trying to solve HTTP-01
   2021/10/26 07:18:37 [INFO] [www.badianyihou.com] Served key authentication
   2021/10/26 07:18:37 [INFO] [www.badianyihou.com] Served key authentication
   2021/10/26 07:18:37 [INFO] [www.badianyihou.com] Served key authentication
   2021/10/26 07:18:37 [INFO] [www.badianyihou.com] Served key authentication
   2021/10/26 07:18:44 [INFO] [www.badianyihou.com] The server validated our request
   2021/10/26 07:18:44 [INFO] [badianyihou.com, www.badianyihou.com] acme: Validations succeeded; requesting certificates
   2021/10/26 07:18:46 [INFO] [badianyihou.com] Server responded with a certificate.

-----> Certificate retrieved successfully.
-----> Installing let's encrypt certificates
-----> Unsetting DOKKU_PROXY_PORT
-----> Setting config vars
DOKKU_PROXY_PORT_MAP: http:80:5000
-----> Setting config vars
DOKKU_PROXY_PORT_MAP: http:80:5000 https:443:5000
-----> Configuring badianyihou.com...(using built-in template)
-----> Configuring www.badianyihou.com...(using built-in template)
-----> Creating https nginx.conf
Enabling HSTS
Reloading nginx
-----> Configuring badianyihou.com...(using built-in template)
-----> Configuring www.badianyihou.com...(using built-in template)
-----> Creating https nginx.conf
Enabling HSTS
Reloading nginx
-----> Disabling ACME proxy for zfw-rails...
Reloading nginx configuration (via systemctl): nginx.service.
-----> Done

My web server is (include version):
dokku core nginx-vhosts plugin 0.25.3
The operating system my web server runs on is (include version):
ubuntu_20_04_x64_20G_alibase_20210623.vhd
My hosting provider, if applicable, is:
aliyun.com
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 (not sure what this means)
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
letsencrypt 0.12.1 Automated installation of let's encrypt TLS certificates

Hi @filser89 and welcome to the LE community forum :slight_smile:

I'm no expert with any of the things you mentioned...
But in reading through your post, I found some things that just stabbed me in the eyes:

And now I'm typing with my eyes closed...
Please show the output of:
top

1 Like

Hi, thank's for the reply.
Here is the output of top

top - 16:44:48 up  1:24,  3 users,  load average: 0.01, 0.02, 0.00
Tasks: 117 total,   1 running, 116 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3792.9 total,   2039.7 free,    887.6 used,    865.6 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   2653.3 avail Mem 

**PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND**                                                                                                                             
    714 root      10 -10  124384  32860  14064 S   0.7   0.8   0:33.43 AliYunDun                                                                                                                           
    458 root      20   0   17804   2552   2104 S   0.3   0.1   0:00.69 assist_daemon                                                                                                                       
    915 systemd+  20   0   58604   9136   6024 S   0.3   0.2   0:09.48 redis-server                                                                                                                        
   1170 root      20   0 1076428 156864  19436 S   0.3   4.0   0:08.23 bundle                                                                                                                              
   1270 root      20   0 1076476 150676  19644 S   0.3   3.9   0:07.07 bundle                                                                                                                              
   1286 root      20   0 1076480 156700  19544 S   0.3   4.0   0:07.38 bundle                                                                                                                              
      1 root      20   0  101832  11240   8352 S   0.0   0.3   0:00.74 systemd                                                                                                                             
      2 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kthreadd                                                                                                                            
      3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp                                                                                                                              
      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp                                                                                                                          
      6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-kblockd                                                                                                                
      7 root      20   0       0      0      0 I   0.0   0.0   0:00.63 kworker/0:1-events                                                                                                                  
      9 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq                                                                                                                        
     10 root      20   0       0      0      0 S   0.0   0.0   0:00.07 ksoftirqd/0                                                                                                                         
     11 root      20   0       0      0      0 I   0.0   0.0   0:01.92 rcu_sched                                                                                                                           
     12 root      rt   0       0      0      0 S   0.0   0.0   0:00.02 migration/0                                                                                                                         
     13 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 idle_inject/0                                                                                                                       
     14 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0                                                                                                                             
     15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/1                                                                                                                             
     16 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 idle_inject/1                                                                                                                       
     17 root      rt   0       0      0      0 S   0.0   0.0   0:00.08 migration/1                                                                                                                         
     18 root      20   0       0      0      0 S   0.0   0.0   0:00.07 ksoftirqd/1                                                                                                                         
     20 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/1:0H-kblockd                                                                                                                
     21 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kdevtmpfs                                                                                                                           
     22 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 netns                                                                                                                               
     23 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_kthre                                                                                                                     
     24 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kauditd                                                                                                                             
     25 root      20   0       0      0      0 S   0.0   0.0   0:00.00 khungtaskd                                                                                                                          
     26 root      20   0       0      0      0 S   0.0   0.0   0:00.00 oom_reaper                                                                                                                          
     27 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 writeback                                                                                                                           
     28 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kcompactd0                                                                                                                          
     29 root      25   5       0      0      0 S   0.0   0.0   0:00.00 ksmd                                                                                                                                
     30 root      39  19       0      0      0 S   0.0   0.0   0:00.00 khugepaged                                                                                                                          
     76 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kintegrityd                                                                                                                         
     77 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kblockd                                                                                                                             
     78 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 blkcg_punt_bio                                                                                                                      
     79 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 tpm_dev_wq                                                                                                                          
     80 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 ata_sff                                                                                                                             
     81 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 md                                                                                                                                  
     82 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 edac-poller                                                                                                                         
     83 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 devfreq_wq                                                                                                                          
     84 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 watchdogd                                                                                                                           
     88 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kswapd0                                                                                                                             
     89 root      20   0       0      0      0 S   0.0   0.0   0:00.00 ecryptfs-kthrea                                                                                                                     
     91 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kthrotld                                                                                                                            
     92 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 acpi_thermal_pm                                                                                                                     
     93 root      20   0       0      0      0 S   0.0   0.0   0:00.00 scsi_eh_0

well that doesn't explain why it took like 20 seconds to return:

curl -Ii http://www.badianyihou.com/
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 26 Oct 2021 08:35:06 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://www.badianyihou.com:443/
Strict-Transport-Security: max-age=15724800; includeSubdomains
1 Like

Can you update that LE client?
Can you explain why both 80 and 443 appear to be mapped to the same port ("5000")?
[OR did I read that wrong?]

1 Like

Updated LE with dokku plugin:update letsencrypt . Version is still letsencrypt 0.12.1

As far as the ports, I found this explanation:

By default, dockerfile apps without explicitly exposed ports (i.e. using the EXPOSE directive) will be configured with a listener on port 80 (and additionally a listener on 443 if ssl is enabled) that will proxy to the application container on port 5000 Dockerfile apps with explicitly exposed ports will be configured with a listener on each exposed port and will proxy to that same port of the deployed application container.

Do you recommend to change the ports?

Do you reckon it has something to do with "certificate has expired"? I don't know why that would show up when the certificate is until January...

@filser89 No, the expiration is a different issue. It would not block access to port 443. I can see your site with http just fine although it redirects me to https which times out.

But, what does this command show: dokku proxy:ports myapp

I am just reading through the dokku readme at github and double-checking.

1 Like

-----> Port mappings for zfw-rails
-----> scheme host port container port
http 80 5000
https 443 5000

@filser89 Thanks. I just noticed port 443 is not open. Only these:

PORT     STATE  SERVICE
22/tcp   open   ssh
80/tcp   open   http
3389/tcp closed ms-wbt-server

I do not know docker / dokku so not sure what to instruct but 443 should be open

1 Like

Yes.
I don't see how both HTTP & HTTPS can be sent to the same port ("5000").
I'd change one of them.

1 Like

Thanks! How did you get that info?

So, does this solution look correct to you?

link:

nmap

There are a variety of websites that do nmap if you do not have the command available

As to your other info no I do not think that is enough. You just showed the output of the dokku port mapping and it was ok (pending question about port 5000).

I think there is something more fundamental missing to allow 443 - perhaps in docker config or its environ. Sorry, not good with that.

1 Like

@rg305 @MikeMcQ Thank you both for helping. We really appreciate how fast you replied.

We ended up going through this: https://linuxconfig.org/ubuntu-20-04-open-http-port-80-and-https-port-443-with-ufw without success.

The port 443 was still closed (can test with this website: Online Port Scanner with Nmap - Discover open TCP ports)

In the end we had to add a security group in the server instance on the aliyun control panel which took all of 2 minutes :slight_smile:

3 Likes

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