Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Agent Forwarding section #88

Merged
merged 5 commits into from
Jan 18, 2019
Merged

Improving Agent Forwarding section #88

merged 5 commits into from
Jan 18, 2019

Conversation

Wheest
Copy link
Sponsor Contributor

@Wheest Wheest commented Jan 7, 2019

No description provided.

@Wheest Wheest mentioned this pull request Jan 7, 2019
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link

@cboettig cboettig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding my 2c as a user whose struggled through these directions on various sites, hope these comments are helpful.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved

You should then be able to use your YubiKey as if it were connected to the remote machine.

If you're still having problems, it may be necessary to edit your `gpg-agent.conf` file on both your remote and local machines to add the following information.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any confirmation or reference that this should be done on both? I'm pretty sure that this is not required on the remote machine, and may be misleading (in the sense that it implies you have the gpg-agent running on both platforms, which I think can actually create a problem, some instructions say to kill the remote gpg-agent to make sure it's not running but using the forwarded agent from the socket)...

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved

You should then be able to use your YubiKey as if it were connected to the remote machine.

If you're still having problems, it may be necessary to edit your `gpg-agent.conf` file on both your remote and local machines to add the following information.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration still wasn't enough for me. I had to also do gpg --export-ssh-key > ~/.ssh/id_rsa_yubikey, chown 600 ~/.ssh/id_rsa_yubikey and add IdentityFile ~/.ssh/id_rsa_yubikey before I could ssh using only my yubikey public ssh key. Otherwise it would only work if I also had some other private ssh key. The documentation suggests this isn't necessary, and this guide has suggested that you can use the public key as the IdentityFile, but that always throws a format error, as you might expect.

We may also need to note that the public ssh key (from ssh-add -L needs to be added to remote ~/.known_hosts.

@@ -1356,6 +1356,59 @@ $ ssh-add -E md5 -l

When using the key `pinentry` will be invoked to request the key's passphrase. The passphrase will be cached for up to 10 minutes idle time between uses, to a maximum of 2 hours.

## Remote Machines (agent forwarding)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this to TOC?


- On your remote machine, edit the file `/etc/ssh/sshd_config`, so that option `StreamLocalBindUnlink` is set to `StreamLocalBindUnlink yes`

- _(optional)_If you do not have root access to the remote machine to edit `/etc/ssh/sshd_config`, you will need to remove the socket on the remote machine before forwarding works. For example, `rm /run/user/1000/gnupg/S.gpg-agent`. Further information can be found on the [AgentForwarding GNUPG wiki page](https://wiki.gnupg.org/AgentForwarding).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use **Optional** format.


If you want to use your YubiKey to sign a git commit on a remote machine, or ssh through another layer, then this is possible using "Agent Forwarding". This section should help you setup GPG and SSH agent forwarding.

To do this, you need to already have shell access to your remote machime, and your YubiKey setup on your host machine.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

machine*

@drduh drduh merged commit 200df28 into drduh:master Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants