dietpi-letsencrypt with qbittorrent for ongoing https access

I have a dynamic domain name set up. dietpi-letsencrypt generated the SSL certificates just fine so HTTPS was working well

I copied and pasted the certs into qbittorrent’s Web UI and that worked well.

Now it appears the certificates renewed and continue to work well on the dynamic domain itself, but not on port 1340- port 1340 shows the certificate has expired. My letsencrypt folder has 2 certificates, one which I presume was the renewed version.

How do I renew the certificate for port 1340 automatically so I don’t need to copy and paste this every few months?

There is /etc/letsencrypt/live which contains symlinks to the current active certificate + key files. In the other directories I think its the ones with the highest integer, otherwise the last modification date should tell you which ones were created last :wink:. Inside /etc/letsencrypt there is as well a renewal-hook directory where you can place scripts inside that are executed on certificate renewal and can be used to copy the new files from /etc/letsencrypt/live to your qBittorrent location.

Very helpful!

I followed the instructions here:

Switched into the cloned directory, installed, then edited “/etc/letsencrypt/renewal-hooks/deploy/update-qbittorrent-cert.js” to match the path to the folder named after my domain in “/etc/letsencrypt/live”. Changed the destination to
const qbtConfigPath = ‘/home/qbittorrent/.config/qBittorrent/qBittorrent.conf’;

Think that worked!


Another approach would be to setup a reverse proxy. As I understood you are already running a http web server, correct? Than it should be quite simple to add qbittorrent and to configure web server that way, that qbittorrent will be reachable via standard ports 80/443. This way you could remove qbittorrent ports from port-forwarding on your router. As well, no need to copy or link files because SSL termination will be done at the reverse proxy side. There is a config example available at qBittorrent Wiki for Nginx web server.