server icon indicating copy to clipboard operation
server copied to clipboard

nginx docker service won't start due to missing dhparam.pem file

Open houserockr opened this issue 1 year ago • 3 comments

Steps To Reproduce

  1. ./bitwarden.sh updateself
  2. ./bitwarden.sh update
  3. ./bitwarden.sh rebuild
  4. ./bitwarden.sh restart
  5. tail bwdata/logs/nginx/error.log yields: ./logs/nginx/error.log:2024/02/05 18:22:55 [emerg] 1#1: BIO_new_file("/etc/letsencrypt/live/foo.bar.com/dhparam.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/foo.bar.com/dhparam.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)

Expected Result

The nginx service of bitwarden starts.

Actual Result

The nginx service of bitwarden does not start and tries to restart itself due to the missing file dhparam.pem.

Screenshots or Videos

No response

Additional Context

The command ./bitwarden.sh rebuild will also generate the bwdata/nginx/default.conf which contains the following line(s):

# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
ssl_dhparam /etc/letsencrypt/live/foo.bar.com/dhparam.pem;

Trying to start bitwarden with ./bitwarden.sh (re)start yields the following $ tail bwdata/logs/nginx/error.log ./logs/nginx/error.log:2024/02/05 18:22:55 [emerg] 1#1: BIO_new_file("/etc/letsencrypt/live/foo.bar.com/dhparam.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/foo.bar.com/dhparam.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)

But that file doesn't exist anywhere in my letsencrypt archive. I found it in an old backup I made about one year ago. Maybe letsencrypt changed something?

Now I found you can generate that file with $ openssl dhparam -out dhparams.pem 4096

But I'd prefer not to need that at all.

Build Version

2024.1.2

Environment

Self-Hosted

Environment Details

  • Host OS Debian 12 x86_64
  • Docker 24.0.5
  • Compose 2.9.0
  • BW 2024.1.2

Issue Tracking Info

  • [X] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

houserockr avatar Feb 05 '24 18:02 houserockr

Additional note: If I copy the dhparam.pem from my backup to /etc/letsencrypt/live/foo.bar.com/, bitwarden/nginx works again.

houserockr avatar Feb 05 '24 18:02 houserockr

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

sammbw avatar Feb 07 '24 04:02 sammbw

I just had the same problem. After migrating the bwdata folder from my old host to my new host, I had an issue with a parsefail of the certbot renewal config. In order to solve that problem I redid the ./bitwarden.sh install process and copied the new letsencrypt dir in my old bwdata folder. After that, the dhparam.pem file was missing and I had to restore it from a backup, too.

LOENS2 avatar May 30 '24 11:05 LOENS2