lastpass / lastpass-cli

LastPass command line interface tool
GNU General Public License v2.0
2.85k stars 292 forks source link

How to automate the login procedure? #567

Closed RHamers closed 3 years ago

RHamers commented 3 years ago

Hi,

I'm writing some software that uses my lastpass account for passwords and I'm trying to automate the login process. I use the LastPass CLI (https://lastpass.github.io/lastpass-cli) which works fine but I can't find a way around the password prompt during login. I tried this for example:

echo password | lpass login --trust --force username

(I'm using Ubuntu)

Does anyone know how to get around the password prompt?

thx

RHamers commented 3 years ago

Anyone? :)

rayk47 commented 3 years ago

I was thinking about doing something similar as I would like my CI/CD pipeline to have access to some secrets. I do see there are some examples online of entering input into a prompt but most solutions are hacks and dangerous. I understand that there may be security concerns here but I'm not sure I don't see why allowing a password to be passed in with the username on prompt would not suffice.

lpass login YOUR-EMAIL@lastpass.com PASSWORD

Or do something similar to AWS where you can configure a profile using access id's and secrets.

RHamers commented 3 years ago

yeah, exactly thats the command I would like to see too. However, there are folks who have successfully setup a CI pipeline using the CLI. So I wonder how they did it.

RHamers commented 3 years ago

@rayk47 Could you show me the examples of the automated login? I'm trying to get it working but I'm not able to. I would love to checkout the solutions you found. thx!

RHamers commented 3 years ago

@rayk47 I asked it on SO also; this answer works :D

echo <password> | LPASS_DISABLE_PINENTRY=1 lpass login <username>

https://stackoverflow.com/questions/64086272/how-to-automate-the-lastpass-cli-login-process