austinried / subtracks

A music streaming app for Subsonic-compatible servers
GNU General Public License v3.0
703 stars 30 forks source link

bug: IPv6 addressing doesn't work #147

Open ghost opened 1 year ago

ghost commented 1 year ago

Describe the bug The application doesn't seem to support IPv6 addresses in the format: https://[fe80::1ff:fe23:4567:890a]/navidrome (address taken from the Wikipedia IPv6 article only to demonstrate the format)

I tried logging it as the admin user/as a non-admin user - nothing. Tried a simpler password - no dice.

Nginx access log shows no requests made from the device.

To Reproduce Should be clear from above.

Expected behavior Same behavior as with IPv4/DNS.

Smartphone (please complete the following information):

austinried commented 1 year ago

Has your self-signed certificate also been signed by a CA that is trusted by your phone? In that case it should work without issue, but if not then that would be an issue. I would be curious to know if your issue persists with the v2 alpha though, if you want to try it you can get that here: https://github.com/austinried/subtracks/releases/tag/v2.0.0-alpha.1

ghost commented 1 year ago

Hey @austinried thanks for the reply. I tried again with v2.0.0-alpha.2 and it didn't work. I can confirm that I have a trusted self-signed CA installed on my Android phone and that the server is signed by that CA (and a standard lock icon is shown by Chrome without any warnings, hence the cert is trusted by the phone).

The bummer is that no error messages appear inside the app. And sadly there were also no new logs in nginx access logs.

PS. In case someone's interested, this is what I used for generating my certs: https://gist.github.com/stacksmash76/d8076a49da4ca17e460f1c9c5c1f8b7c

austinried commented 1 year ago

Gotcha, thanks for the update. I think with the alpha it might have to do with the way I'm trying to parse that into a URL, so I'll have to look into that. More/more specific error messaging is something I'm also going to get in before the beta to hopefully improve that experience as well.

austinried commented 1 year ago

How about alpha 3? There should be an error message of some kind this time, and you can share your logs at the bottom in settings for more info.

https://github.com/austinried/subtracks/releases/tag/v2.0.0-alpha.3

ghost commented 1 year ago

How about alpha 3? There should be an error message of some kind this time, and you can share your logs at the bottom in settings for more info.

Yep, indeed, there's an error now.

HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: self signed certificate(handshake.cc:393))

Confirmed again in Chrome, certificate is shown as valid and "verified" by Chrome. Going to "Encryption & credentials -> Trusted credentials" I see my CA cert under "User", which, again, seems fine.

Maybe there's some flag which isn't enabled correctly for the underlying Android implementation to handle self-signed certs (even though they're signed by a self-signed CA)?

austinried commented 1 year ago

Maybe there's some flag which isn't enabled correctly for the underlying Android implementation to handle self-signed certs (even though they're signed by a self-signed CA)?

Yep, looks like I forgot a bit of network security config that would allow this. By default the app was only trusting the system CA store, and not the user CA store, so I've added that into the config.

If you want to try the build from this PR I think it should get you past that error at least: https://github.com/austinried/subtracks/actions/runs/5008207271?pr=180

ghost commented 1 year ago

If you want to try the build from this PR I think it should get you past that error at least: https://github.com/austinried/subtracks/actions/runs/5008207271?pr=180

Unfortunately, same error message. Cleared app cache, uninstalled and then installed the apk artifact.

2023-05-19T23:20:02.297363 INFO GET https://[my-ipv6-address]/navidrome/rest/ping.view?v=1.13.0&c=subtracks&u=REDACTED&s=REDACTED&t=REDACTED
2023-05-19T23:20:02.675349 SEVERE Saving source
HandshakeException: Handshake error in client (OS Error: 
    CERTIFICATE_VERIFY_FAILED: self signed certificate(handshake.cc:393))
#0      _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:99)
#1      _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:142)
#2      _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:915)
#3      _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:1044)
<asynchronous suspension>
2023-05-19T23:20:39.590059 INFO GET https://[my-ipv6-address]/navidrome/rest/ping.view?v=1.13.0&c=subtracks&u=REDACTED&p=REDACTED
2023-05-19T23:20:39.905167 SEVERE Saving source
HandshakeException: Handshake error in client (OS Error: 
    CERTIFICATE_VERIFY_FAILED: self signed certificate(handshake.cc:393))
#0      _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:99)
#1      _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:142)
#2      _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:915)
#3      _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:1044)
<asynchronous suspension>