Repository navigation
Security
The web server serves the Web UI and the Web API. Anyone who gets in can run commands, read your config, and edit your config files. Treat it like an admin panel.
- The web server is off by default. Turn it on with
--web-serverorQBT_WEB_SERVER=true. The desktop app turns it on for you. - It binds to
127.0.0.1(this computer only), or to0.0.0.0in Docker. Change it with--hostorQBT_HOST. - A login is always required while the web server is on. There is no exception for this computer or your local network.
- Scripts use an API key (
X-Api-Keyheader) or HTTP Basic on/api. Neither opens the Web UI, and an API key cannot change security settings. - Only
GET /api/healthis public, and it returns just{"status": ...}./api/versionand/api/get_base_urlneed a login.
Set the mode in the Web UI under Security, or under authentication: in qbm_settings.yml in your config folder.
| Mode | What it does |
|---|---|
local (default) |
Login form with a username and password. Only an Argon2 hash is stored. A signed cookie keeps you logged in for 7 days. |
oidc |
Single-user OpenID Connect login (for example Authentik). The local password is off unless allow_local_login: true. |
api_only |
No browser login. API key or Basic only. |
- Set
QBT_WEB_USERNAMEandQBT_WEB_PASSWORDbefore the first start. They create the login only when none exists. - With neither set, qbit_manage generates a password and writes it to
qbm_initial_password.txtin the config folder (readable by you only). The log shows the file path, never the password. The file is deleted when you change the password. On Unraid or another host where you cannot open that file over SMB, read it withdocker exec <container> cat /config/qbm_initial_password.txt, or setQBT_WEB_USERNAMEandQBT_WEB_PASSWORDinstead. - The password needs 8 or more characters and 3 of: uppercase letters, lowercase letters, numbers, and special characters (
!@#$%^&*). Example:Wh1te-Rabbit!.
qbit_manage always asks for its own login; a proxy cannot log people in for it. Put the proxy in front for TLS and set public_url to the address people type, scheme and host only (for example https://qbm.example.com, with no path), so OpenID Connect redirects use it, and set https_only: true. QBT_PUBLIC_URL sets public_url at startup, for a proxy that changes the host name and blocks the first login.
Failed logins are rate limited: 10 failures per client address per minute, counting the login page, HTTP Basic, and API keys. A limited address is refused before the password is checked. By default the client address is the connecting address, which is the proxy's, so all of its clients share one limit. To limit each client on its own, list the proxy in trusted_proxies (IP addresses or CIDR networks), or set QBT_TRUSTED_PROXIES=172.18.0.0/16,10.0.0.1 (applied at startup). qbit_manage then reads the client from X-Forwarded-For, but only when the connection comes from a listed proxy. List only proxies you run: a listed address can claim any client address.
- In Authentik, create an OAuth2/OpenID provider and application.
- Open the Security tab in qBit Manage and select OpenID Connect:
- Set Public URL (or click Use current URL) and copy the Redirect URI shown (e.g.
https://qbm.example.com/auth/oidc/callback, including any--base-urlprefix) into Authentik's Redirect URIs. - Enter the Issuer / Discovery URL (either Authentik's Issuer URL or full OpenID Configuration URL) and click Test URL to verify reachability.
- Enter Client ID and Client secret.
- Click Sign in with OIDC to link account. After signing in through Authentik, qBit Manage verifies and links your account automatically without signing you out or requiring manual
sublookups.
- Set Public URL (or click Use current URL) and copy the Redirect URI shown (e.g.
- Click Save Settings. Keep Break-glass: also allow the local password enabled until you confirm OIDC sign-in works.
- In Authentik, create an OAuth2/OpenID provider and application. Set the redirect URI to
https://qbm.example.com/auth/oidc/callback(add your base URL if you use one). - In
qbm_settings.yml, setoidc_claim_first_login: trueso the next successful OIDC sign-in binds your account automatically and turnsoidc_claim_first_loginback off (only enableoidc_claim_first_loginwith a provider where you restrict which users can authenticate):
authentication:
mode: oidc
public_url: https://qbm.example.com
oidc_metadata_url: https://auth.example.com/application/o/qbit-manage/.well-known/openid-configuration
oidc_client_id: <client id>
oidc_client_secret: <client secret>
oidc_claim_first_login: true- The web server is off by default. Turn it on with
--web-serverorQBT_WEB_SERVER=true. - A login is always required.
bypass_auth_for_localis gone. -
QBT_HOST(and--host) is the address the web server binds to, not the qBittorrent address. A 4.xQBT_HOSTholding a URL,host:port, or another machine was ignored before and now stops the web server from binding. Remove it, and set the qBittorrent address inqbt.host. - 4.x
method: api_onlybecomesmode: local. Your API key keeps working, and a first-run password is written toqbm_initial_password.txtfor the browser login. To keep a key-only setup, setmode: api_onlyyourself after the upgrade. -
externalmode is gone. A 4.x or 5.0-developexternalsetting becomeslocal: your API key and username are kept, and a first-run password is written toqbm_initial_password.txtif there is no password.allowed_hostsis ignored. - A 4.x
trusted_proxiesentry that is not an IP address or CIDR network is dropped with a warning; the other entries are kept (see Behind a reverse proxy). - 4.x
enabled: falsewith a stored password now requires that password. Forgot it? SetQBT_WEB_USERNAME,QBT_WEB_PASSWORD, andQBT_WEB_PASSWORD_RESET=true, then restart (see Recovery). -
/docs,/redoc, and/openapi.jsonare gone. - Unauthenticated
/apiscripts get 401. SendX-Api-Keyor HTTP Basic. - Anonymous
/api/versionmonitors now get 401./api/healthstays public and returns only the status. - pip and source installs bind to
127.0.0.1. Pass--host(orQBT_HOST) for LAN access, and keep the login on. - Every security change (password, username, mode, API key, OpenID Connect, proxy, or cookie settings) needs the current password. Without a usable local password, it needs an OpenID Connect sign-in from the last 5 minutes. A change signs out every browser. Logging out ends only the browser you used.
-
https_onlytakes effect after a restart.
Before 5.0.0 the web server was on for installs outside a container, including headless and seedbox installs, and it needed no login. Follow the steps for your install.
Docker, Unraid, and other containers
- Keep
QBT_WEB_SERVER=trueif you use the Web UI. - Add
QBT_WEB_USERNAMEandQBT_WEB_PASSWORD, or read the generated password fromqbm_initial_password.txtin/config. - If you used
bypass_auth_for_local, it is gone: every request needs a login now. The log warns once. - Publish the port on the host loopback or a private network, for example
"127.0.0.1:8181:8181". - Scripts: send
X-Api-Key, or keep HTTP Basic.
Python, source, or standalone binary (desktop, headless, or seedbox)
- Start with
--web-serveror setQBT_WEB_SERVER=trueonly if you use the Web UI or API. Without it, the log shows a warning and the web server stays off. - The default bind is
127.0.0.1. Reach it from another machine through an SSH tunnel, or set--hostorQBT_HOST. - Set
QBT_WEB_USERNAMEandQBT_WEB_PASSWORDbefore the first start, or readqbm_initial_password.txtin the config folder.
Desktop app
The app turns the web server on and binds to 127.0.0.1. On first launch with no configured login, the desktop window prompts you directly to create your administrator username and password and signs you in immediately (config lives in %APPDATA%\qbit-manage on Windows, ~/Library/Application Support/qbit-manage on macOS, and ~/.config/qbit-manage on Linux). If the desktop binary is launched standalone without the desktop shell, it generates qbm_initial_password.txt in that folder instead.
If your web server was reachable by others before 5.0.0
- Upgrade and stop the web server.
- Change the qBittorrent password.
- Rotate every secret in your config: Notifiarr and Apprise keys, and webhook URLs.
- Start qbit_manage and set a new login and API key.
- Check the qBittorrent and qbit_manage logs for activity you do not recognize.
Forgot the password? Set QBT_WEB_USERNAME, QBT_WEB_PASSWORD, and QBT_WEB_PASSWORD_RESET=true, then restart.
Docker:
- Add the three variables to the compose file and run
docker compose up -d. - Log in, then remove
QBT_WEB_PASSWORD_RESETand rundocker compose up -dagain.
The reset also ends every existing session.
Locked out of OpenID Connect (provider down or misconfigured)? Use the same three variables. In oidc mode the reset also turns on the local break-glass login (allow_local_login: true), so the login page shows the password form. Log in, fix the OIDC settings, and turn the break-glass option off again under Security.
If QBT_WEB_USERNAME and QBT_WEB_PASSWORD are set while a login exists and QBT_WEB_PASSWORD_RESET is not, they are ignored and the log says so. The reset applies once: while the stored login already uses that password, a restart leaves it alone and logs that the variable can be removed.
- Browser writes need a JSON content type and must come from this site:
Sec-Fetch-Site: same-origin, or, from browsers that do not send it, anOriginmatching the host orpublic_url. API key requests are exempt. - The session cookie is
HttpOnlyandSameSite=Lax. Sethttps_only: truewhen you serve over HTTPS. - The cookie signing key lives in
.qbm_session_key(readable by you only), outside the config files and their backups. - The Web UI shows
<redacted>for passwords, keys, tokens, and webhook URLs. Saving a redacted value keeps the stored one, unless the host or URL beside it changed. - The framework docs pages (
/docs,/redoc,/openapi.json) are off.
See SECURITY.md for the threat model and how to report a vulnerability privately.