Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vault gets wiped on startup when using pass #470

Open
beauby opened this issue Mar 28, 2024 · 4 comments · May be fixed by #486
Open

Vault gets wiped on startup when using pass #470

beauby opened this issue Mar 28, 2024 · 4 comments · May be fixed by #486

Comments

@beauby
Copy link

beauby commented Mar 28, 2024

Using pass on Linux, the vault gets wiped when starting proton-bridge (bridge -c) if the gpg key is not unlocked (the key has a passphrase):

WARN[Mar 28 17:05:26.856] Failed to get test credentials from keychain  error="exit status 2: gpg: public key decryption failed: No such file or directory\ngpg: decryption failed: No such file or directory\n" helper="*pass.Pass"
WARN[Mar 28 17:05:26.948] Failed to load existing vault, vault has been reset  error="failed to decrypt vault: cipher: message authentication failed"
WARN[Mar 28 17:05:26.953] The vault is corrupt and has been wiped      

Expected Behavior

Gracefully fail, or prompt to unlock.

Current Behavior

Wipe out the vault.

Possible Solution

Steps to Reproduce

  1. Set up pass with passphrase-protected gpg key
  2. Run bridge -c

Version Information

3.10.0

Context (Environment)

Detailed Description

Possible Implementation

@zwets
Copy link

zwets commented Mar 29, 2024

A big +1 on this issue. It has happened a few times that I either dismissed the GPG password dialog box or waited too long to fill it in (apparently there is a timeout).

What happens then is that I lose everything and need to set up bridge all over again: settings, accounts, client-side passwords, followed by the long and costly re-download of my whole mailbox.

I would be very happy if this were fixed!

@deiKruve
Copy link

deiKruve commented Apr 9, 2024

I use thefollowing sequence on Debian:

pass xxx

This will ask for the passphrase and give the key. It opens the database. The database seems to stay open for a limited time.
Thereafter I can start bridge without a problem.

protonmail-bridge --cli

j.

@JonathanReeve
Copy link

This is a big problem, since whenever the vault gets wiped, I have to do this:

  1. Check the CLI for a new password
  2. Edit the password in pass with the new password, for IMAP
  3. Do the same for SMTP
  4. Export the new cert.pem key
  5. Move the key to the location where my mail agent (isync/mbsync) is configured to find it
  6. Wait for a large sync operation to sync all my mail over again
  7. Trash my whole maildir folder, since the UID validity has now changed, and mbsync won't sync any more
  8. Recreate the maildir

@kira-bruneau kira-bruneau linked a pull request Jul 23, 2024 that will close this issue
@Always-Self-Hosted
Copy link

Always-Self-Hosted commented Jan 12, 2025

It looks like this is still an issue, and even if you don't set a password for your gpg key. I know my example is trying to run proton-bridge headless in a docker container, but regardless the issue is the same. Despite mounting volumes to persist the required files, even in the same container just restarting the process results in the vault being recreated and the imap/smtp passwords changing.

FROM golang:1.21.9 as build
ARG PROTON_BRIDGE_VERSION
RUN apt-get update && apt-get install -y libsecret-1-dev
RUN git clone https://github.com/ProtonMail/proton-bridge.git
WORKDIR proton-bridge
RUN git checkout tags/v$PROTON_BRIDGE_VERSION
RUN make build-nogui
FROM debian:12.8-slim
COPY --from=build /go/proton-bridge /opt/proton-bridge
ENV PATH="$PATH:/opt/proton-bridge"
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
    gnupg \
    pass \
    libsecret-1-dev \
    && rm -rf /var/lib/apt/lists/*
RUN gpg --batch --passphrase "" --quick-gen-key "proton-bridge" default default never
RUN pass init "proton-bridge"
EXPOSE 1025
EXPOSE 1143
CMD ( echo "login"; echo $PROTON_EMAIL; echo $PROTON_PASSWORD; sleep 15s; echo "info 0"; echo "exit" ) | proton-bridge --cli && proton-bridge --noninteractive
2025-01-12 10:18:12.151872+00:00�[33mWARN�[0m[Jan 12 10:18:12.151] Failed to add test credentials to keychain    �[33merror�[0m="failed to open dbus connection: exec: \"dbus-launch\": executable file not found in $PATH" �[33mhelper�[0m="*keychain.SecretServiceDBusHelper"
2025-01-12 10:18:12.413630+00:00�[33mWARN�[0m[Jan 12 10:18:12.413] no vault key found, generating new            �[33merror�[0m="could not get keychain item: credentials not found in native keychain"
2025-01-12 10:18:13.676839+00:00�[33mWARN�[0m[Jan 12 10:18:13.676] Failed to load existing vault, vault has been reset  �[33merror�[0m="failed to decrypt vault: cipher: message authentication failed"
2025-01-12 10:18:13.690527+00:00�[33mWARN�[0m[Jan 12 10:18:13.690] The vault is corrupt and has been wiped

*** edit ***
ok this might be nothing to do with the gpg key, i think my issue is docker related and how the dbus isn't running which means proton-bridge can't read or add keys to my pass keyring and so goes ahead and creates a brand new vault every time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants