2017-11-26 16:36:46 -05:00
Build and Install KeePassXC
2016-10-26 08:19:28 -04:00
=================
2017-11-26 16:36:46 -05:00
This document will guide you through the steps to build and install KeePassXC from source.
2019-11-23 10:39:03 -05:00
For more information, see also the [_Building KeePassXC_ ](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC ) page on the wiki.
2016-10-26 08:19:28 -04:00
2020-07-06 18:26:54 -04:00
The [QuickStart Guide ](https://keepassxc.org/docs/KeePassXC_GettingStarted.html ) gets you started using KeePassXC on your Windows, macOS, or Linux computer using pre-compiled binaries from the [downloads page ](https://keepassxc.org/download ).
2016-10-26 08:19:28 -04:00
Build Dependencies
==================
The following tools must exist within your PATH:
* make
2021-09-06 22:26:00 -04:00
* cmake (>= 3.3.0)
* g++ (>= 4.7) or clang++ (>= 6.0)
* asciidoctor
2016-10-26 08:19:28 -04:00
The following libraries are required:
2021-09-06 22:26:00 -04:00
* Qt 5 (>= 5.9.5): qtbase5, qtbase5-private, libqt5svg5, qttools5, qt5-image-formats-plugins
* botan (>= 2.12)
2016-10-26 08:19:28 -04:00
* zlib
2021-09-06 22:26:00 -04:00
* minizip
* readline (for completion in cli)
* libqt5x11extras5, libxi, and libxtst (for auto-type on X11)
2019-04-25 10:37:13 -04:00
* qrencode
Implement support for Yubikeys and potential other tokens via wireless NFC using smartcard readers (Rebase) (#6895)
* Support NFC readers for hardware tokens using PC/SC
This requires a new library dependency: PCSC.
The PCSC library provides methods to access smartcards. On Linux, the third-party pcsc-lite package is used. On Windows, the native Windows API (Winscard.dll) is used. On Mac OSX, the native OSX API (framework-PCSC) is used.
* Split hardware key access into multiple classes to handle different methods of communicating with the keys.
* Since the Yubikey can now be a wireless token as well, the verb "plug in" was replaced with a more
generic "interface with". This shall indicate that the user has to present their token to the reader, or plug it in via USB.
* Add PC/SC interface for YubiKey challenge-response
This new interface uses the PC/SC protocol and API
instead of the USB protocol via ykpers. Many YubiKeys expose their functionality as a CCID device, which can be interfaced with using PC/SC. This is especially useful for NFC-only or NFC-capable Yubikeys, when they are used together with a PC/SC compliant NFC reader device.
Although many (not all) Yubikeys expose their CCID functionality over their own USB connection as well, the HMAC-SHA1 functionality is often locked in this mode, as it requires eg. a touch on the gold button. When accessing the CCID functionality wirelessly via NFC (like this code can do using a reader), then the user interaction is to present the key to the reader.
This implementation has been tested on Linux using pcsc-lite, Windows using the native Winscard.dll library, and Mac OSX using the native PCSC-framework library.
* Remove PC/SC ATR whitelist, instead scan for AIDs
Before, a whitelist of ATR codes (answer to reset, hardware-specific)
was used to scan for compatible (Yubi)Keys.
Now, every connected smartcard is scanned for AIDs (applet identifier),
which are known to implement the HMAC-SHA1 protocol.
This enables the support of currently unknown or unreleased hardware.
Co-authored-by: Jonathan White <support@dmapps.us>
2021-10-01 10:39:07 -04:00
* libusb-1.0, pcsclite (optional to support YubiKey on Linux)
2016-10-26 08:19:28 -04:00
Prepare the Building Environment
================================
2017-11-26 16:36:46 -05:00
* [Building Environment on Linux ](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Linux )
* [Building Environment on Windows ](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Windows )
2019-10-30 05:37:17 -04:00
* [Building Environment on MacOS ](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-macOS )
2016-10-26 08:19:28 -04:00
Build Steps
===========
2018-08-21 12:19:15 -04:00
We recommend using the release tool to perform builds, please read up-to-date instructions [on our wiki ](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC#building-using-the-release-tool ).
2016-10-26 08:19:28 -04:00
To compile from source, open a **Terminal (on Linux/MacOS)** or a **MSYS2-MinGW shell (on Windows)** < br />
2021-09-06 22:26:00 -04:00
**Note:** on Windows you can also use MSVC to build natively, we recommend Visual Studio 2019
2016-10-26 08:19:28 -04:00
2017-12-12 03:15:23 -05:00
First, download the KeePassXC [source tarball ](https://keepassxc.org/download#source )
2017-11-26 16:36:46 -05:00
or check out the latest version from our [Git repository ](https://github.com/keepassxreboot/keepassxc ).
To clone the project from Git, `cd` to a suitable location and run
```bash
git clone https://github.com/keepassxreboot/keepassxc.git
```
This will clone the entire contents of the repository and check out the current `develop` branch.
To update the project from within the project's folder, you can run the following command:
```bash
git pull
```
2018-03-17 20:10:00 -04:00
For a stable build, it is recommended to checkout the master branch.
```bash
git checkout master
```
2021-09-06 22:26:00 -04:00
NOTE: See the [Windows Build Instructions ](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC#windows ) for building with MSVC.
2017-11-26 16:36:46 -05:00
Navigate to the directory where you have downloaded KeePassXC and type these commands:
2016-10-26 08:19:28 -04:00
```
2011-12-29 17:24:01 -05:00
mkdir build
cd build
2018-03-17 20:10:00 -04:00
cmake -DWITH_XC_ALL=ON ..
2016-10-26 08:19:28 -04:00
make
```
2018-03-17 20:10:00 -04:00
2021-09-06 22:26:00 -04:00
NOTE: If you are using MSYS2, you may have to add ```-G "MSYS Makefiles"``` to the beginning of the cmake command.
2018-08-21 12:19:15 -04:00
2017-12-12 03:15:23 -05:00
These steps place the compiled KeePassXC binary inside the `./build/src/` directory.
2017-11-26 16:36:46 -05:00
(Note the cmake notes/options below.)
2016-10-26 08:19:28 -04:00
2017-12-12 03:15:23 -05:00
**Cmake Notes:**
2011-12-29 17:24:01 -05:00
2017-11-26 16:36:46 -05:00
* Common cmake parameters
2016-10-26 08:19:28 -04:00
2017-11-26 16:36:46 -05:00
```
-DCMAKE_INSTALL_PREFIX=/usr/local
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=< RelWithDebInfo / Debug / Release >
-DWITH_GUI_TESTS=ON
```
* cmake accepts the following options:
```
-DWITH_XC_AUTOTYPE=[ON|OFF] Enable/Disable Auto-Type (default: ON)
-DWITH_XC_YUBIKEY=[ON|OFF] Enable/Disable YubiKey HMAC-SHA1 authentication support (default: OFF)
2018-01-17 07:55:13 -05:00
-DWITH_XC_BROWSER=[ON|OFF] Enable/Disable KeePassXC-Browser extension support (default: OFF)
2019-05-07 12:56:55 -04:00
-DWITH_XC_NETWORKING=[ON|OFF] Enable/Disable Networking support (e.g., favicon downloading) (default: OFF)
2018-10-01 10:26:24 -04:00
-DWITH_XC_SSHAGENT=[ON|OFF] Enable/Disable SSHAgent support (default: OFF)
-DWITH_XC_TOUCHID=[ON|OFF] (macOS Only) Enable/Disable Touch ID unlock (default:OFF)
Add Freedesktop.org Secret Storage Spec Server Side API (Fix #1403)
This plugin implements the Secret Storage specification version 0.2.
While running KeePassXC, it acts as a Secret Service server, registered
on DBus, so clients like seahorse, python-secretstorage, or other
implementations can connect and access the exposed database in KeePassXC.
Squashed commits:
- Initial code
- Add SessionAdaptor and fix build
- The skeletons for all dbus objects are in place
- Implement collection creation and deletion
- Emit collectionChanged signal
- Implement app-wise settings page
- Implement error message on GUI
- Implement settings
- Fix uuid to dbus path
- Implement app level settings
- Add freedesktop logo
- Implement database settings page
- Change database settings to a treeview
- Move all settings read/write to one place
- Rename SecretServiceOptionsPage to SettingsWidgetFdoSecrets
- Fix selected group can not be saved if the user hasn't click on the item
- Show selected group per database in app settings
- Disable editing of various readonly widgets
- Remove unused warning about non exposed database
- Fix method signature on dbus adaptors
- Fix type derived from DBusObject not recognized as QDBusContext
- Resolve a few TODOs around error handling
- Remove const when passing DBus exposed objects
- Move dismiss to PromptBase
- Implement per collection locking/unlocking
- Fix const correctness on Item::setSecret
- Implement SecretService::getSecrets
- Rework the signal connections around collections.
- Remove generateId from DBusObject
- Per spec, use encoded label as DBus object path for collections
- Fix some corner cases around collection name changes
- Implement alias
- Fix wrong alias dbus path
- Implement encryption per spec
- Cleanup SessionCipher
- Implement searchItems for SecretService
- Use Tools::uuidToHex
- Implement Item attributes and delete
- Implement createItem
- Always check if the database is unlocked before perform any operation
- Add missing ReadAlias/SetAlias on service
- Reorganize and fix OpenSession always returning empty output
- Overhaul error handling
- Make sure default alias is always present
- Remove collection aliases early in doDelete
- Handles all content types, fix setProperties not working
- Fix sometimes there is an extraneous leading zero when converting from MPI
- Fix session encryption negotiation
- Do not expose recycle bin
- Protect against the methods not called from DBus
- Also emit collectionChanged signal when lock state changes
- Show notification when entry secret is requested
- Add a README file
- Actually close session when client disconnects
- Gracefully return alternative label when collection is locked
- Reorganize, rename secretservice to fdosecrets
- Fix issues reported by clazy
- Unify UI strings and fix icon
- Implement a setting to skip confirmation when deleting entries from DBus
- Remove some unused debugging log
- Simply ignore errors when DBus context is not available. QtDBus won't set QDBusContext when deliver property get/set, and there is no way to get a QDBusMessage in property getter/setter.
- Simplify GcryptMPI using std::unique_ptr and add unit test
- Format code in fdosecrets
- Move DBusReturnImpl to details namespace
- Fix crash when locking a database: don't modify exposedGroup setting in customData when database is deleted
- Make sure Collection::searchItems works, whether it's locked or not
- Fix FdoSecrets::Collection becomes empty after a database reload
- Fix crash when looping while modifying the list
2019-03-25 23:07:18 -04:00
-DWITH_XC_FDOSECRETS=[ON|OFF] (Linux Only) Enable/Disable Freedesktop.org Secrets Service support (default:OFF)
2019-05-07 12:56:55 -04:00
-DWITH_XC_KEESHARE=[ON|OFF] Enable/Disable KeeShare group synchronization extension (default: OFF)
2018-03-31 11:36:18 -04:00
-DWITH_XC_ALL=[ON|OFF] Enable/Disable compiling all plugins above (default: OFF)
2021-09-21 00:17:46 -04:00
2019-05-07 12:56:55 -04:00
-DWITH_XC_UPDATECHECK=[ON|OFF] Enable/Disable automatic updating checking (requires WITH_XC_NETWORKING) (default: ON)
2017-11-26 16:36:46 -05:00
-DWITH_TESTS=[ON|OFF] Enable/Disable building of unit tests (default: ON)
-DWITH_GUI_TESTS=[ON|OFF] Enable/Disable building of GUI tests (default: OFF)
-DWITH_DEV_BUILD=[ON|OFF] Enable/Disable deprecated method warnings (default: OFF)
-DWITH_ASAN=[ON|OFF] Enable/Disable address sanitizer checks (Linux / macOS only) (default: OFF)
2018-10-03 10:12:19 -04:00
-DWITH_COVERAGE=[ON|OFF] Enable/Disable coverage tests (GCC only) (default: OFF)
-DWITH_APP_BUNDLE=[ON|OFF] Enable Application Bundle for macOS (default: ON)
2019-05-07 12:56:55 -04:00
-DKEEPASSXC_BUILD_TYPE=[Snapshot|PreRelease|Release] Set the build type to show/hide stability warnings (default: "Snapshot")
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Other] Specify the distribution method (default: "Other")
-DOVERRIDE_VERSION=[X.X.X] Specify a version number when building. Used with snapshot builds (default: "")
-DGIT_HEAD_OVERRIDE=[XXXXXXX] Specify the 7 digit git commit ref for this build. Used with distribution builds (default: "")
2017-11-26 16:36:46 -05:00
```
* If you are on MacOS you must add this parameter to **Cmake** , with the Qt version you have installed< br /> `-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.6.2/lib/cmake/`
2012-04-25 14:22:44 -04:00
2017-11-26 16:36:46 -05:00
:exclamation: When building with ASan support on macOS, you need to use `export ASAN_OPTIONS=detect_leaks=0` before running the tests (no LSan support in macOS).
2011-12-29 17:24:01 -05:00
2016-10-26 08:19:28 -04:00
Installation
============
2017-11-26 16:36:46 -05:00
After you have successfully built KeePassXC, install the binary by executing the following:
2016-10-26 08:19:28 -04:00
```bash
sudo make install
```
You can specify the destination dir with
```
DESTDIR=X
```
Packaging
=========
2019-06-05 23:23:29 -04:00
You can create a package to redistribute KeePassXC (zip, deb, rpm, dmg, etc..). Refer to [keepassxc-packaging ](https://github.com/keepassxreboot/keepassxc-packaging )
2016-10-26 08:19:28 -04:00
Testing
=======
2013-11-30 06:49:29 -05:00
2019-12-27 20:26:34 -05:00
You can perform tests on the built executables with:
2016-10-26 08:19:28 -04:00
```
2019-12-27 20:26:34 -05:00
make test ARGS+="--output-on-failure"
```
If you are not currently running on an X Server or Wayland, run the tests as follows:
```
make test ARGS+="-E test\(cli\|gui\) --output-on-failure"
xvfb-run -e errors -a --server-args="-screen 0 1024x768x24" make test ARGS+="-R test\(cli\|gui\) --output-on-failure"
2016-10-26 08:19:28 -04:00
```
2012-05-28 06:11:44 -04:00
2016-10-26 08:19:28 -04:00
Common parameters:
```
CTEST_OUTPUT_ON_FAILURE=1
ARGS+=-jX
ARGS+="-E testgui"
```