mozilla-services / syncstorage-rs

Sync Storage server in Rust
Mozilla Public License 2.0
984 stars 49 forks source link

iOS sync #1469

Open carlmfischer opened 1 year ago

carlmfischer commented 1 year ago

Having trouble getting iOS Firefox to sync with syncstorage-rs I have syncstorage-rs running in a Debian 11 environment with 2 desktops syncing successfully. When I connect the iOS device, it appears to sync but does not display any bookmarks or history.

I have checked the Logs from the device (Debug: copy log files to app container) and see some things like

    INFO [telemetry] TelemetryWrapper - Upload Error - Error Domain=NSURLErrorDomain Code=-1000 "bad URL"
    NSErrorFailingURLStringKey=https://incoming.telemetry.mozilla.org/submit/telemetry/

and

    WARNING [sync] Profile - [RUST][fxa_client::internal::error] Authentication error: Error(No cached token for scope profile)`

and

WARNING [storage] RustLogins - Unknown or other error when syncing Logins database - The operation couldn’t be completed. (MozillaAppServices.LoginsApiError error 4.)

and

    WARNING [sync] Profile - [RUST][sync15::client::sync_multiple] sync failed: Network error: [no-sentry] Validation error: URL does not use TLS protocol., final status=NetworkError
    WARNING [sync] Profile - [RUST][error_support::handling] Error synchronizing: Network error: [no-sentry] Validation error: URL does not use TLS protocol.
    WARNING [storage] RustLogins - Unknown or other error when syncing Logins database - The operation couldn’t be completed. (MozillaAppServices.LoginsApiError error 4.)

Logs from the Rust instance see

    INFO {"token_type":"OAuth","uid":"","ua.browser.family":"Other","uri.path":"/1.0/sync/1.5","ua":"UNKNOWN","uri.method":"GET","ua.os.ver":"UNKNOWN","ua.browser.ver":"UNKNOWN","ua.os.family":"Other","first_seen_at":"1682534219965","metrics_uid":"","ua.name":"UNKNOWN"}
    INFO {"uri.path":"/1.5/4/info/collections","ua.name":"UNKNOWN","ua.browser.ver":"UNKNOWN","ua.browser.family":"Other","ua":"UNKNOWN","uri.method":"GET","ua.os.family":"Other","ua.os.ver":"UNKNOWN"}
    INFO {"uri.method":"GET","ua.browser.family":"Other","ua.os.ver":"UNKNOWN","ua.browser.ver":"UNKNOWN","ua.os.family":"Other","ua":"UNKNOWN","ua.name":"UNKNOWN","uri.path":"/1.5/4/storage/clients?full=1&newer=0.00"}

the uri.path is what I thought was the issue, as the I see both "uri.path":"/1.0/sync/1.5" and "uri.path":"/1.5/4/xxx"

but I'm not sure if that is the correct rabbit hole

On the device I have accounts.firefox.com set as the Custom FxA Content Server and I have http://192.168.xxx.xxx:8000 set as the Custom Token Server (I have tried to use 192.168.xxx.xxx:8000/1.0/sync/1.5 and 192.168.xxx.xxx:8000/token/1.0/sync/1.5)

I'm not sure if I am missing a server setting, or if there is something wonky with the iOS device setup

I have the old syncserver running and it is syncing amongst desktops and ios devices, but I want to upgrade from python 2.7 which lead me to this new solution, and I understand that it is still in development.

Any guidance would be appreciated.

┆Issue is synchronized with this Jira Task

eddieirvine commented 1 year ago

I have exactly the same issue! Desktops are syncing, but Firefox on iOS not…

eddieirvine commented 1 year ago

I had a look at the logs and saw this error: 2023-11-09 07:17:46.274 WARNING [sync] Profile - [RUST][sync15::client::sync_multiple] sync failed: Network error: [no-sentry] Validation error: URL does not use TLS protocol., final status=NetworkError 2023-11-09 07:17:46.285 INFO [sync] Profile - [RUST][sync_manager::manager] Sync finished with status NetworkError

URL is https://fxsync.example.com/1.0/sync/1.5 with a valid LetsEncrypt certificate. Internal URL linked via reverse proxy is http://192.168.2.211:8000/

I also tried the internal one inside my network, but I received the same error.

eddieirvine commented 1 year ago

Just created a totally new user and activated the sync again on my iPhone. I receive the same error ("URL does not use TLS protocol"), but strangely it created a new entry with uid 5 in the users table in DB tokenserver_rs.

carlmfischer commented 9 months ago

To circle back on this, I ended up reverse proxying (apache) two instances to get this working...one for mobile iOS and one for desktops

iOS

<VirtualHost *:8443>
ProxyPass / http://192.168.x.xx:8000/
ProxyPassReverse / http://192.168.x.xx:8000/

Dekstop

<VirtualHost *:8445>
ProxyPass /msync http://192.168.x.xx:8000/1.0/sync/1.5
ProxyPassReverse /msync http://192.168.x.xx:8000/1.0/sync/1.5

the iOS settings custom sync token server is https://my.hostname:8443/

And on desktop it is https://my.hostname:8445/msync

Not sure about the entry in the nodes table on tokenserver_rs database, gonna play around with it For now I just have the https://my.hostname:8443, not sure if https://my.hostname:8445 is needed

Seems to be working for now