Skip to content
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]: Synchronize fails from linux PC (host) to Android mobile (connect) #96

Open
2 tasks done
promitheas17j opened this issue Apr 9, 2024 · 3 comments
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@promitheas17j
Copy link

Bug description

From my Linux PC as the Host when I try to synchronise with my mobile, as soon as I scan the QR code and click the link or manually type in the IP and port, I get the message that

This site can't be reached
127.0.0.1 refused to connect

The port shown below the QR code on the PC is 37417 (allowed in my ufw for both IN and OUT), but when I look at the error log on the mobile device I see it is trying to connect to 127.0.0.1:46660 (each time it is different)

When I do it the other way around, by making the mobile device the host and connect to it by typing the IP and port on the PC, it works to synchronise.

I realise I am probably missing something or doing something wrong, but I don't know what it could be.

Here are a couple issues I looked at: #95 #72

Also, please clarify for me whether synchronisation works both ways or if it actually matters if the device is the host and has the new passwords, or vice versa.

Expected outcome

Synchronise passwords which are in PC to mobile device.

Steps to reproduce

  1. Before scanning the qr code I did allow both IN and OUT to the port it generates for me but still nothing.
  2. Both devices are on the same network, and show the same time (same timezone).

Error log

Here are the logs from the mobile device:

Connecting... 
Local exception has occurred: Failed to connect.
SocketException: Connection refused (OS Error: Connection refused, errno = 111), address = 127.0.0.1, port = 46660
#0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721)
#1      _NativeSocket.connect (dart:io-patch/socket_patch.dart:984)
#2      _RawSocket.connect (dart:io-patch/socket_patch.dart:1902)
#3      RawSocket.connect (dart:io-patch/socket_patch.dart:21)
#4      Socket._connect (dart:io-patch/socket_patch.dart:2128)
#5      Socket.connect (dart:io/socket.dart:789)
#6      Synchronization.connect (package:passy/passy_data/synchronization.dart:1659)
<asynchronous suspension>

App version

v1.8.0 - Entry Tags

Submission checklist

  • I have specified the problem in the issue title
  • I have provided a verbose description of the problem
@promitheas17j promitheas17j added the bug Something isn't working label Apr 9, 2024
@GleammerRay
Copy link
Collaborator

Hello @promitheas17j !

Your Passy host binds to 127.0.0.1, which is a local loop back address, unreachable from any other device. Are you sure that you're letting Passy through your firewall.

please clarify for me whether synchronisation works both ways

Synchronization can work either way, for as long as one device is hosting and another one is connecting while on the same network.

if it actually matters if the device is the host and has the new passwords

Both host and client need to have the same passwords, this is a part of the synchronization security measures. The only case where this is not required is for entry sharing.

I did allow both IN and OUT to the port it generates

You have allowed the ports but the address is still loopback and is unreachable. Passy expects relaxed network rules when in the app, if you're interested in being able to allow specific address and port combination in and out of your network, considering using Passy dedicated server (See Settings -> Synchronization servers).

@promitheas17j
Copy link
Author

Are you sure that you're letting Passy through your firewall.

I am using ufw and I allowed the ports through. I'm unsure how to allow passy in general.

Synchronization can work either way, for as long as one device is hosting and another one is connecting while on the same network.

What I meant is if I have these passwords saved on each device:

Mobile: A B C D
PC: A B C E

and I sync with either device as the host, will the result be that all passwords will be synced to each device as such:

Mobile: A B C D E
PC: A B C E D

That's what I mean by both ways.

considering using Passy dedicated server (See Settings -> Synchronization servers).

This seems like a good idea for me, but I'm unsure if I have selected the right IP and port. For the IP I used the one after running ip a and which in the following line:

inet xxx.xxx.xxx.xxx/23 brd xxx.xxx.xxx.255 scope global dynamic noprefixroute wlp2s0f0u1

For port I put the one it generated 5592, and allowed it incoming and outgoing in my firewall. Based on the dynamic nature of the IP, that would mean when it changes my sync server will not work anymore, correct?

I don't have access to the router so that I can make any changes if it is required, so perhaps it might be better to simply figure out how to allow everything from passy to pass through my firewall with a rule.

Thanks for your quick replies, and sorry about all my questions. I'm not that great with these topics :)

@GleammerRay
Copy link
Collaborator

GleammerRay commented Apr 10, 2024

will the result be that all passwords will >be synced to each device as such:

Mobile: A B C D E
PC: A B C E D

Yup, that's the point. You can even make simultaneous changes to different entries on both devices and have them synchronize. The only limitation for now is the inability to change fields of the same entry on different devices at the same time, that would result in an overwrite.

Based on the dynamic nature of the IP, that would mean when it changes my sync server will not work anymore, correct?

You will probably want to change your local IP settings to static. If you're talking about public IP then there's really not much you can do about it as it's all specific to your ISP; in case you want your server to be accessible via the Internet I'd recommend that you use an online web server or a port forwarding service such as ngrok to ensure that your address doesn't change.

I don't have access to the router

You shouldn't need any access to the router to configure local synchronization. As for online synchronization I would recommend using ngrok or any other port forwarding service because getting your ISP to get you a static address can be pretty tricky.

In case of local network synchronization you should be able to configure your local IP as static. You can do this pretty easily via GUI on most modern Linux distros, first find and copy your local IP by typing ip address or ifconfig in your terminal, then open your system network settings and switch your connection's IPv4 setting into "Manual" mode, enter 8.8.8.8 and 4.4.4.4 (or any other DNS addresses) into your DNS fields, paste the IP you copied earlier into the IP field (in some managers you will have to click "Add" or "Create" to create a new address) and save the configuration. That'll ensure that your computer always has the same IP address when connecting to your network.

Unlike the Passy app, Passy dedicated server will not seek for available IP addresses and will always bind to the address you specified. You can always verify the connection by clicking the Test connection button in Server setup or in Connect to server. You can test it locally on your host device to make sure that it's up and running and then you can use the same button on your client device to check if it is reachable.

Thanks for your quick replies, and sorry about all my questions. I'm not that great with these topics :)

No problem! Don't worry about it, I hope that you manage to figure out a way to set up your server and I wish you best luck. Feel free to ask any more questions, don't be ashamed of your confusion.

I am planning to provide a paid server solution for Passy in the future to make it easy for people to get their own synchronization servers up and running but for now it's possible to set up your own server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants