Support remote database access using external tools - #7222
Conversation
009f35b to
41f4a06
Compare
This comment was marked as outdated.
This comment was marked as outdated.
5ab47e5 to
b73e6e7
Compare
|
@droidmonkey I think this PR is ready for review. As mentioned in the discussion of the issue, I'm not a C++ developer, so feedback is very welcome 😃 |
|
Excellent, will review when I get the chance |
|
I'll add a note that |
While OpenSSH recommends to use modern protocols like I have changes for using |
|
AFAIK you can use a single command with sftp if you batch it through stdin. That's without any temporary files. I have high personal interest in this PR so I'll be testing this as well and providing feedback once I get around to. |
|
I took a quick look, it's promising but maybe it's not being utilized to its fullest potential with hardcoded commands. I'm thinking sync over SSH is an advanced user feature so what if this would be simplified to "Sync Command" and instead provide a generic mechanism to run a command that can be templated with the database path and possibly other options? We'd only check that the return code of the command is a success and if not possibly show the code and stdout+stderr for debugging. We could still provide presets for scp, sftp etc. for convenience. This allows the user to write script that takes the arguments from KeePassXC and does whatever with them. |
|
I've contributed to the #1775 bounty and am excited to test this PR! |
|
@hifi using templating and running arbitrary commands is a great idea. It is way more flexible. Running the sync command after unlocking as shown in your comment would definitely be a convenient feature. 👍 |
|
@droidmonkey @phoerious Any chance to get a review for this PR? It is nearly 10 months old now 😞 |
|
Yes, sorry for the delay. But first, could you please rebase it to the latest develop HEAD and fix the conflicts? |
b73e6e7 to
4787f99
Compare
|
Done 😃 |
6b811dc to
2eacd0f
Compare
|
PR is rebased and conflicts are resolved. The build works mostly. The only issue seems to be that |
|
I'll give this a review soon |
7172131 to
8b8edd5
Compare
|
That is our beta... |
|
Well, I was hoping for a build that contains everything stable + remote databases support in addition, so that other experimental things wouldn't potentially add bugs to it. :/ |
|
Then how about just waiting for the next stable build? |
|
This PR is almost 3 years old, the milestone is only 32% complete containing many other posts that are years old, the latest minor version increment was done 4 years ago, all signs indicating that this PR will not be released in a stable build anytime soon... |
|
2.7.9, the stable version, is 95-98% the same as a snapshot build off develop branch. Just use a snapshot and don't think too hard about it. Trust me you'll be OK. |
|
What's with the very worrying warning message then ? The threat of loosing passwords is a big deal. |
|
We are toning that down, its just to keep people from using non-final builds in production. |
|
I tried the beta version and implemented data synchronization for webdav using the curl command, which is easy to use. But the data synchronization is manual, is it possible to add a switch to automatically trigger remote synchronization for data changes, and to automatically pull remote files for updates every time the database is unlocked. |
But that's what I would be doing 😅 |
|
Any idea when will the sync be included in the stable release? |
|
This still needs a bit of trim work for UX, but you can use it now in our snapshot builds. They are rather stable, every change is well vetted. https://snapshot.keepassxc.org |
|
@droidmonkey The current solution using remote sync settings per database stored inside the database itself (I guess in the KDBX headers?) is an interesting idea, I successfully tried using it with WebDAV and 2 cURL commands. But how should it work using AutoOpen for other WebDAV DBs as supported by both (!) KeePass and KeePass2Android? Right now, I have a main KDBX file on a WebDAV server. In that main KDBX file, there's an AutoOpen folder, containing entries for other KDBX databases on other WebDAV servers. Something like this (plain easily handleable!) seems to be impossible with the current DB-internal remote sync solution of KeePassXC? :-( |
|
That is not supported and likely won't be. For awareness, keepass and keepass2android use the .NET framework which has support for web dav natively. Qt does not have this support and we are not interested in adding a third party library to add it. You could maybe achieve this in keepassxc by mounting the webdav folder in your OS and pointing your auto open to the mounted folder. |
Too bad, as there's a library available: https://github.com/PikachuHy/QtWebDAV
Not portable across KeePass and KeePass2Android :-( What about this idea: As you already store DB remote sync settings inside the KDBX, what about adding support for the exact same kind of settings per AutoOpen entry as well, using String Fields, just like KeePass + KeePass2Android do with IocUserName + IocPassword, while ignoring the AutoOpen HTTPS-URL, but just using it as a {TEMP_DATABASE}? To me, my master copy is the WebDAV remote anyway and not any local temporary/cached copy (as KeePassXC now seems to handle it). |
|
You can have as many auto open entries as you want and use IfDevice. https://keepassxc.org/docs/KeePassXC_UserGuide#_automatic_database_opening Extending this feature is likely not going to happen, it's niche to begin with and distraction from other important core features. |
|
@droidmonkey |
|
@droidmonkey |
|
I'm not missing your point. I'm telling you we aren't adding more features to this aspect of the program. |
|
Very sad to read this. Thanks anyway :-) |
Forgive my confusion, but does this mean it will be included in the 2.8.0 release? I suspect there's no specific ETA for that yet? |
|
Yes and no eta right now. |
|
Just tried out the remote sync feature from the most recent snapshot. This looks cool. Together with curl, I was able to successfully set up WebDav transfer. I am only confused about two things. I hope, I got everything right. I tried to locate a corresponding user guide version, but it seems, there is not yet relevant doc for this. |
|
Your local file is wherever your kdbx file is stored. Sync pulls down a temporary remote copy, performs a merge with the open copy, then saves the result locally. Remote sync is explicit because it's not meant to be "remote access". |
|
Thanks a lot for the clarification with the merging. This escaped me. Just tried it out: very nice. |
|
Thank you for the feedback, we should make these things clearer |
As discussed here: #1775 (comment)
This change provides the ability to sync a database with a remote database with the help of
scp. (Fixes #1775)The
RemoteSettingsDialogworks similar toDatabaseSettingsDialogand can be extended in the future to store previous settings and load them again.Although currently
scpis supported, the implementation is extensible to include further programs in the future to download and upload .kdbx files to sync with them.Feedback is very welcome as this would be my first contribution to KeePassXC
Testing strategy
Place a second database on a separate server that is accesible via
sshand havescpinstalled and in your PATH variable.The second database can include keys and/or groups that the current database does not.
The new "Remote Sync ..." feature is available in the UI next to "Merge From Database...".
Regarding unit tests: Help is very welcome as I am uncertain how to mock the QProcess. I expect the rest to work similarly to
TestGui::testMergeDatabaseType of change