Truenas scale qbittorrent set up https

Since I had a Hard time setting up https for qbittorrent on TruenasScale here is a tutorial. I don’t really know where to put it.

I was using the TrueCharts version for Qbittorrent. When I correctly enabled Https however it broke everything and I couldn’t connect to it anymore. I had to edit the qbittorrent.conf to disable it again.

Using this answer for firefox:

And this: Linux WebUI setting up HTTPS with self signed SSL certificates · qbittorrent/qBittorrent Wiki · GitHub
Go to your /config/qbittorrent/sslfolder (if not there create it).

openssl req -x509 -nodes \
  -newkey RSA:2048       \
  -keyout root-ca.key    \
  -days 365              \
  -out root-ca.crt       \
  -subj '/C=US/ST=Denial/L=Earth/O=Atest/CN=root_CA_for_firefox'

Replace everything after subj to your liking, but copy it you will need it later once more.

openssl req -nodes   \
  -newkey rsa:2048   \
  -keyout server.key \
  -out server.csr    \
  -subj '/C=US/ST=Denial/L=Earth/O=Dis/CN=anything_but_whitespace'

now create a extfile.txt and fill it with this:

subjectAltName = IP:<your ip adress>
authorityKeyIdentifier = keyid,issuer
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage=serverAuth

You also can use a domain instead:

subjectAltName = DNS:<your domain name supporting wildcard>
openssl x509 -req    \
  -CA root-ca.crt    \
  -CAkey root-ca.key \
  -in server.csr     \
  -out server.crt    \
  -days 365          \
  -CAcreateserial    \
  -extfile extfile.txt

Now edit your App in truenas and go to Network.
Then add your ethernet adapter and enter a static ip. (of course a different from your truenas server one)
For some reason I needed to do this, or it won’t work. Probably because of the https config for my truenas server.

Now enter the crt and key in your webui settings.

/config/qBittorrent/ssl/server.crt
/config/qBittorrent/ssl/server.key

Finally add the root-ca.crt to your firefox in your about:preferences#privacy in the Certificates and then in Authority import it.

I hope this helps someone.
I finally can now use magnet links in firefox to open directly qbittorrent.

I think the TrueCharts folks expect that you’d handle HTTPS by setting up Traefik and Ingress, rather than with the individual applications.