Skip to content

fix(gpg): remove --pinentry-mode loopback from key import#400

Merged
cdalvaro merged 1 commit into
mainfrom
bugfix/gpg_import_key
Jun 2, 2026
Merged

fix(gpg): remove --pinentry-mode loopback from key import#400
cdalvaro merged 1 commit into
mainfrom
bugfix/gpg_import_key

Conversation

@cdalvaro
Copy link
Copy Markdown
Owner

@cdalvaro cdalvaro commented Jun 2, 2026

Summary

Removes --pinentry-mode loopback from the GPG key import in _setup_gpgkeys.

This flag leaves the imported secret key in a state where it is listed as present but cannot actually be used for decryption, causing pillar GPG decryption to fail.

The bug

After import, --list-secret-keys shows the key as present, but decrypting a pillar fails:

gpg: public key decryption failed: Bad secret key

The container starts up healthy, so the problem only surfaces when a pillar is rendered.

Fix

--pinentry-mode loopback only reroutes passphrase prompts to the caller; it does not bypass gpg-agent. Since this image requires passphrase-less keys, no passphrase is ever supplied, so the flag adds nothing and breaks the import.

--batch --no-tty already keeps the import non-interactive.

loopback mode corrupts the at-rest storage of passphrase-less cv25519
secret keys under GnuPG 2.4.x: the keygrip is listed as present but
unusable for pkdecrypt, so pillar decryption fails at render time with
"Bad secret key" while the master still starts cleanly. loopback does
not bypass gpg-agent and is pointless for passphrase-less keys;
--batch --no-tty already covers the non-interactive CI case.
@cdalvaro cdalvaro self-assigned this Jun 2, 2026
@cdalvaro cdalvaro added the bug Something isn't working label Jun 2, 2026
@cdalvaro cdalvaro merged commit df341ba into main Jun 2, 2026
12 of 17 checks passed
@cdalvaro cdalvaro deleted the bugfix/gpg_import_key branch June 2, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant