Password-free authentication – FIDO2 and WebAuthn
Firefox
In early 2018, the developer versions of Firefox introduced support for the authentification process, and the technology is firmly integrated since Firefox 60 [10]. Also, the developers of the Chrome (Google) and Edge (Microsoft) browsers [11] plan to support WebAuthn in the future.
Listings 1 and 2 show JavaScript examples from a post by Mozilla developers J.C. Jones and Tim Taubert [12] that initializes a USB U2F token and requests public keys on the client. All you need is the local hardware (e.g., the USB token or a fingerprint reader).
The navigator.credentials.create()
and decodeCredential
functions of Listing 1 request a new FIDO credential by enabling all compatible devices and keeping them waiting for user input. The credential is created as soon as the user has authenticated successfully. The decodeCredential
function creates a key pair and transmits the public key (in plain text). When generating the key, the URL call and a timestamp link this user, this website, and the authentication. Listing 2 shows the process for an existing credential when the user visits the website again.
Listing 1
Creating a Credential and Keys
01 /* (CC BY-SA 3.0: https://creativecommons.org/licenses/by-sa/3.0/) */ 02 03 const cose_alg_ECDSA_w_SHA256 = -7; 04 05 /* The challenge must be produced by the server */ 06 let challenge = new Uint8Array([21,31,105,<[...]>]); /* 29 more random bytes generated by the server */ 07 08 let pubKeyCredParams = [{ 09 type: "public-key", 10 alg: cose_alg_ECDSA_w_SHA256 11 }]; 12 13 let rp = { 14 name: "Test Website" 15 }; 16 17 let user = { 18 name: "Firefox User firefox@<example.com>", 19 displayName: "Firefox User", 20 id: new TextEncoder("utf-8").encode("firefox@<example.com>") 21 }; 22 23 let publicKey = {challenge, pubKeyCredParams, rp, user}; 24 navigator.credentials.create({publicKey}) 25 .then(decodeCredential);
Listing 2
Querying the Public Key
01 /* (CC BY-SA 3.0: https://creativecommons.org/licenses/by-sa/3.0/) */ 02 03 /* The challenge must be produced by the server */ 04 let challenge = new Uint8Array([42,42,33,<[...]>]); /* 29 more random bytes generated by the server */ 05 06 let key = new Uint8Array(<[?]>); */ Retrieve Key Handle 07 08 let allowCredentials = [{ 09 type: "public-key", 10 id: key, 11 transports: ["usb"] 12 }]; 13 14 let publicKey = {challenge, allowCredentials}; 15 16 navigator.credentials.get({publicKey}) 17 .then(decodeAssertion);
For Developers
The FIDO Alliance developer resources web page [13] proves to be a good starting point for developers, with direct links to the specification and explanations for the protocols, platforms, and functions involved (e.g., the navigator.credentials.get()
and navigator.credentials.create()
functions demonstrated in Listings 1 and 2).
On Android, org.fidoalliance.intent.FIDO_OPERATION
handles all the functions (see chapter 6 of the W3C specification, or chapter 7 for iOS). The Android client API has defined this intent and it comes with a full set of functions for login, registration, and changes. Google's developer resources [14] prove to be just as helpful in the WebAuthn case as those of GitHub, where more and more projects are implementing the functions (e.g., in Python [15] and with YubiKeys).
Yubico tokens appear to be a good choice for a quick start. Both the YubiKey NEO and FIPS support FIDO and are National Institute of Standards and Technology (NIST)-certified for use in safety-critical environments.
Server Side
The FIDO Alliance points to the large number of servers that support FIDO, each of which offers its own configuration procedure. However, the Alliance offers to confer FIDO Universal Server certification [16] on the servers.
Secure Sockets Layer (SSL) is a basic requirement, but without a database – or an LDAP user directory – nothing works right now. Yubico lists the steps necessary for LDAP integration under YubiAuth [17], and the LDAP wiki [18] indicates a starting point for CTAP. A demo project is available on GitHub for FIDO2 servers [19].
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.