Fixed GPG pinentry integration command

This commit is contained in:
Michele Cereda
2023-03-07 09:00:01 +01:00
parent 4ad9a85392
commit 15f712b805
2 changed files with 26 additions and 8 deletions

View File

@@ -29,6 +29,7 @@
"flatpak", "flatpak",
"gcloud", "gcloud",
"getfacl", "getfacl",
"gpgconf",
"gpgtools", "gpgtools",
"growpart", "growpart",
"hadolint", "hadolint",
@@ -48,9 +49,11 @@
"nmap", "nmap",
"nvme", "nvme",
"ocsp", "ocsp",
"openpgp",
"pacman", "pacman",
"pamac", "pamac",
"pihole", "pihole",
"pinentry",
"pkexec", "pkexec",
"polkit", "polkit",
"pvresize", "pvresize",

View File

@@ -16,7 +16,7 @@ gpg --expert --full-generate-key
# Generate a new key unattended. # Generate a new key unattended.
# The non-interactive (--batch) option requires a settings file. # The non-interactive (--batch) option requires a settings file.
gpg --generate-key --batch setting.txt gpg --generate-key --batch 'setting.txt'
gpg --generate-key --batch <<-EOF gpg --generate-key --batch <<-EOF
EOF EOF
@@ -65,6 +65,13 @@ gpg --list-keys --keyid-format 'short' 'recipient' \
# Choose one. # Choose one.
brew install --cask 'gpg-suite-no-mail' brew install --cask 'gpg-suite-no-mail'
brew install 'gnupg' brew install 'gnupg'
# Integrate with the SSH agent.
export SSH_AUTH_SOCK="$(gpgconf --list-dirs 'agent-ssh-socket')" && \
gpgconf --launch 'gpg-agent'
# Integrate with Pinentry.
export GPG_TTY="$(tty)"
``` ```
## Encryption ## Encryption
@@ -280,7 +287,7 @@ To get `gpg-agent` to handle requests from SSH, you need to enable its SSH suppo
echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf
``` ```
You can avoid usinig `ssh-add` to load the keys pre-specifying which GPG keys to use in the `~/.gnupg/sshcontrol` file. You can avoid using `ssh-add` to load the keys pre-specifying which GPG keys to use in the `~/.gnupg/sshcontrol` file.
The entries in this file are keygrips—internal identifiers that `gpg-agent` uses to refer to the keys. A keygrip refers to both the public and private key. The entries in this file are keygrips—internal identifiers that `gpg-agent` uses to refer to the keys. A keygrip refers to both the public and private key.
To find the keygrip use `gpg -K --with-keygrip`, then add that line to the `~/.gnupg/sshcontrol` file: To find the keygrip use `gpg -K --with-keygrip`, then add that line to the `~/.gnupg/sshcontrol` file:
@@ -331,20 +338,28 @@ Run `ssh-add -L` to list your public keys and copy them over manually to the rem
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
``` ```
## Further readings
- [Commonly seen problems]
- [Unattended key generation]
## Sources ## Sources
- [Decrypt multiple openpgp files in a directory] - [Decrypt multiple openpgp files in a directory]
- [ask redhat] - [ask redhat]
- [how can i remove the passphrase from a gpg2 private key?] - [how can i remove the passphrase from a gpg2 private key?]
- [Unattended key generation]
- [How to enable SSH access using a GPG key for authentication] - [How to enable SSH access using a GPG key for authentication]
- [gpg failed to sign the data fatal: failed to write commit object] - [gpg failed to sign the data fatal: failed to write commit object]
- [Can you manually add a comment to a PGP public key block and not break it?] - [Can you manually add a comment to a PGP public key block and not break it?]
<!-- project's references -->
[commonly seen problems]: https://www.gnupg.org/documentation/manuals/gnupg/Common-Problems.html
[unattended key generation]: https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html
<!-- external references -->
[ask redhat]: https://access.redhat.com/solutions/2115511 [ask redhat]: https://access.redhat.com/solutions/2115511
[can you manually add a comment to a pgp public key block and not break it?]: https://stackoverflow.com/questions/58696139/can-you-manually-add-a-comment-to-a-pgp-public-key-block-and-not-break-it#58696634 [can you manually add a comment to a pgp public key block and not break it?]: https://stackoverflow.com/questions/58696139/can-you-manually-add-a-comment-to-a-pgp-public-key-block-and-not-break-it#58696634
[decrypt multiple openpgp files in a directory]: https://stackoverflow.com/questions/18769290/decrypt-multiple-openpgp-files-in-a-directory/42431810#42431810 [decrypt multiple openpgp files in a directory]: https://stackoverflow.com/questions/18769290/decrypt-multiple-openpgp-files-in-a-directory/42431810#42431810
[gpg failed to sign the data fatal: failed to write commit object]: https://stackoverflow.com/questions/39494631/gpg-failed-to-sign-the-data-fatal-failed-to-write-commit-object-git-2-10-0#42265848 [gpg failed to sign the data fatal: failed to write commit object]: https://stackoverflow.com/questions/39494631/gpg-failed-to-sign-the-data-fatal-failed-to-write-commit-object-git-2-10-0#42265848
[how can i remove the passphrase from a gpg2 private key?]: https://unix.stackexchange.com/a/550538 [how can i remove the passphrase from a gpg2 private key?]: https://unix.stackexchange.com/a/550538
[how to enable ssh access using a gpg key for authentication]: https://opensource.com/article/19/4/gpg-subkeys-ssh [how to enable ssh access using a gpg key for authentication]: https://opensource.com/article/19/4/gpg-subkeys-ssh
[unattended key generation]: https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html