chore(kb/gpg+ssh): improve article sections and examples about gnupg integration with ssh

This commit is contained in:
Michele Cereda
2024-02-17 17:18:02 +01:00
parent adc1a23ba8
commit dbf6d61852
3 changed files with 23 additions and 2 deletions

View File

@@ -379,10 +379,11 @@ Now tell SSH how to access `gpg-agent` by setting the value of the `SSH_AUTH_SOC
Alternatively, and for a more permanent solution, set the option in the `.ssh/config` file:
```sh
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs 'agent-ssh-socket')
# alternative
echo "IdentityAgent $(gpgconf --list-dirs agent-ssh-socket)" >> ~'/.ssh/config'
echo "\nIdentityAgent $(gpgconf --list-dirs 'agent-ssh-socket')" \
| tee -a ~'/.ssh/config'
```
Now you can launch the gpg agent:

View File

@@ -8,6 +8,7 @@
1. [Client configuration](#client-configuration)
1. [Append domains to a hostname before attempting to check if they exist](#append-domains-to-a-hostname-before-attempting-to-check-if-they-exist)
1. [Optimize connection handling](#optimize-connection-handling)
1. [Integrate with GnuPG](#integrate-with-gnupg)
1. [Server configuration](#server-configuration)
1. [Change port](#change-port)
1. [Disable password authentication](#disable-password-authentication)
@@ -229,6 +230,22 @@ ControlPath ~/.ssh/control-%C
ControlPersist 30s
```
### Integrate with GnuPG
```sh
# In BASH and alike.
export SSH_AUTH_SOCK=$(gpgconf --list-dirs 'agent-ssh-socket')
# In FISH.
set -x 'SSH_AUTH_SOCK' (gpgconf --list-dirs 'agent-ssh-socket')
```
```ssh-config
# In ~/.ssh/config.
# Value is from `gpgconf --list-dirs 'agent-ssh-socket'`.
IdentityAgent ~/.gnupg/S.gpg-agent.ssh
```
## Server configuration
Config file defaults to `/etc/ssh/sshd_config`.<br/>