From 500d4433a848709772f66e82732bc4df124d04b4 Mon Sep 17 00:00:00 2001 From: ahriman Date: Sun, 6 Jan 2019 06:05:17 +0000 Subject: added wiki page on using gnupg for ssh authentication --- table.connusers | 3 ++- table.weekconns | 2 +- wiki.php | 1 + wikipages/gpg-for-ssh-auth.wiki | 28 ++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 wikipages/gpg-for-ssh-auth.wiki diff --git a/table.connusers b/table.connusers index 9c212bd..52d934f 100644 --- a/table.connusers +++ b/table.connusers @@ -1,5 +1,6 @@ diff --git a/table.weekconns b/table.weekconns index a5c750f..b5045cc 100644 --- a/table.weekconns +++ b/table.weekconns @@ -1 +1 @@ -27 \ No newline at end of file +21 \ No newline at end of file diff --git a/wiki.php b/wiki.php index b7eed31..05cf7c7 100644 --- a/wiki.php +++ b/wiki.php @@ -33,6 +33,7 @@   BCHS Intro Guide
  Dungeon Crawl Stone Soup
  Finger
+   GnuPG for SSH Authentication
  IRC
  UNIX ProTips
+ +

Using GPG for SSH Authentication

+ +

It's a fairly simply process to have gpg-agent handle your SSH authentication. To start off, you'll need to have a private GnuPG key generated with an appropriate subkey for authentication. Once that's taken care of, open up ~/.gnupg/gpg-agent.conf

+ +
$ cat ~/.gnupg/gpg-agent.conf
+enable-ssh-support
+default-cache-ttl 60
+max-cache-ttl 120
+ +

Now you'll need to append the following to ~/.bashrc, or the appropriate rc file for your shell

+ +
$ cat ~/.bashrc
+export GPG_TTY="$(tty)"
+export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
+gpg-connect-agent updatestartuptty /bye
+ +

Once that's done, you'll need to let gpg-agent know which GnuPG subkey to use for SSH authentication. Run gpg --with-keygrip -k <email> and copy the keygrip associated with the subkey you've generated specifically for authentication only. Now, open ~/.gnupg/sshcontrol and paste the keygrip into that file. Verify that the correct keygrip has been selected by running ssh-add -L and comparing it against the output of gpg +--export-ssh-key <keyid>. If it's correct, kill off gpg-agent with killall gpg-agent, then open up a new terminal and attempt to connect to a server!

+ +
+ +Back to Wiki -- cgit 1.4.1-2-gfad0