nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.16k stars 1.75k forks source link

Update the server URL on server address change #4157

Open maranov opened 5 years ago

maranov commented 5 years ago

Is your feature request related to a problem? Please describe.

Hi, I've changed the address of my NC server and set up a redirect to the new address. I was unable to change the URL in the app and had to re-add the account instead.

Describe the solution you'd like

Since changing the URL from the app might be considered a security issue (#3877), I'd like to propose the app changing the URL automatically, when receiving "301 Moved Permanently" response from the server.

Describe alternatives you've considered

Changing the URL manually via settings, but that is not available either.

Additional context

It seems that the Desktop client has this functionality and has updated the URL on its own after my changes.

mixxit commented 5 years ago

This is also an issue for me, i was able to happily update the URL defined in the nextcloud.cfg file in appdata on windows but android i could not find wher ethe cfg file is

AlexNi245 commented 5 years ago

Hey i would work on this issue. I would extend the dotmenu within manage account with an option to edit the server credentials.

AndyScherzinger commented 5 years ago

@AlexNi245 thanks for offering to pick this one up. We do need some feedback from @tobiasKaminsky first though since:

so the only part that is likely up for discussion:

which would require a completely different approach and is also unclear to me if this should be implemented.

tobiasKaminsky commented 5 years ago
  • changing the server adress is considered a security issue, see #3877

We indeed should not do this. In my opinion/experience this is a very rare case and then it is ok to have a new account (for an example on google you also cannot change your id without creating a new account and removing the other).

  • app changing the URL automatically, when receiving "301 Moved Permanently" response from the server

I am not entirely sure, but if we get 301, we do follow this. While it is not ideal to then have two calls, nowadays that should not matter too much.

realies commented 5 years ago

Why are you so inconsistent in the manual configuration for desktop and mobile clients? Are desktop clients more secure than mobile clients and why? Changing a server address on a desktop client is not an issue via the nextcloud cfg file, although its alternative in a mobile app is not to be found. Reconfiguring (removing/re-adding) a server on a mobile app would remove the queued auto-upload list, which would require manual sync for every auto-upload folder, and their addition and configuration every time the server address changes. In my case the server address change is temporary, accomplishing this via the desktop client is trivial, I would like it to be similar on mobile.

redtux commented 4 years ago

I just would like to confirm that many users like myself would have loved such a feature (as it still exits in the OC client btw.), given sometimes even big providers like Hetzner need to change their server names — affecting hundreds if not thousands of users. https://wiki.hetzner.de/index.php/Storage_Share/en#Renaming

Hetzner recommends creating a new profile, but then the average would have to download everything again, right?

(Which might be even worse if you have lot of files in different folders that you do not want to sync, meaning that you had to click on every single file you want to be synced to your phone. This could take ages…)

redtux commented 4 years ago

Okay, I have now read #3877 again, and from this statement it seems that this will not be fixed. https://github.com/nextcloud/android/issues/3877#issuecomment-495194482 So the files stay on the smartphone and the app will know which one to sync and which one not?

fafische commented 4 years ago

Unfortunatly the app does not even follow the the moved permanently. Android app tells in in notifications: Hochladen fehlgeschlagen, Moved Permanently. In app: "Server nicht verfügbar". Recreating the account means for me:

In my case old url will be available as long as I want., But: I moved from folder to subdomain and RewriteBase in .htaccess file of nextcloud has to point to either / or /nextcloud. Because of that I can not have both Urls working at the same time.

maxim-kukushkin commented 4 years ago

@fafische Very similar issue here! Because of changes on ISP's side I've recently had to jump between IPv6 and IPv4 addresses and then to a DNS name. And every time it's not only just transfer of lots of data, but also all kinds of metadata updates related to it

I hope this issue can be prioritized

redtux commented 4 years ago

From what I understand, this is a "feature" and will not be fixed (which means others decide for us what is good or right). The only solution I could find so far is to create a new profile, to stop syncing, and then to move all the synced files locally. Worked for me at least…

GAS85 commented 4 years ago

Please, this is very needed feature. If I move now nextcloud from host subfolder to e.g. cloud.domain.com, then all users needs to resetup they Mobile clients.

Desktop respects Redirects and did not cause any error by test, but for Android it does not fully work.

Client will fetch files List by following redirect, but will not be able to create/change/upload new files, will not be able to fetch activity etc. It's always goes to the old URL and simply stops when redirected.

mm0zct commented 4 years ago

I'd like to vote for this as well, I have my nextcloud running at home, and was using my ISP provided domain for my house (username.ispname.net), but I have just moved hosue to a location where my previous ISP is no longer available.

I have set up my nextcloud at the new house under a proper domain name, and currently have a raspberypi sitting at my old flat with an SSH forwarding rule to tunnel any traffic to the old URL to my new house. This let's the cloud work (slowly) until I terminate my ISP ocntract and sell the old flat.

We have two accounts on mobile phones which use the nextcloud as an automatic photo backup, and I would like to migrate both phones (since the desktop clients you can edit the config file) without the phones getting confused over the 10s of GBs of photos (one phone also has a 30GB holiday photo folder synced from the nextcloud, I don't want to resync this in either direction!)

I can set a 301 permenantly moved on the pi instead of the ssh tunnel, but from what I read here the Android client doesn't respect this and move anyway. I will have to give up the old domain in a few weeks.

From a security perspective, can't you have the option to "migrate URL" and have the client check the identify of the nextcloud server as a security step? If you're paranoid about someone pointing it to their own cloud, this should address the problem.

You used the example of migrating google accounts, but this is more like if microsoft moves the mail server from mail.hotmail.com to mail.live.com (made up examples), but with the same accounts, you dont' want to have to re-sync your whole mailbox.

tobiasKaminsky commented 4 years ago

You used the example of migrating google accounts, but this is more like if microsoft moves the mail server from mail.hotmail.com to mail.live.com (made up examples), but with the same accounts, you dont' want to have to re-sync your whole mailbox.

Good example, but then all users would have to re-setup all their mail clients, which is the same you would have to do on Android Files. Solution is to have a redirect.

With some proper check, as you mentioned, this indeed might work and be transparent to user. Currently I fear that we do not have time to work on such feature, but contributions are welcome :+1:

benjaminbertram commented 3 years ago

@tobiasKaminsky : You proposed, that the use case to switch the url where the the nextcloud server is to be reached, was an edge case. So let me add our (family home server raspi nextcloud) scenario as one more data point that this missing feature is really annoying. I started with one raspi at one fixed IP, just reachable in our local network. Some phone was setup with the local IP, some with the pure unix host name ("raspberrypi"), and now I try to do the next step and make the server reachable from the wide wide web using a dynamic DNS entry.

Sorry that I've not thought about all the implications in the first place and just started to use nextcloud because I thought that it was flexible and customizable. Turns out it isn't, at least this issue (and the bug that links here) is a complete deal breaker for me. And now I have to make some good points to my family members why we don't just move all our stuff to dropbox or google drive. Have you ever considered what security issue that is.

At the other hand I read the complete discussion and there was just no argument at all, that that clearly explains why modifying the url of an existing account is a security issue. Just anologies that just don't work in my head, so I'd like to give you another:

Backup is going to some server at dont.givea.where via ssh. And now for one out of a gazillion reasons it is reachable on another URL. And in analogy to this app my rsync would prompt me with an error: sorry, but you have sworn an oath to always use dont.givea.where as home base, so to move somewhere else you have to disguise your old identity, start over fresh at the new url (and don't think about making an incremental backup there it could all fall back on you later).

@AlexNi245 have you considered forking the app? If so, please let me know.

zroug commented 3 years ago

For me this feature certainly isn't a deal breaker. I'm very happy with both, Nextcloud and the Android app. But this feature would make changing the server URL much easier. Especially when you have users, who are not that good at configuring such things.

That being said, I had a very pleasant experience with Thunderbird and its calendar feature. I recently changed my server URL and at the old URL I created a 301 Moved Permanently redirect to the new URL. At first Thunderbird kept using the old URL but it followed the redirect, so everything was still working. After some time I restarted Thunderbird and then it told me that a redirect is happening, showed me both, the old and the new URL, and asked me if I want to update the configuration to use the new URL. All I had to do was click on yes. I think that is a very good example of how it could work.

tobiasKaminsky commented 3 years ago

The UX @zroug mentioned seems to be a nice middle way:

RubinXnibu commented 3 years ago

I am another user wanting to update the server URL. I have just created a nextcloud server inside a NAT. with port forwarding. When I connect to my nextcloud locally, it's with a 192.168.* address. When I connect remotely, it's with a fqdn URL. What I really want is to have multiple URL's for the same server in the app and have the app intelligently try both. However, I'm willing to re-enter the URL once or twice a day when I'm at home or remote. How else is the home user supposed to use a home nextcloud?

BTW, since you are OK with people editing the URL in the desktop app, you should accept editing it on the phone apps. Phones are much more secure than desktops: With physical access, a bad actor can edit the locked desktop's nextcloud cfg file by mounting the hard drive on another computer. Physical access to a phone still doesn't let them edit anything until the phone is unlocked. The phone apps need less protection against bad actors than the desktops, not more.

add1989 commented 3 years ago

+1

My girlfriend and I got married and she changed her domain from FirstName-OldLastName.co.uk to FirstName-NewLastName.co.uk - but not being able to change this in the app is a real PITA :(

RubinXnibu commented 3 years ago

As a workaround, why not delete the app and re-install it and configure it for the new domain name?

On Sun, Mar 14, 2021 at 4:36 PM add1989 @.***> wrote:

+1

My girlfriend and I got married and she changed her domain from FirstName-OldLastName.co.uk to FirstName-NewLastName.co.uk - but not being able to change this in the app is a real PITA :(

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/4157#issuecomment-799002150, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQW4R5HGQ2SVYEB6X6NSIDTDVCAPANCNFSM4HYRRETA .

redtux commented 3 years ago

@RubinXnibu Unfortunately, in cases where you have synced lot of data this is no workaround. 😕

stefan2904 commented 3 years ago

I don't think proposing a config change in case of an 301 solves the issue.

I have a Nextcloud instance with is reachable using multiple Domains (blame Hetzner), so there is no old and new one. This works without problems, apart from the fact that OnlyOffice only works on one of those domains (which sometimes changes; blame my setup).

Since there is no option in the Nextcloud mobile app to change the URL of the server, the only way is to delete the old account and add the same account with the new URL. Since this involves moving the synced files and re-configuring of the auto-uploads every time, this is annoying. :/

(As noted before, this is not a problem with other apps that use my nextcloud shares, for example my password manager. 😅)

stefan2904 commented 3 years ago

Given your security concerns, could it be an option that the server also authenticates with the app, so that the app could detect if it is talking to the same server or a new (potentially malicious) server?

GAS85 commented 3 years ago

that the app could detect if it is talking to the same server

I hope this could be done via HTTP Public Key Pinning (HPKP) by add hash of server 1 key and hash of server 2 key in both server configurations.

redtux commented 3 years ago

@GAS85 "Public Key Pinning mechanism was deprecated in favor of Certificate Transparency and Expect-CT header." https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning

NoelzeN commented 3 years ago

I have changed the Port where Nextcloud is running at. Previously I had it running on Port 8080 and now migrated it to Port 443. I noticed after a few days that my Instant Upload was not working anymore. I had a 301 Redirect on Port 8080. Now I removed the redirect and simply run Nextcloud on both ports. That seems to work fine, however it would be nice to add the possibility to change the Server URL in the Nextcloud app so at some point in time I can close port 8080.

realies commented 2 years ago

I've needed this feature on more than a dozen occasions, including right now.

gomme600 commented 2 years ago

+1

GAS85 commented 2 years ago

From a security perspective, can't you have the option to "migrate URL" and have the client check the identify of the nextcloud server as a security step? If you're paranoid about someone pointing it to their own cloud, this should address the problem

Want to mention, if Security is only reason that hold this feature, then it is already failed - if I control DNS (e.g with pi-hole) and redirect user to a "bad" Server, then I can see already now user login name and password by Files List operation, but other functionality simply does not work and seems as clear bug for me:

Client will fetch files List by following redirect, but will not be able to create/change/upload new files, will not be able to fetch activity etc. It's always goes to the old URL and simply stops when redirected.

danieldietsch commented 2 years ago

I am with most of the people here:

waydwnsouth commented 2 years ago

tl;dr: Implement a server fingerprint, allow the server URL to be changed as long as the fingerprint remains the same.

I just ran into this issue and it's definitely going to be a headache. Not everyone is hosting Nextcloud on a public domain. IP addresses change, Dynamic DNS providers come and go, and the idea that a malicious actor with physical access to your phone could change the domain in the settings, but somehow not just recreate the account like we're being told to do, is a stretch.

There are ways to ensure the authenticity of a remote server, but DNS certainly isn't one of them. From a security standpoint the DNS response should be considered untrusted anyway, and the authenticity of the server should be verified via HTTPS or some type of server fingerprint instead. What threat vector this is trying to protect against?

Problems with current "solution" (New account setup):

Problems with proposed solution (301 Redirect):

That being said, I do believe a (properly verified) 301 would be the appropriate way to go for a production system at scale with lots of users if possible. It's just not necessarily feasible for every deployment or in every situation.

Possible solutions: (I vote for option 2)

  1. Leave device security up to the user & allow them to change the domain/IP
    • Developers have made it pretty clear they're not supportive of this option
  2. Implement a server fingerprint that can be verified by the client app (similar to SSH, Signal protocol, etc.)
    • If the user changes the server URL, still enforce the original server fingerprint
    • If the fingerprint ever changes, warn the user of possible MitM/redirect
    • Optionally, force the user to do the manual account re-creating on server fingerprint change
  3. Pin the HTTPS certificate on initial server connection
    • If the certificate ever changes, alert the end user and/or force account re-creation
    • This is less ideal than the fingerprint, since certificates expire and would likely change with the domain
  4. Provide an option in the Nextcloud server settings to enable/disable the user's ability to change the server information in the app
    • Those running this at home and small-scale deployments can assume the risk that comes with this feature
    • Large-scale production deployments could disable this feature for their users, either globally or on a per-user/group basis
evrifaessa commented 2 years ago

Hey. Anything new about this? This is a very unpleasant experience even with 1 device. Can't really imagine having these issues with tens of devices at the same time. :/

spaceChRiS commented 2 years ago

I had to do the change as well recently, and it is a cumbersome task to get everything ready again, in particular with 20+ upload folders. Therefore I wondered if there is a solution that would satisfy all requirements. The proposal: When the URL is changed, have a permanent red warning sign for the next 14 days in the app that tells about the change and that you cannot get rid off, in combination with a permanently open, sticky, android notification.

About the 14 days: If somebody else has control over the phone for 14 days or more, I think a changed nextcloud URL is the least problem the owner of the phone has, With this time one could e.g. easily remove the old account in the app and add a new fake account, including copying all the files.

Does this make sense?

kikislater commented 2 years ago

+1 it's a very common issue. I changed my subdomain from dev. to cloud. for example (And It allows to test services before making them in production mode)

samoylenkodmitry commented 1 year ago

This must be enabled in the Android client. The security solution must be an actually working one, like the described above.

gomme600 commented 1 year ago

My domain just expired. Having this problem yet again... Still no solution a year later...

tomchiverton commented 1 year ago

The Linux client allows this by editing a simple text file ($HOME/.config/Nextcloud/nextcloud.cfg). Why is it so hard for Android to manage this, at least as an handy fallback ? It even the requests the user to re-auth...

GlassedSilver commented 1 year ago

I can't believe this is STILL not possible... o.O

realies commented 1 year ago

I can't believe this is STILL not possible... o.O

It feels like the Nextcloud team needs a better product development vision. Maybe resources are limited, and priority is taken by things that make money more directly. Too bad there's nothing better in that software category out there... yet.

Pheromon commented 1 year ago

Also, it's open source: just do a pull request with the code needed to implement the feature that for you is important, or pay someone to do it.

realies commented 1 year ago

Also, it's open source: just do a pull request with the code needed to implement the feature that for you is important, or pay someone to do it.

The NC team does not want it, because in their eyes being able to configure your app is a security risk.

rpersee commented 1 year ago

Any news about this issue? Basically, if you change your FQDN, you have to re-upload all your content?

Pepeanuts commented 1 year ago

On Windows, this solution is working : https://cocoalopez.com/blog/?p=2859

User\AppData\Roaming\Nextcloud\nextcloud.cfg on Windows

Close nextcloud client Search the file “nextcloud.cfg” Look for the line: 0\url= ” ” Replace the URL between the commas with the new server address Save File Restart Nextcloud

cemno commented 8 months ago

So i guess i will be the next person mentioning almost 5 years later that its would still be a really good and helpful feature for some people...

TacoCake commented 7 months ago

I'm also having this problem, I'm stuck maintaining 2 dns because I don't want to re-setup my auto upload.

IanMichaelHarper commented 7 months ago

I would also like this feature. I recently moved and now my nextcloud has a new IP

djex commented 7 months ago

I am also looking for this feature to be implemented. Recently switched from a public facing server to a local only server and need to change the server address in my Android app.

TByte007 commented 7 months ago

One more from me.

robertauer commented 4 months ago

I would like to be able to change the Nextcloud server URL in the Android app, too. I recently changed the URL of my server and was able to change the config of my Nextcloud Ubuntu client, but couldn't find a way to do this inside the Android app.

letrain02 commented 3 months ago

It has been several years and several requests with varying issue numbers. Honestly I don't mind signing in and out again if there was a way to back up my settings. Having to setup instant upload folders again, and then uploading all over again doesn't seem like the right thing to do when it's just a server address change. Wonder if just being able to confirm a device via nextcould server would be better. Store settings there, and when signing in offer to restore or even require a confirmation on the server for which "device" is being restored. I've tried tracking down options and so far can't find any viable solution when server address changes.