Skip to content

SHA2 with ssh agent - #1925

Closed
Sandarr95 wants to merge 8 commits into
paramiko:mainfrom
Sandarr95:sha2-with-ssh-agent
Closed

Sandarr95 wants to merge 8 commits into
paramiko:mainfrom
Sandarr95:sha2-with-ssh-agent

Conversation

@Sandarr95

@Sandarr95 Sandarr95 commented Nov 8, 2021 •

Copy link
Copy Markdown

I've been trying to get an ssh connection working with this project to my server. At first I thought just the rsa-sha2 algorithms were missing. Trying out #1643 still did not work as I was using an ssh-agent.

This PR will dynamically assign the SHA algorithm as specified in preferred keys. It won't effectively change anything until the _preferred_keys include those rsa-sha2 algorithms (defined in #1643).
While opening this PR I also noticed #1644 which seems to be a partial implementation that just changes the flag, might be good to consider it for ongoing refinement.

This is the first time I'm doing python library programming and contributing to a python project. I know very little about pip, running tests and probably a bunch of other stuff, so don't hesitate to give me feedback :).

Comment thread paramiko/agent.py
msg.add_string(self.blob)
msg.add_string(data)
msg.add_int(0)
msg.add_int(SHA_MAP[self.name])

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

https://tools.ietf.org/id/draft-miller-ssh-agent-01.html#sigflagnum
choose sha strategy based on name; sha1 = 0, sha256 = 2, sha512 = 4, bit 1 is reserved

Comment thread paramiko/agent.py Outdated
Comment on lines +409 to +410
if(self.name in rsa_prefs):
self.name = rsa_prefs[0]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not sure how I should negotiate the key. This is (I think) only taking the clients' preference into consideration, and will fail if the client prefers SHA2 and the server does not support SHA2.

https://datatracker.ietf.org/doc/html/draft-ietf-curdle-rsa-sha2-12#section-3.3

@Sandarr95
Sandarr95 marked this pull request as ready for review November 9, 2021 15:14
@bitprophet

Copy link
Copy Markdown
Member

See #1643 (though I ended up writing my own branch for this). Releasing soon. Thanks!

@bitprophet bitprophet closed this Dec 23, 2021
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.

2 participants