Support TLS 1.3
I spent the last three hours trying to figure out, why I cannot login to my Nextcloud server with my Android phone's app, but with any webbrwoser. It turned out that the reason for this was that I enforced TLSv1.3 on my web server.
Changing my Nginx config from
# Common TLS configuration for HTTPS servers
# 2019-07-04: Richard Neumann <mail at richard dash neumann period de>
listen 443 ssl http2;
listen [::]:443 ssl http2;
# Common DH parameters <https://security.stackexchange.com/questions/70831/does-dh-parameter-file-need-to-be-unique-per-private-key>
ssl_dhparam dhparam.pem;
# Session config
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;
# Set protocols and ciphers
ssl_protocols TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ecdh_curve brainpoolP384r1:secp384r1;
# Enable HSTS <http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security>
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
# Enable OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
# Disable framing
add_header X-Frame-Options DENY;
to
# Common TLS configuration for HTTPS servers
# 2019-07-04: Richard Neumann <mail at richard dash neumann period de>
listen 443 ssl http2;
listen [::]:443 ssl http2;
# Common DH parameters <https://security.stackexchange.com/questions/70831/does-dh-parameter-file-need-to-be-unique-per-private-key>
ssl_dhparam dhparam.pem;
# Session config
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;
# Set protocols and ciphers
ssl_protocols TLSv1.3 TLSv1.2;
ssl_prefer_server_ciphers off;
ssl_ecdh_curve brainpoolP384r1:secp384r1;
# Enable HSTS <http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security>
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
# Enable OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
# Disable framing
add_header X-Frame-Options DENY;
Solved the issue (Added TLSv1.2).
Describe the solution you'd like
Support TLSv1.3 on the Android app.
Describe alternatives you've considered
Allow downgrade to TLSv1.2. Acceptable for now, but no for long.
Additional context
Error on screen was: Operation finished with HTTP status code -1 (fail)
I was having the same issue just now. However, I would classify this as a regression (a bug), since in the previous version TLSv1.3 only worked just fine?
@tobiasKaminsky are you aware of any TLS changes in 3.16.0?
I can confirm the issue in my TLS 1.3-only setup
Some collected observations:
- None of the login methods work when only TLS 1.3 is enabled on the server (tested password+U2F, QR-code, app password)
- The error message toast in the app is showing "Operation finished with HTTP status code -1 (fail)"
- The device is added to the "Devices & sessions" list
- The problem goes away after enabling TLS 1.2 in the web server hosting Nextcloud
~~The server logs this line:~~
{"reqId":"xyz","level":2,"time":"2021-05-08T22:34:06+00:00","remoteAddr":"w.x.y.z","user":"--","app":"no app in context","method":"POST","url":"/login","message":"Login failed: user-xyz (Remote IP: w.x.y.z)","userAgent":"xyz (Android)","version":"20.0.9.1"}
Sorry, may bad. The "Login failed"-message was unrelated. The Nextcloud server does not log anything on failed login from 3.16.0
I have had this TLS 1.3-only setup for about a year and everything has worked fine up until now. I only removed my account because the app stopped syncing earlier this week (which might or might not have appeared since I updated the app).
I can also confirm the workaround with my haproxy-based setup. Logging in with the app starts working again after I turn on TLS 1.2:
Replacing this line:
ssl-default-bind-options force-tlsv13
With this line:
ssl-default-bind-options no-sslv3 no-tlsv10 no-tlsv11
I also confirm the problem appeared with 3.16.0:
- 1 device upgraded to 3.16.0: error "Operation finished with HTTP status code -1 (fail)". Clean the storage, remove the app, reboot then reinstall the app: same error, connection impossible
- 1 device with 3.15.1: connection ok, upload works. Then upgraded to 3.16.0: error "Operation finished with HTTP status code -1 (fail)"
- 1 device still with 3.15.0: connection ok, upload works (no upgrade, I keep it for the moment)
Server TLS 1.3 only
I was having the same issue just now. However, I would classify this as a regression (a bug), since in the previous version TLSv1.3 only worked just fine?
Agree. Definitively a regression as it worked with 3.15.1, not an enhancement
@conqp Thanks for filing this issue and sharing your workaround, it saved me and potentially many others a lot of frustration. :heart: Could you maybe relabel this issue as a regression or bug? It could be a lot easier to get attention to this.
Ah, sorry for jumping onto you like that, @conqp I just assumed one could change labels on issues oneself has created.
In the mean time, however, we got help with that! Thank you very much for labelling up our issue properly @AndyScherzinger :partying_face: :heart:.
@oolongbrothers My mistake. I think it was a language barrier issue on my part and you maybe didn't even refer to me, but the repo owner. I also didn't realize that @AndyScherzinger already added the tag. Sorry for that. No hard feelings.
Absolutely no worries, @conqp As said, we owe you our gratitude for filing this bug and providing us with a workaround!
* None of the login methods work when only TLS 1.3 is enabled on the server (tested password+U2F, QR-code, app password)
This seems then to be a server related problem, as during login the app simply uses a webView (by Android) and shows the auth content of server.
Can you create us a test account and send the credentials to tobias at nextcloud dot com with a reference to this issue?
@tobiasKaminsky You've got mail.
Thanks, I'll try it soon 👍
What really surprises me is that it works with 3.15 as i do not recall any change to this…
We use okhttp3 4.x is now, instead of 3.x. Maybe it is related to this…
Fix is in: https://github.com/nextcloud/android-library/pull/618
Thank you so much for the superquick fix!
@tobiasKaminsky If you no longer require the test account on my server, I will delete it over the weekend. If you, against expectation, still need it, just give me a quick notice.
TLS 1.3 only don't working anymore with version 3.16.1
I see the problem when I see errors with use "Contacts Backup" feature.
Don't working with apache option:
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 -TLSv1.2
Working again with apache option:
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1