Skip to content

Conversation

@pkittenis
Copy link
Contributor

@pkittenis pkittenis commented Oct 20, 2017

Hello,

This PR implements SSH agent forwarding support via libssh2_channel_request_auth_agent. It is based on Mr Hashimoto's patch in mailing list with changes/additions for correctness (primarily, the message was incorrect in the patch).

Example file has been updated to use agent auth and added to cmake list.

Also added integration test tests/test_agent_forward_succeds.c and to cmake list which is passing (needs #218 for cmake build to succeed)

Let me know if anything else needed. Agent forwarding is one of the only "core" features missing in libssh2 so would be good to get it implemented. Thanks for the awesome library.

Resolves #185

@pkittenis pkittenis changed the title Agent fwd Add agent forwarding implementation Oct 20, 2017
@pkittenis
Copy link
Contributor Author

Looks like there are some unrelated errors in some builds

dpkg: error processing package oracle-java9-installer (--configure):

subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:

oracle-java9-installer

@pkittenis
Copy link
Contributor Author

Appveyor failures also look unrelated:

Cannot open include file: 'netinet/in.h': No such file or directory and others including unistd.h which is not available on windows platforms.

@pkittenis
Copy link
Contributor Author

Is anyone available to review this PR?

One thing that has not been tested is the behaviour with a non-OpenSSH server.

@pkittenis pkittenis changed the title Add agent forwarding implementation [Ready for Review] Add agent forwarding implementation Dec 8, 2017
@pkittenis
Copy link
Contributor Author

Latest changes: Support windows builds for agent fwd example. Appveyor tests now pass.

@willco007
Copy link
Member

I've confirmed the patch works great. Small request; could you correct the spelling of succeed in test_agent_forward_succeds.c.

@pkittenis
Copy link
Contributor Author

Hi there,

Thanks for the review! Will make the changes above.

Before merging will need to verify non-openssh compatibility. Have had multiple reports of this code failing to request auth agent on different non-openssh servers, which as above was not tested.

Whether that's because of lack of support on server or issue with code not sure yet, to be confirmed.

@willco007
Copy link
Member

I've been using this in a private fork and it is working with non-openssh servers. There was an issue with the string auth-agent-req@openssh.com being auth-agent-reqatopenssh.com which was breaking compatibility, but it was fixed at some point along the line.

@bagder
Copy link
Member

bagder commented Mar 21, 2019

@willco007 so you're a 👍 for merging this then I take it?

@bagder
Copy link
Member

bagder commented Mar 21, 2019

@pkittenis it'd be cool if you rebased this and pushed again since the new travis builds will find both code style warnings and compiler warnings on the code and example.

@willco007
Copy link
Member

@bagder Yes, working well here.

@pkittenis
Copy link
Contributor Author

Cool, thanks for testing. Will rebase and make changes above.

@pkittenis
Copy link
Contributor Author

Some linting failures, will update.

@willco007
Copy link
Member

@pkittenis Would you mind fixing up the linting errors, it would be great to get this into the 1.9 release.

@pkittenis
Copy link
Contributor Author

Yup, keen to get it in too. Will fix up the linting errors this weekend.

@pkittenis
Copy link
Contributor Author

Have updated for linting changes plus rebased on latest master. Let me know if anything else needed - excuse the delay.

@pkittenis
Copy link
Contributor Author

Ping @willco007 - anything else needed on this?

@willco007 willco007 merged commit 378ffa9 into libssh2:master Aug 12, 2019
svetlyak40wt added a commit to svetlyak40wt/cl-libssh2 that referenced this pull request May 24, 2020
… macro

When `:forward-agent t` argument is passed to `with-ssh-connection` macro,
it will use libssh2_channel_request_auth_agent call before execution the body.

The function [was merged](libssh2/libssh2#219) on 13 August 2019
and should be included into the libssh2 > 1.9.0 which is not released yet.
@pkittenis pkittenis deleted the agent_fwd branch August 17, 2020 14:04
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.

Agent forwarding

3 participants