feat: gpgtools - YubiKey GPG/SSH helpers (v0.6.0)

initialize_yubikey (guide steps 1-4): gnupg install fallback
(apt-get/dnf/pacman), card check, public-key fetch from the
card's URL field, idempotent gpg-agent SSH config merge,
GNUPGHOME chmod 700; --dry-run, --gnupg-home.

send_pubkey (guide steps 5-6): resolve the SSH public key from
four sources (--yubikey via gpg-agent ssh socket, --url, --fingerprint via store chain local keyring -> keys.openpgp.org
-> keyserver.ubuntu.com with fingerprint checking, --pubkey
literal), prove possession of the private half with a random
challenge signature (ssh-keygen -Y sign -U / verify) before
anything is stored, then append idempotently to the target's
authorized_keys (dedup by key material, comments ignored).
--no-verify opts out explicitly; --dry-run resolves only.

51 tests (flow via injected runner: no hardware, network, or
interactive terminal); steps 1-6 of the wiki guide
(yubikey-ssh-guide.md) are now one command each.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
nvaldez
2026-11-19 00:46:40 +01:00
parent ec9848b169
commit fef68a84c9
8 changed files with 1472 additions and 3 deletions
+32
View File
@@ -10,6 +10,38 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
- Nothing yet.
## [0.6.0] - 2026-11-18
### Added in 0.6.0
- `gpgtools send_pubkey` (guide steps 5-6): resolves an SSH public key
from one of four sources — `--yubikey` (gpg-agent ssh socket),
`--url` (armored OpenPGP key, converted with `gpg --export-ssh-key`
in a throwaway GNUPGHOME), `--fingerprint` (store chain: local
keyring, keys.openpgp.org VKS, keyserver.ubuntu.com, each
fingerprint-checked), or `--pubkey` (literal line, format-validated).
Before anything is stored, proof of possession: a random challenge is
signed by the private half through the agent (`ssh-keygen -Y sign
-U`; PIN prompts reach the user) and verified against the candidate
line (`ssh-keygen -Y verify`). Only then is the line appended to the
target's `authorized_keys` — idempotent (grep before append), perms
enforced. `--no-verify` skips the check explicitly; `--dry-run`
resolves and prints without side effects. 22 new tests.
## [0.5.0] - 2026-11-18
### Added in 0.5.0
- `gpgtools` (Python, category `gpg`): YubiKey GPG/SSH helpers.
`daedalus gpgtools initialize_yubikey` runs the fresh-machine flow
(steps 1-4 of the wiki guide): installs gnupg when missing (apt-get,
dnf, pacman), checks the card, fetches the public key from the card's
URL field with `gpg --fetch-keys`, and writes the gpg-agent SSH
config (`enable-ssh-support`, cache TTLs) with the GNUPGHOME
directory at mode 700. `--dry-run` prints the plan; steps 5-7
(derive and deploy the SSH key per host) are server-specific and
intentionally out of scope.
## [0.4.0] - 2026-11-18
### Added in 0.4.0