teranex weblog

gnupg

SSH authentication with your PGP key

A few weeks ago I learned that a few of my colleagues were using PGP. I myself started using PGP around 2003, using the GnuPG implementation. However, since I didn't know many people who used it my usage slowly faded after a few years. In 2009 I shortly picked it up again by creating a new key to phase out SHA-1, but that was also of short duration. Thanks to my colleagues, I'm now starting to use GnuPG again. My key is still the same as created in 2009: 610DB834.

I noticed that both my PGP-key and my SSH-keys use the RSA-algorithm, so I started wondering whether it was possible to use my PGP-key to authenticate myself to SSH-servers. After some Googling it seemed possible, but not very straightforward. In the end I managed to get it working, thanks to the very friendly support of Werner Koch (the main developer of GnuPG). Since it is not very straightforward I will document my findings here for future reference.

Adding an authentication key

First add an authentication subkey to your PGP-key, as it is apparently a best practice to use subkeys for each type of usage. To do so you need to start gpg with the --expert flag like this:

1
2
# where 610DB834 is the id of my key
gpg --expert --edit-key 610DB834

When you are in gpg type addkey and type '8' to choose (8) RSA (set your own capabilities). This option let's you manually configure the new key. Then type (each time followed by enter): S, E, A, Q, so that it says 'Current allowed actions: Authenticate'. Then choose a keysize (I use 4096) and an expiration date (5 years from now for example) and wait for the key to be created. Finally save to save your key. Your authentication-subkey is now ready.

Convert GPG keys to subkeys - Exterior Memory

How to remove private part of masterkey

Convert GPG keys to subkeys - Exterior Memory

How to remove private part of masterkey

Managing ssh keys with gpg-agent - Kumiwiki

Managing ssh keys with gnupg2 on Ubuntu Karmic Koala (Ubuntu 9.10)

Managing ssh keys with gpg-agent - Kumiwiki

Managing ssh keys with gnupg2 on Ubuntu Karmic Koala (Ubuntu 9.10)

Nieuwe PGP key

Een paar dagen geleden las ik op Debian Administration een artikel over het uitfaseren van SHA-1 in OpenPGP. Dit is nodig omdat de veiligheid van SHA-1 niet meer volledig gegarandeerd is.

Sinds ik Linux gebruik had ik mij al eens terug op OpenPGP willen toeleggen om het terug te gebruiken, al was het maar om de Ubuntu Code of Conduct te kunnen ondertekenen. Dit leek me dus het perfecte moment om ineens een nieuwe sleutel te genereren die hopelijk toch wel een aantal jaren moet mee kunnen. In het artikel wordt gesuggereerd om een 2048 bits RSA (sign-only) sleutel te maken, maar ik heb ervoor gekozen om maar ineens voor de 4096 bit RSA (sign-only) sleutel te gaan. Daarbij nog een 4096 bit RSA (encryption-only) subkey en een fototje en we zijn gesteld. Mijn nieuwe PGP key heeft als id 610DB834 gekregen.

De gegevens van de oude key:

Launchpad PPA key import script in Launchpad

Script for importing Launchpad PPA keys automatically for the PPAs listed in the users sources.list