diff --git a/lib/auth/webauthnwin/webauthn_windows.go b/lib/auth/webauthnwin/webauthn_windows.go index fb0872634262c..708b92771ed69 100644 --- a/lib/auth/webauthnwin/webauthn_windows.go +++ b/lib/auth/webauthnwin/webauthn_windows.go @@ -57,6 +57,14 @@ func newNativeImpl() *nativeImpl { Debug("WebAuthnWin: failed to load WebAuthn.dll (it's likely missing)") return n } + // Load WebAuthNGetApiVersionNumber explicitly too, it avoids a panic on some + // Windows Server 2019 installs. + if err := procWebAuthNGetApiVersionNumber.Find(); err != nil { + log. + WithError(err). + Debug("WebAuthnWin: failed to load WebAuthNGetApiVersionNumber") + return n + } v, err := webAuthNGetApiVersionNumber() if err != nil { @@ -66,6 +74,10 @@ func newNativeImpl() *nativeImpl { n.webauthnAPIVersion = v n.isAvailable = v > 0 + if !n.isAvailable { + return n + } + n.hasPlatformUV, err = isUVPlatformAuthenticatorAvailable() if err != nil { // This should not happen if dll exists, however we are fine with