Conversation
|
Thanks for your pull request. I think this is mostly implemented by #135, though, which also adds automatic lock support on Windows and OS X, not only Linux. |
|
Any further comments on this? |
|
After a lot of check , #135 seems to subscribe and react to a d-bus event (passive mode). My PR provide another dbus interface (active mode). Both are not mutually exclusive and can be merged together. So I can modify my PR to use #135 lock feature, but it's very hard to do it until #135 is merged or not. |
|
Postponing to 2.3 |
|
I recommend closing this PR and performing a smart cherry pick of the differing capability than what was introduced with #545 |
|
@droidmonkey note that #545 is a dbus client (that listens for |
|
I don't think these will be a problem, but if others are added (eg. for reasing an entry), there should be a preferences option to not allow it. |
|
Hmmmm. Could this pose a security risk? |
|
Clearly yes, but outside the scope of keepassxc because you must provide a password on cli to open a database. The risk is that the password of the database can be found on bash_history. This problem is the same than all other cli tools and can be secured by using an askpass program like ksshaskpass or just not using this feature. |
|
This can serve as base for another projects. Like PR #608 which has potential to replace KeePassHTTP with 'Native Messaging'. In second variant it's using proxy that sits between browser and KeePassXC. Communication is done via UDP packets, but I can imagine to replace UDP for DBUS (on Linux), which would be awesome. |
|
Looks like this PR is getting lost with time, so I just want to pile on and say I would LOVE to have integration with |
|
Is this PR getting some love any time soon? If not, I'll close it. |
|
I will look into it ;) |
|
I've rebased this, added a method for locking all DBs (fix #687) and wrote the documentation on the wiki: Using-DBus-with-KeePassXC Ready for review and merge |
src/gui/MainWindow.cpp
Outdated
| m_ui->setupUi(this); | ||
|
|
||
| #ifdef WITH_XC_DBUS | ||
| #if defined(Q_OS_UNIX) |
There was a problem hiding this comment.
This probably will trigger some problem on Q_OS_MACOS.
@weslly can you test this PR on a mac? Thanks
There was a problem hiding this comment.
@TheZ3ro Appending && !defined(Q_OS_MAC) on this line seems to solve the compilation issue, but that would mean the #undef macro you used earlier had no effect
There was a problem hiding this comment.
@TheZ3ro maybe adding this on src/CMakeLists.txt would be better:
if(APPLE OR MINGW)
set(WITH_XC_DBUS OFF)
endif()
There was a problem hiding this comment.
@weslly pushed a different fix. Now should always work
|
@weslly when you are free can you test this again? Thanks :) |
|
@TheZ3ro got this now: |
fe66a11 to
1af06af
Compare
|
This is now ready for review @keepassxreboot/core-developers |
CMakeLists.txt
Outdated
| set(WITH_XC_NETWORKING ON CACHE BOOL "Include networking code (e.g. for downlading website icons)." FORCE) | ||
| endif() | ||
|
|
||
| if((NOT UNIX) OR APPLE AND WITH_XC_DBUS) |
There was a problem hiding this comment.
Remove redundant parentheses, use them around the whole OR expression instead.
src/CMakeLists.txt
Outdated
| add_feature_info(SSHAgent WITH_XC_SSHAGENT "SSH agent integration compatible with KeeAgent") | ||
| add_feature_info(YubiKey WITH_XC_YUBIKEY "YubiKey HMAC-SHA1 challenge-response") | ||
|
|
||
| add_feature_info(DBus WITH_XC_DBUS "Take keepassxc control by DBus") |
There was a problem hiding this comment.
"Control KeePassXC via DBus"
But TBH, I don't think we need this flag. No matter what's selected here, DBus will always be compiled in on Linux, because we need it for detecting screen locking and for the stupid Unity menu bug workaround.
src/CMakeLists.txt
Outdated
| if(WITH_XC_DBUS) | ||
| set(keepassx_SOURCES | ||
| ${keepassx_SOURCES} | ||
| gui/MainWindowAdaptor.cpp |
There was a problem hiding this comment.
This can be written on a single line.
src/gui/MainWindow.cpp
Outdated
| new MainWindowAdaptor(this); | ||
| QDBusConnection dbus = QDBusConnection::sessionBus(); | ||
| dbus.registerObject("/keepassxc", this); | ||
| dbus.registerService("org.keepassxc.MainWindow"); |
There was a problem hiding this comment.
This should be org.keepassxc.KeePassXC.MainWindow.
There was a problem hiding this comment.
Seems redundant to me using the name 2 times
There was a problem hiding this comment.
That's how the standard works.
src/gui/MainWindow.h
Outdated
| Q_OBJECT | ||
|
|
||
| #if defined(WITH_XC_DBUS) && !defined(QT_NO_DBUS) | ||
| Q_CLASSINFO("D-Bus Interface", "org.keepassxc.MainWindow") |
src/gui/MainWindowAdaptor.cpp
Outdated
| MainWindowAdaptor::MainWindowAdaptor(QObject *parent) | ||
| : QDBusAbstractAdaptor(parent) | ||
| { | ||
| // constructor |
src/gui/MainWindowAdaptor.cpp
Outdated
|
|
||
| MainWindowAdaptor::~MainWindowAdaptor() | ||
| { | ||
| // destructor |
src/gui/MainWindowAdaptor.cpp
Outdated
|
|
||
| void MainWindowAdaptor::appExit() | ||
| { | ||
| // handle method call org.keepassxc.MainWindow.appExit |
There was a problem hiding this comment.
All these comments should be doc comments above the method signature.
There was a problem hiding this comment.
This file is auto-generated, the next time it will be generated it will have same comment as now
There was a problem hiding this comment.
I know, but it's so short, I don't even know if it's worth maintaining an XML file for it.
src/gui/MainWindowAdaptor.h
Outdated
| void openDatabase(const QString &fileName); | ||
| void openDatabase(const QString &fileName, const QString &pw); | ||
| void openDatabase(const QString &fileName, const QString &pw, const QString &keyFile); | ||
| Q_SIGNALS: // SIGNALS |
There was a problem hiding this comment.
Replace Q_SLOTS and Q_SIGNALS with keywords.
| @@ -0,0 +1,67 @@ | |||
| /* | |||
| * This file was generated by qdbusxml2cpp version 0.8 | |||
There was a problem hiding this comment.
File should have the usual header, maybe with additional notices.
There was a problem hiding this comment.
Sincerely, I would feel silly for adding a copyright notice to an autogenerated file
There was a problem hiding this comment.
Shouldn't this file be generated by the build system then (add_custom_target or some shit)?
There was a problem hiding this comment.
If we can execute external programs in cmake I would say yes.
qdbusxml2cpp comes in qtbase5-dev-tools package on debian, so it's another dependency to add on linux.
Probably this file won't be edited for a long time, we should leave this here and don't bother too much, we just need to remember that's autogenerated and the header will come in handy
7c0673d to
0edd9aa
Compare
| @@ -0,0 +1,23 @@ | |||
| <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | |||
| <node> | |||
| <interface name="org.keepassxc.MainWindow"> | |||
There was a problem hiding this comment.
This still needs to be changed to org.keepassxc.KeePassXC.MainWindow.
src/config-keepassx.h.cmake
Outdated
| #cmakedefine WITH_XC_HTTP | ||
| #cmakedefine WITH_XC_YUBIKEY | ||
| #cmakedefine WITH_XC_SSHAGENT | ||
| #cmakedefine WITH_XC_DBUS |
There was a problem hiding this comment.
Option does not exist anymore.
…when log in, close all databases when log out)
- Add support for KDBX 4.0, Argon2 and ChaCha20 [#148, #1179, #1230, #1494] - Add SSH Agent feature [#1098, #1450, #1463] - Add preview panel with details of the selected entry [#879, #1338] - Add more and configurable columns to entry table and allow copying of values by double click [#1305] - Add KeePassXC-Browser API as a replacement for KeePassHTTP [#608] - Deprecate KeePassHTTP [#1392] - Add support for Steam one-time passwords [#1206] - Add support for multiple Auto-Type sequences for a single entry [#1390] - Adjust YubiKey HMAC-SHA1 challenge-response key generation for KDBX 4.0 [#1060] - Replace qHttp with cURL for website icon downloads [#1460] - Remove lock file [#1231] - Add option to create backup file before saving [#1385] - Ask to save a generated password before closing the entry password generator [#1499] - Resolve placeholders recursively [#1078] - Add Auto-Type button to the toolbar [#1056] - Improve window focus handling for Auto-Type dialogs [#1204, #1490] - Auto-Type dialog and password generator can now be exited with ESC [#1252, #1412] - Add optional dark tray icon [#1154] - Add new "Unsafe saving" option to work around saving problems with file sync services [#1385] - Add IBus support to AppImage and additional image formats to Windows builds [#1534, #1537] - Add diceware password generator to CLI [#1406] - Add --key-file option to CLI [#816, #824] - Add DBus interface for opening and closing KeePassXC databases [#283] - Add KDBX compression options to database settings [#1419] - Discourage use of old fixed-length key files in favor of arbitrary files [#1326, #1327] - Correct reference resolution in entry fields [#1486] - Fix window state and recent databases not being remembered on exit [#1453] - Correct history item generation when configuring TOTP for an entry [#1446] - Correct multiple TOTP bugs [#1414] - Automatic saving after every change is now a default [#279] - Allow creation of new entries during search [#1398] - Correct menu issues on macOS [#1335] - Allow compilation on OpenBSD [#1328] - Improve entry attachments view [#1139, #1298] - Fix auto lock for Gnome and Xfce [#910, #1249] - Don't remember key files in file dialogs when the setting is disabled [#1188] - Improve database merging and conflict resolution [#807, #1165] - Fix macOS pasteboard issues [#1202] - Improve startup times on some platforms [#1205] - Hide the notes field by default [#1124] - Toggle main window by clicking tray icon with the middle mouse button [#992] - Fix custom icons not copied over when databases are merged [#1008] - Allow use of DEL key to delete entries [#914] - Correct intermittent crash due to stale history items [#1527] - Sanitize newline characters in title, username and URL fields [#1502] - Reopen previously opened databases in correct order [#774] - Use system's zxcvbn library if available [#701] - Implement various i18n improvements [#690, #875, #1436]


Description
keepassxc can be basically controlled with others applications: open/close databases or exit.
Motivation and Context
React to desktop event automatically:
How Has This Been Tested?
Tested on Debug and RelWithDebInfo build type
qdbus org.keepassxc.MainWindow /keepassxc org.keepassxc.MainWindow.openDatabase mydb mypasswd mykeyfile
qdbus org.keepassxc.MainWindow /keepassxc org.keepassxc.MainWindow.closeAllDatabases
qdbus org.keepassxc.MainWindow /keepassxc org.keepassxc.MainWindow.appExit
Types of changes
Checklist: