So, there’s this cool thing called U2F, for Universal 2nd Factor, a dead simple second authentication method in the form of a physical token (I’m using a Yubikey Neo, but that’s not specially relevant to we’ll be talking about here as it should apply to any security key).
To put in simpler term: with U2F to log in to a website you need the password and a physical doodad plugged in the computer. No doodad, no access. Sorry evildoers.
The idea being that while it’s possible to steal credentials (login and password), if you need also a physical thing, then just the credentials on their own are not useful.
Unfortunately for us, U2F is not enabled by default in current versions of Firefox (66.0.1 as i write this).
Luckily, it’s very simple to enable however, visiting `about:config`, searching for “U2F” and toggling “Security.webauth.U2F” to “true” is enough.
More disheartening is the fact that even with this setting enabled, Github won’t let you add a key to your account, insisting instead that you “update to the latest version of Google Chrome”.
Not going to do that.
Instead, you can simply use Firefox’s developer tools to unhide the button that lets you add a security key.
To do so, open the Developer Tools (hitting F12 will do nicely) and in the Inspector, search html for “new-u2f-registration”. You should find a div element with a CSS display set to “none”, as shown in the CSS viewer (located to the bottom or to the right of the main inspector pane, depending on if your dev tools ar docked to the right or to the right, respectively). Then, just untick the box next too “display: none;” and the “Register new device” button will appear.
The following screenshot might help:
After that, everything works as you’d expect: you click the button, plug your key in, touch its button if it has one, give it a name to recognise with on Github, and you’re done.
Good, one less website to authenticate to without 2FA.
Contrary to what I thought¹, it is possible to use an elliptic curve-based public SSH key on a Edgemax router, runnning a (recent?) EdgeOS.
Connect to the router over SSH and issue the following, to add your key to EdgeOS’s (/Vyatta’s) configuration:
configure set system login user $your_router_user authentication public-keys user@host key "KEY-BODY-HERE" set system login user $your_router_user authentication public-keys user@host type ssh-ed25519 commit save
A few things to note:
user@host is whatever you want, it’s just the way one describes the key (technically, the config tree entry)
you’ll probably want to use YourUser@YourHost, YourHost as in: the host you are connecting from. That’s what is normally generated by OpenSSH as a comment at the end of public keys but…
…EdgeOS doesn’t understand any comment at the end of public SSH keyfiles. Even if they are a standard feature of OpenSSH keys.
In fact, it doesn’t recognise anything before the key itself either, so the usual ssh-rsa or ssh-ed25519 at the beginning of a keyfile make it choke.
So you must put nothing but the key body, in between quotes, when setting the config value system login user $your_router_user key
Finally, as you have probably guessed from the previous bullet points, setting the system login user $your_router_user type to ed_25519 is you tell EdgeOS what kind of key this is. Yes, this is the part that is at the beginning of a normal SSH keyfile.
This also explains why one hits the following error, when trying to paste when pasting the whole keyfile in the set system login etc. command.
Invalid public key character not base-64
Unfortunately, I was hoping that would explain why the loadkey command doesn’t accept the key from the keyfile, but… no. Even if you strip your public key file of the opening key type declaration (such as ssh-ed25519) and the ending comment (such as axel@master-switch), loadkey still complains and I get a:
Not a valid key file format (see man sshd) at /opt/vyatta/sbin/vyatta-load-user-key.pl line 96, <$in> line 1
It’s not like EdgeOS’s public SSH key management is super user friendly.