Let's Encrypt DNS-01 certification

Is there an easy way to get Bitwarden certified with certbot-dns-cloudflare?
I’m asking because my server is behind a nginx and can’t get certbot working. But DNS-01 works fine. As far as I could evaluate, one has to stop Bitwarden, install docker-compose and set up certbot-dns-cloudflare as container with /bwdata/letsencrypt:/etc/letsencrypt and following the official Bitwarden docs.
It’s not so easy :confused:

for everyone who want to know: It’s not that hard. All you need is a Cloudflare DDNS and an API key from Cloudflare and maybe some information from Certificate Options | Bitwarden

Used commands:

apt update && apt install -y certbot python3-certbot-dns-cloudflare

mkdir -p /etc/cloudflare
chmod 700 /etc/cloudflare
touch /etc/cloudflare/credentials.ini
chmod 600 /etc/cloudflare/credentials.ini
nano /etc/cloudflare/credentials.ini

dns_cloudflare_api_token = 0123456789abcdefghijkl

certbot certonly --register-unsafely-without-email --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare/credentialsini -d <example.com> --dns-cloudflare-propagation-seconds 60

crontab -e

0 1 * * * /usr/bin/certbot renew & > /dev/null 2>&1s 
05 1 * * * /usr/bin/cp -a /etc/letsencrypt/live/* /opt/bitwarden/bwdata/letsencrypt/live/ && openssl dhparam -out /opt/bitwarden/bwdata/letsencrypt/live/<example.com>/dhparam.pem 2048

crontab -u bitwarden -e

10 1 * * *  cd /opt/bitwarden && ./bitwarden.sh rebuild && ./bitwarden.sh start && exit 

Not an elegant way but its working. Maybe someone can build a more elegant tool out of it or Bitwarden itself is adding Cloudflare-DDNS as a function inside the settings :slight_smile:
Feel free to modify the cron times for your needs or modify the whole script.