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

Support ssh-add -D to close Yubikey transaction #121

Merged
merged 2 commits into from
Mar 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ Host *

`yubikey-agent` takes a persistent transaction so the YubiKey will cache the PIN after first use. Unfortunately, this makes the YubiKey PIV and PGP applets unavailable to any other applications, like `gpg-agent` and Yubikey Manager. Our upstream [is investigating solutions to this annoyance](https://github.com/go-piv/piv-go/issues/47).

If you need `yubikey-agent` to release its lock on the YubiKey, send it a hangup signal. Likewise, you might have to kill `gpg-agent` after use for it to release its own lock.
If you need `yubikey-agent` to release its lock on the YubiKey, send it a hangup signal or use `ssh-add`'s "delete all identities" flag. Likewise, you might have to kill `gpg-agent` after use for it to release its own lock.

```
killall -HUP yubikey-agent
ssh-add -D
```

This does not affect the FIDO2 functionality.
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (a *Agent) Close() error {
a.mu.Lock()
defer a.mu.Unlock()
if a.yk != nil {
log.Println("Received SIGHUP, dropping YubiKey transaction...")
log.Println("Received HUP, dropping YubiKey transaction...")
err := a.yk.Close()
a.yk = nil
return err
Expand Down Expand Up @@ -336,7 +336,7 @@ func (a *Agent) Remove(key ssh.PublicKey) error {
return ErrOperationUnsupported
}
func (a *Agent) RemoveAll() error {
return ErrOperationUnsupported
return a.Close()
}
func (a *Agent) Lock(passphrase []byte) error {
return ErrOperationUnsupported
Expand Down