How to use Cloudflare DNS for the Letsencrypt challenge with Bitwarden’s automatic setup

Bitwarden’s automatic setup script allows you to secure your server’s HTTPS connections using Letsencrypt via certbot but it does not provide control over the challenge type used to issue the certificate. If you wanted to use a DNS challenge and take advantage of the Cloudflare API for example, you’ll need to make some changes to the scripts.

As your docker user, follow the standard steps from the TL;DR guide, which I’ve linked to and copied here just for completion. I do not recommend copy and pasting commands like this without being sure of what you’re executing.

$ curl -Lso bitwarden.sh https://go.btwrdn.co/bw-sh && chmod +x bitwarden.sh
$ ./bitwarden.sh install

You can CTRL+C to stop the install once it begins prompting you for input. Edit the bitwarden.sh script and comment out the downloadRunFile calls (e.g., at the time of writing lines 109 and 118)

You can then download and apply this diff to ~/bwdata/scripts/run.sh

Once complete the standard install can be reinitiated

$ ./bitwarden.sh install

Leave a Reply

Your email address will not be published. Required fields are marked *