Skip to content

Instantly share code, notes, and snippets.

@markwoon
Last active April 23, 2024 12:31
Show Gist options
  • Save markwoon/b8e0e78c9f7c9a9229226145ea1c1c36 to your computer and use it in GitHub Desktop.
Save markwoon/b8e0e78c9f7c9a9229226145ea1c1c36 to your computer and use it in GitHub Desktop.
Using Yubikey with Cisco AnyConnect

Yubikey + Cisco AnyConnect VPN

The default configuration for Yubikey is to support the CCID (Smart Card) interface. This does not play well with Cisco's AnyConnect VPN if you plan on connecting using a certificate on Windows.

When the CCID interface is enabled on the Yubikey, AnyConnect will produce a generic "The client agent has encountered an error" message when you try to use the certificate.

You will find something like these in the event viewer:

Date        : 09/01/2020
Time        : 16:53:36
Type        : Error
Source      : acvpndownloader
Description : Function: CCertificateInfoTlv::Assign
File: c:\temp\build\thehoff\negasonic_mr30.297045120452\negasonic_mr3\vpn\common\tlv\certificateinfotlv.cpp
Line: 87
Invoked Function: CCertificateInfoTlv::Serialize
Return Code: -21889013 (0xFEB2000B)
Description: CERTIFICATEINFO_ERROR_NO_DATA:No certificate data was found
Date        : 09/01/2020
Time        : 14:39:02
Type        : Error
Source      : acvpnui
Description : Function: CSmartcardContext::initializeCard
File: c:\temp\build\thehoff\negasonic_mr20.884170368426\negasonic_mr2\vpn\commoncrypt\certificates\capismartcardutils.cpp
Line: 1155
Invoked Function: CSmartcardContext::acquireCryptProvForSmartcard
Return Code: -31457269 (0xFE20000B)
Description: CERTSTORE_ERROR_PROVIDER_ERROR
while processing smart card Yubico Yubikey 4 OTP+U2F+CCID 0

AnyConnect is trying to find the certificate but only checks the Yubikey for it when the Yubikey is inserted.

To solve this, either:

  • make sure the Yubikey is not connected when initializing the VPN, or
  • disable the CCID interface on the Yubikey

Disabling CCID interface on Yubikey

This is only an option if you don't actually need the CCID (Smart Card) functionality on the Yubikey.

  1. Download and install the Yubikey Manager
  2. Open Yubikey Manager
  3. Click Interfaces
  4. Uncheck CCID (Smart Card)
  5. Click _Save Interfaces
  6. Remove and reinsert Yubikey
@craigmit
Copy link

Or disable it in Windows device manager:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment