bepaald / signalbackup-tools

Tool to work with Signal Backup files.
GNU General Public License v3.0
786 stars 37 forks source link

Cannot get desktop key on Linux Mint xfce #252

Open ernstblaauw opened 1 day ago

ernstblaauw commented 1 day ago

As I am moving from Linux Mint xfce to KDE Plasma, I need to move the Signal key. As described on Reddit, I tried to use your tool to extract the Signal key from my Signal install. Signal works fine, and I am on version 7.28. I installed signalbackup-tools using nix I ran signalbackup-tools via sudo nix-shell --packages signalbackup-tools -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz I tried running

$ signalbackup-tools --showdesktopkey
signalbackup-tools (signalbackup-tools) source version 20240929.123459 (SQlite: 3.46.0, OpenSSL: OpenSSL 3.0.14 4 Jun 2024)
[Error]: Failed to open input: /config.json
[Error]: Failed to open input: /config.json
[Error]: Failed to get sqlcipher key to decrypt Signal Desktop database

and

$ signalbackuptools /home/<user>/.config/Signal --showdesktopkey
signalbackup-tools (signalbackup-tools) source version 20240929.123459 (SQlite: 3.46.0, OpenSSL: OpenSSL 3.0.14 4 Jun 2024)
[Error]: Failed to open input: /config.json
[Error]: Failed to open input: /config.json
[Error]: Failed to get sqlcipher key to decrypt Signal Desktop database

What should I do to get the key?

bepaald commented 1 day ago

Hi! My guess is, that running inside nix-shell prevents the tool from accessing your environment variables, so it can not find $HOME (and subsequently can not find you signal data directory).

You seem to have attempted to mitigate that with your second command, but unfortunately it's not fully correct. To specify the location of the Signal Desktop data folder, use --desktopdirs followed by the data folder (/home/<user>/.config/Signal) twice:

signalbackup-tools --desktopdirs /home/<user>/.config/Signal /home/<user>/.config/Signal --showdesktopkey

The doubling of the folder is for historical reasons, and has already been changed, but I see the nix package is (slightly) out of date so you need to pass it like that.

If the problem is not that the nix shell can't find you home directory, buy that it doesn't have access to it, then I don't know, there is probably some config option for that or you need to run the tool outside nix-shell.

Let me know if this helps!

bepaald commented 10 hours ago

I have quickly run Linux Mint XFCE in a virtual machine to test. When running the program in a nix-shell, it indeed can not find home directory automatically. Manually specifying it as I described above helps with this. I have (locally) added a warning when the tool fails to determine Signal Desktop's data directory, which also advises the user to add --desktopdirs.

However, after that, the tool needs to access the dbus system to query the keys, which will also fail. I do not know enough about nix to solve this, there may be a way but I wouldn't know how. I can tell you that the tool worked fine on Mint XFCE when running in a normal shell.

ernstblaauw commented 9 hours ago

Thanks, I will try to compile it myself and then run it. Your help is much appreciated!

bepaald commented 8 hours ago

Since I still had my virtual machine going, just thought I'd show what I did to compile on Mint. There are of course other options, not using cmake or git, but I think this is easiest:

$ apt install g++ git cmake libssl-dev libsqlite3-dev libdbus-1-dev #installing deps, you may have them already
#[...]
$ git clone https://github.com/bepaald/signalbackup-tools #download the latest version of the tool
#[...]
$ cd signalbackup-tools
$ cmake -B build
#[...]
$ cmake --build build -j$(nproc) # build!

That was it, the executable can then be found in the build directory, and just running ./build/signalbackup-tools --showdesktopkey should hopefully be it. Let me know how you get on.