-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Self Signed TLS certificate is no longer trusted for AnkiDroid after new update (works well with 2.16.5) #14686
Comments
Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing |
Interesting.
Indeed the Play Console is adamant that this is a terrible idea and reminds me of same every time we publish a release: I suspect something else may be going on here, but I don't know exactly what |
The backend uses https://github.com/rustls/rustls-native-certs. It doesn't currently support self-signed certs on the mobile platforms. This will hopefully change in the future when https://github.com/rustls/rustls-platform-verifier matures. In the mean time, you should use something like let's encrypt or a VPN instead. |
It makes me wonder why it suddenly stopped working (previous version of AnkiDroid worked fine) |
Just to confirm I tested the released versions:
So this seems like a alpha release issue |
The alpha releases just switched to "the new backend" as the default, 2.16.x releases only use the new backend as an experimental option. So I guess you were on 2.16 without the new backend option in advanced settings, but now in 2.17 you get the new backend no matter what And the new backend uses the Rust code for synchronization, which goes into the problem @dae mentioned (which I wasn't aware of myself!) That's why it changed all of the sudden An app in a newer version may suffer regressions, that is inevitable, even if not desired. Additionally, any app that has been around for 10 years may decide to no longer support features that are not used by enough people - which AnkiDroid frequently does. The users this affects are of course not happy but you must understand we have approximately 2 million users. The number that use self-signed certificates is probably about 100. The other 1,999,900 (using my made up numbers that are nevertheless still likely close) are benefiting from getting up to date Anki Desktop features like v3 scheduler + FSRS now and they really appreciate it. Feature development, and feature retirement math is unfortunately pitiless when there are tradeoffs to be made. That said, I hope Rust starts accepting self-signed certs soon. It seems like a basic feature for a TLS library, to me. |
So I'm going to re-close this, it is not actionable here unfortunately. That said, this issue is the one to follow + vote on I think: rustls/rustls-native-certs#3 - once rustls-platform-verifier is "ready for primetime" (according to the rustls-native-certs maintainers) it will hopefully be included in the rustls-native-certs crate, at which point the anki backend can ingest it, and we'll get support again here in the new backend |
Hey @mikehardy The rustls-platform verifier has been released, but in the independent crate |
Hi, Certificates in Android are a very annoying issue. In principle, a certificate pinning is the best solution. (In my opinion.) It does not make sense to trust all Android certificates if you want to connect to the original Anki service. If a custom server is used, it makes sense to present the certificate to the user. I think DavDroid is a good example. To not trust certificates installed by the user is one of the most annoying habits of Android applications. Sorry, Anki is not a project about certificate handling. Nevertheless, it would be nice to have the user in mind how try to avoid the big service providers. A question, can you estimate any timeframe when user-installed certificates are working again? |
I can also confirm AnkiDroid 2.17.5 no longer allows me to use my server with self signed certificates |
Hello, I'd also like to add my view on this matter as a user. I humbly suggest what @acht suggested: Allow the user to select a custom certificate file when using a custom sync server. This way, even those who wish to use ankiweb sync servers, can define ankiweb's url as their custom sync server with their own trusted certificate authority. Thank you for all your hard work and making AnkiDroid better |
For anyone compiling from source, you can pin a root CA in Anki-Android-Backend/anki/rslib/src/backend/mod.rs by changing from this:
to this:
Probably ugly because I'm a newbie to Rust, and also just tedious in general to compile everything. I did try adding rustls-platform-verifier and that was a lot of work. I think I got so far as to have the library inject itself into the Android Context, but I ran into annoying dependency conflicts so I just gave up. |
So, rustls-platform-verifier can actually work with the project. At least after a bunch of adjustments, most of which from this PR. Only part that didn't quite work was the revocation checking. Otherwise it uses the phone's CA store perfectly fine. EDIT: I think the above is as good as it gets for now. Still haven't spent enough time learning about the Ankidroid architecture to release a good solution. But hopefully I can help again, maybe around my finals, that is if this issue is still open. |
For anyone who doesn't have time to wait for the upstream repo to fix this, you can use the version here: https://github.com/voczi/Anki-Android/releases/tag/latest |
It's a shame that you can't integrate it into the regular version of Android. |
Added a new PR to the backend code (ankitects/anki#3203). Should be able to get this working after it is merged. |
devs can test #16481 until it is merged and an alpha/stable version is released. |
Checked for duplicates?
What are the steps to reproduce this bug?
Expected behaviour
rootCA.pem
is installed under "User's certificates".Actual behaviour
Debug info
(Optional) Anything else you want to share?
No response
Research
The text was updated successfully, but these errors were encountered: