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

Random lpass Error: Could not find decryption key #650

Open
psciacca2inno opened this issue Feb 24, 2023 · 1 comment · May be fixed by #694
Open

Random lpass Error: Could not find decryption key #650

psciacca2inno opened this issue Feb 24, 2023 · 1 comment · May be fixed by #694

Comments

@psciacca2inno
Copy link

I have a batch shell script that runs inside a Jenkins server. It uses lpass cli to retrieve secure notes from lastpass.
This task is launched several times (about 200 times or more) both in the day and night.

I'm quite sure that this proceess have no error in the day, but sometimes in night hours,
randomly gives error:
"lpass Error: Could not find decryption key Perhaps you need to login with lpass login."

Is there any way to debug the lastpass-cli commands ? or additional info and try to solve this error ?

For example yesterday I missed 8 backups for this error.

Thanks in advance.

@awsomearvinder
Copy link

I've been encountering the same issue in our scripts. Reading the source, I think what happens is that lastpass-cli spawns an agent and then immediately exits on login. If you try to immediately run lpass show, the agent won't be up / connected to the socket yet, and that will cause the command to fail. This isn't entirely deterministic, since sometimes by the time lpass show executes, the agent will be far along enough in the bringup process where it is binded to the socket.

Throwing a sleep for a little bit after the login will probably fix it. The --plaintext-key option should also work since it would bypass the agent entirely, but that doesn't work in our case since we don't want to write they key to disk. I'm looking into writing a patch so that the lpass login command will wait for the agent to bind to the socket before exiting. I'll try to submit a PR if I figure it out.

awsomearvinder added a commit to awsomearvinder/lastpass-cli that referenced this issue Jul 17, 2024
We open a pipe with the agent when we spawn it, and wait for them
to say they're ready before exiting. This *should* fix lastpass#650.

The underlying issue was that when doing:
```
lpass login [email protected]
lpass show bar
```
in a script would cause a race condition where `lpass login` exited
before the agent was successfully brought up. `lpass show bar` then
tried to reach out to the agent, sees the socket isn't created yet,
and says the user isn't logged in.
awsomearvinder added a commit to awsomearvinder/lastpass-cli that referenced this issue Jul 17, 2024
We open a pipe with the agent when we spawn it, and wait for them
to say they're ready before exiting. This *should* fix lastpass#650.

The underlying issue was that when doing:
```
lpass login [email protected]
lpass show bar
```
in a script would cause a race condition where `lpass login` exited
before the agent was successfully brought up. `lpass show bar` then
tried to reach out to the agent, sees the socket isn't created yet,
and says the user isn't logged in.

Signed-Off-by: Arvinder Dhanoa <[email protected]>
awsomearvinder added a commit to awsomearvinder/lastpass-cli that referenced this issue Jul 19, 2024
We open a pipe with the agent when we spawn it, and wait for them
to say they're ready before exiting. This *should* fix lastpass#650.

The underlying issue was that when doing:
```
lpass login [email protected]
lpass show bar
```
in a script would cause a race condition where `lpass login` exited
before the agent was successfully brought up. `lpass show bar` then
tried to reach out to the agent, sees the socket isn't created yet,
and says the user isn't logged in.

Signed-Off-by: Arvinder Dhanoa <[email protected]>
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.

2 participants