jonathanmorley / oktaws

Apache License 2.0
15 stars 10 forks source link

MacOsKeychainError if ssh'ed in #109

Closed pinko-fowle closed 3 years ago

pinko-fowle commented 4 years ago

Hello. If I open a terminal on my macbook, and run oktaws, it updates my credentials. No password asked. Great.

If I ssh into my macbook, and run that same oktaws command, I get:

Password for https://pinko@yoyodyne.okta.com: 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MacOsKeychainError', src/libcore/result.rs:916:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::begin_panic
   4: std::panicking::begin_panic_fmt
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: oktaws::main::run
   8: oktaws::main
   9: std::rt::lang_start::{{closure}}
  10: main

Not sure right now how to get line numbers in my backtrace (this was from RUST_BACKTRACE=1). Wanted to file now while I'm remembering.

The fact that oktaws is asking me for a password at all is a divergence from how Oktaws behaves if I am in front of my computer. And then, after entering the password, it waits a second or two, & then throws this error.

It would be nice to be able to use oktaws over ssh.

pinko-fowle commented 3 years ago

I found security -v unlock-keychain ~/Library/Keychains/login.keychain-db will make oktaws work if I am ssh'ed in.

Tip of the hat to https://github.com/docker/docker-credential-helpers/issues/82#issuecomment-749368416 for pointing me at this.