Forum Discussion

davefm's avatar
davefm
New Contributor
29 days ago
Solved

op from a remote docker container?

Hi,

We're using (linux) ssh remotely to connect to an on-prem bastion.  Behind the bastion is a docker container we use for ansible deployment. There are several playbooks that need environment variables exported in order to run.  It would be nice to pull these in on the remote container using op  instead of the current cut/paste workflow.  Is it possible to authorize the terminal locally with op signin and then schmooze that authorization into the remote docker container with ssh -A or something to allow the container to do something like: TOKEN=$(op read "op://Dev Secrets/GitHub Token/password") ?

Our 1P accounts are issued through an enterprise and we use SSO for login with our on-prem IDP so there may be some restrictions with methods available (eg: service account token)

 

  • Figured out a great way to do this!

    • ssh will preserve environment variables prefixed with `LC_`
    • render 1Password secrets into `LC_` prefix variable eg:

      `export LC_PASSWORD=$(op read "op://Employee/test-pass/password")`

    • ssh into remote system or jump host
    • LC_ variables are carried into the remote session eg: `echo $LC_PASSWORD`

     

1 Reply

  • davefm's avatar
    davefm
    New Contributor

    Figured out a great way to do this!

    • ssh will preserve environment variables prefixed with `LC_`
    • render 1Password secrets into `LC_` prefix variable eg:

      `export LC_PASSWORD=$(op read "op://Employee/test-pass/password")`

    • ssh into remote system or jump host
    • LC_ variables are carried into the remote session eg: `echo $LC_PASSWORD`