Security: Add mTLS client certificate support#116
Conversation
|
Thank you for the PR, looks small enough to merge. However: Did you see @michaelstingl 's proposal here: https://github.com/orgs/opencloud-eu/discussions/819#discussioncomment-13102292 |
|
hello! Yes, I saw that discussion but as opencloud-eu/opencloud#819 (reply in thread) pointed out, this is a different use case compared to the IdP mTLS 😃 |
9318e08 to
daf05bc
Compare
|
hello :) is there any more feedback about this PR? Thanks |
|
@paolostivanin I will have a look for 1.3.0 :) |
thanks a lot, much appreciated 😄 |
|
Built and sideloaded on my Samsung Galaxy S22 on Android 16; using CF Zero Trust and tunnel --> caddy --> Opencloud with Authentik OIDC. I'll post any issues I have. |
|
@paolostivanin Thank you, what are the changes from before? |
Just a rebase against latest master, I saw that there was a merge conflict. |
|
Did a self-review pass and pushed an amended commit ( Bug fix
Architecture cleanups
UX
Misc
Verified locally with Functionality is unchanged from what I described in the PR body; still tested on my own setup (Cloudflare mTLS → NPM → homelab). |
|
Thanks for updating. Linking iOS UI (functionality not existing yet for the cert part) -> opencloud-eu/ios#59 (comment) |
Allow users to present a client certificate for mutual TLS authentication (e.g. Cloudflare mTLS). Uses Android KeyChain API so users pick from certificates already installed on device.
Previously the client certificate for mutual TLS was a single global setting applied to every account and host. Make it per-account instead: - Store the certificate alias in the account's AccountManager userData (auto-removed with the account) - Resolve and present it per OpenCloudClient when the account is bound, re-resolved on each request so a change is picked up immediately - Choose the certificate at login time via the Android KeyChain picker so servers gated behind mTLS can be reached for the initial server-check/login, before the account exists - Manage (set / change / remove) the certificate per account from the Manage Accounts dialog - Evict idle connections on change so the new certificate takes effect Removes the now-redundant global mTLS toggle from Settings > Security.
|
hello! small update: I reworked the mTLS part so that the client certificate is now per-account instead of a single global setting. the old version applied the same cert to every account/host, which didn't really make much sense if you have multiple accounts on different servers. so now each account gets its own cert:
I also dropped the old global mTLS toggle from Settings > Security since it's not needed anymore. tested again on my own setup (Cloudflare mTLS -> NPM -> homelab) and everything works for me. as usual I'm NOT an Android dev, so please review carefully in case I did something silly. |
|
Thank you! My only request would be to make the certificate setting a less promiment option (could be confusing users making them think it's mandatory or so) in the wizard, e.g. maybe hide it behind a "Connection..." label/button like in iOS. And that button would bring up the small menu like you have for Manage Accounts with just a single entry "Set client certificate". ^ And if you use the "certificate (MTLS)" there it should also be called "certificate (MTLS)" in the Manage Accounts. Compare to wizard in iOS "Connection...": |

Allow users to present a client certificate for mutual TLS authentication (e.g. Cloudflare mTLS). Uses Android KeyChain API so users pick from certificates already installed on device.
Tested on my device (OnePlus 13R) with Android 16. My setup is: Cloudflare (with mTLS) -> NPM -> homelab
I've installed the
opencloudApp/build/outputs/apk/qa/debug/OpenCloud_1.2.1-qa-debug.apkon my device and with this is version and the certificate selected I can browse my data, with upstream's version sync and browsing fail (as expected).I've been using this debug apk for a few days now and I have not faced any issues.
Please note that I am NOT an Android developer, so please review the changes carefully for any mistake I might have made 😃