ksshaskpass not saving PIN for FIDO2-backed key

Hi everyone,

Hopefully this is a good place for this thread, I’m new here.

I have my ssh key (sk-ssh-ed25519@openssh.com) stored on yubikey itself. That works perfectly fine, the key can never leave the yubikey, and when I want to use it, I need to enter PIN and touch the yubikey.

PIN prompts appear in ksshaskpass. I enter pin, click remember password, click ok, touch yubikey and I’m logged in. However, next time when I go to log in to some server, the PIN prompt appears again, which I feel like should not happen since I clicked “remember password”.

I have “solved” that by editing ksshaskpass: in this block:

    // openssh ssh-agent.c
    // Case: asking to provide the PIN of the security key device
    // match after "for" is key type, match after "key" is SHA digest of key
    match = QRegularExpression(QStringLiteral("^Enter PIN( and confirm user presence)? for (.*?) key (.*?): $")).match(prompt);
    if (match.hasMatch()) {
        identifier = QStringLiteral("PIN:") + match.captured(3);
        displayType = DisplayType::Password;
        ignoreKeychain = true;
        return;
    }

i changed ignoreKeychain = true; to ignoreKeychain = false; and now sure enough, my PIN is remembered.

I think this should be the default behavior, since “remember password” means, well, “remember password”.

I don’t really think this counts as a bug, since there was probably some reason behind the decision to not store the pin by default. I’m curious to see what the community thinks about this