monich / harbour-foilauth

Secure OTP (One-Time Password) generator for Sailfish OS
https://openrepos.net/content/slava/foil-auth
Other
11 stars 6 forks source link

[solved] Sailfish flash 4.4, not recognizing tokens from back-up #30

Closed tneo closed 2 years ago

tneo commented 2 years ago

I was forced to re-flash my Sailfish device. Before doing so I copied ~/.local/share/foil/foil.key and ~/Documents/FoilAuth directory to my computer. I flashed 4.4 on the device, copied over the files, but FoilAuth is not recognizing that a key is present and it does not recognize my tokens. This process was successful when moving from a Sailfish device to a new device with version 4.3.

How can I get my tokens to show up in Foil?

monich commented 2 years ago

Make sure that you have the latest version installed. The problem could be related to sadboxing feature of Sailfish OS 4.4

tneo commented 2 years ago

I have version 1.1.0-1 installed. Is there something that I can try to recover my tokens?

monich commented 2 years ago

Hmm, could it be that files from ~/Documents/FoilAuth (those are binary) somehow got damaged? Key is unlikely to be damaged, since it's a text. Also, check the permissions - all files should be readable and writable.

Another thing to try is to decrypt the token files on a computer as described in this question. The source code of foilmsg utility is here. If nothing else, that could provide a clue on what's wrong.

tneo commented 2 years ago

I'm running into issues making the project. And I don't know how to resolve that. Where to find the file mentioned: In file included from include/foil_asn1.h:38, from src/foil_asn1_p.h:38, from src/foil_asn1.c:35: include/foil_types.h:38:10: fatal error: gutil_types.h: No such file or directory 38 | #include <gutil_types.h

It is worrisome that this issue arises. Meaning I get locked out of accounts due to the loss of decryption option.

tneo commented 2 years ago

When I copy my back-up over to Sailfish and open FoilAuth the .info file gets removed. This does not happen when I have a fresh "FoilAuth" created new on the 4.4 install.

monich commented 2 years ago

I'm running into issues making the project. And I don't know how to resolve that. Where to find the file mentioned: In file included from include/foil_asn1.h:38, from src/foil_asn1_p.h:38, from src/foil_asn1.c:35: include/foil_types.h:38:10: fatal error: gutil_types.h: No such file or directory 38 | #include <gutil_types.h

You need to build and install libglibutil library and its dev package.

tneo commented 2 years ago

I'm sorry to keep bugging you.

Making and building is not my area of expertise. And I'm running into issues to get make to run properly.

gcc -fPIC  -g build/debug/foilmsg.o ../../libfoilmsg/build/debug/libfoilmsg.a ../../libfoil/build/debug/libfoil.so.1.0.23 -lglibutil -lgobject-2.0 -lglib-2.0 -o build/debug/foilmsg
/usr/bin/ld: cannot find -lglibutil
collect2: error: ld returned 1 exit status
make: *** [Makefile:149: build/debug/foilmsg] Error 1

Where do I install everything to get make to work?

monich commented 2 years ago

On a Debian based system, installing libglibutil should be as simple as running dpkg-buildpackage in libglibutil directory followed by sudo dpkg -i ../libglibutil_1.0.63_amd64.deb ../libglibutil-dev_1.0.63_amd64.deb or whatever version you have checked out, dpkg-buildpackage prints which packages you have built, e.g.:

dpkg-deb: building package 'libglibutil' in '../libglibutil_1.0.63_amd64.deb'.
dpkg-deb: building package 'libglibutil-dev' in '../libglibutil-dev_1.0.63_amd64.deb'.

dpkg-buildpackage itself may have to be installed by sudo apt-get install dpkg-dev or its equivalent.

tneo commented 2 years ago

Okay. I have stumbled my way through the make process. And make execution seems successful.

To be sure: I executed the program from ~/git/foil/tools/foilmsg/build/release/ Though that generates this error.

$ ./foilmsg 
./foilmsg: error while loading shared libraries: libfoil.so.1: cannot open shared object file: No such file or directory

I thought that the above dpkg -i command took care of that, but I was mistaken.

Can you help me one more step to regain access?

tneo commented 2 years ago

I have foilmsg working :) I have decrypted the passphrases as shown in question #25

Thanks for the assistance.

monich commented 2 years ago

IIRC -v option would print metadata (or headers they may be called). Those contain all kinds of additional information about the passphrase including the account name.

Have you figured out what's wrong with FoilAuth itself? Why did it stop recognizing the codes? Were they encrypted with a different key?

tneo commented 2 years ago

I have no idea why FoilAuth does not recognize the codes when I copy them back to Sailfish. I used the same key in 4.3 and 4.4 as I made a copy of the key before the flash to 4.4.

tneo commented 2 years ago

-v provides the details per code. Perfect. All cleared up now.