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

SSH cannot establish connection, push(Windows) #3652

Closed
Sunny-Day200 opened this issue Apr 19, 2020 · 8 comments
Closed

SSH cannot establish connection, push(Windows) #3652

Sunny-Day200 opened this issue Apr 19, 2020 · 8 comments
Labels
awaiting response we are waiting for your reply, please respond! :)

Comments

@Sunny-Day200
Copy link

dvc-0.92.0 windows.exe

$ dvc push left
Unknown exception: q must be exactly 160, 224, or 256 bits long
Unknown exception: q must be exactly 160, 224, or 256 bits long
Unknown exception: q must be exactly 160, 224, or 256 bits long
Traceback (most recent call last):
File "site-packages\paramiko\transport.py", line 2109, in run
File "site-packages\paramiko\auth_handler.py", line 298, in _parse_service_accept
File "site-packages\paramiko\dsskey.py", line 116, in sign_ssh_data
Unknown exception: q must be exactly 160, 224, or 256 bits long
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 243, in private_key
Traceback (most recent call last):
File "site-packages\cryptography\hazmat\backends\openssl\backend.py", line 657, in load_dsa_private_numbers
Traceback (most recent call last):
File "site-packages\paramiko\transport.py", line 2109, in run
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 142, in _check_dsa_private_numbers
File "site-packages\paramiko\transport.py", line 2109, in run
File "site-packages\paramiko\auth_handler.py", line 298, in _parse_service_accept
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 134, in _check_dsa_parameters
File "site-packages\paramiko\auth_handler.py", line 298, in _parse_service_accept
Traceback (most recent call last):
File "site-packages\paramiko\dsskey.py", line 116, in sign_ssh_data
ValueError: q must be exactly 160, 224, or 256 bits long
File "site-packages\paramiko\dsskey.py", line 116, in sign_ssh_data
File "site-packages\paramiko\transport.py", line 2109, in run
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 243, in private_key

File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 243, in private_key
File "site-packages\paramiko\auth_handler.py", line 298, in _parse_service_accept
File "site-packages\cryptography\hazmat\backends\openssl\backend.py", line 657, in load_dsa_private_numbers
File "site-packages\cryptography\hazmat\backends\openssl\backend.py", line 657, in load_dsa_private_numbers
File "site-packages\paramiko\dsskey.py", line 116, in sign_ssh_data
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 142, in _check_dsa_private_numbers
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 142, in _check_dsa_private_numbers
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 243, in private_key
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 134, in _check_dsa_parameters
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 134, in _check_dsa_parameters
File "site-packages\cryptography\hazmat\backends\openssl\backend.py", line 657, in load_dsa_private_numbers
ValueError: q must be exactly 160, 224, or 256 bits long
ValueError: q must be exactly 160, 224, or 256 bits long
File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 142, in _check_dsa_private_numbers

File "site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 134, in _check_dsa_parameters
ValueError: q must be exactly 160, 224, or 256 bits long

ERROR: unexpected error - q must be exactly 160, 224, or 256 bits long

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!

@triage-new-issues triage-new-issues bot added the triage Needs to be triaged label Apr 19, 2020
@efiop
Copy link
Contributor

efiop commented Apr 20, 2020

Hi @Sunny-Day200 !

Havent seen that error before. Maybe something is off with your certificates? E.g. paramiko/paramiko#750 seems similar.

@efiop efiop added the awaiting response we are waiting for your reply, please respond! :) label Apr 20, 2020
@triage-new-issues triage-new-issues bot removed the triage Needs to be triaged label Apr 20, 2020
@emm93

This comment has been minimized.

@efiop
Copy link
Contributor

efiop commented May 20, 2020

Closing as stale.

@efiop efiop closed this as completed May 20, 2020
@jadore801120
Copy link

Hi all,
I also meet the q must be exactly 160, 224, or 256 bits long issue.
I specified the ssh username and password to let dvc access my files on remote server, and bumped into this issue.

It was quite confusing.
It looked like it was break on the connection/auth part, so I decided to follow the related call stack.
At last, I printed the input parameters of self._auth used in client.py.

And I found out that although I already specified the user/pwd, it still collected a private key file (key_filenames) for building up ssh connection, which was not necessary.

Turns out, I had my .ssh/config set up with using a specified private key to all the hosts like below.

Host *
	PubkeyAcceptedKeyTypes=+ssh-dss
	IdentityFile ~/.ssh/id_rsa_foobar

And that's why the self._auth used it during auth and failed.
After I removed this setting in ssh configuration, everything works.

It is a dumb situation. Write it down just in case if there is someone has the same problem.

@tomreitsma
Copy link

This solved it for me, too. Thanks for the update!

Though honestly, I don't like removing it there, as there was a reason I set up my ssh config like that. Seems like there should be some sort of fallback mechanism to this.

@efiop
Copy link
Contributor

efiop commented Mar 3, 2021

@tomasfarias Unfortunately there is not much we can do with paramiko right now 🙁 We are considering diversifying our ssh backends in the future to allow using real ssh or libssh as an alternative to paramiko.

@jofa974
Copy link

jofa974 commented Jun 1, 2021

This worked for me as well, thanks @jadore801120 !

@milenovdaniel
Copy link

milenovdaniel commented Apr 13, 2022

Hi I have experiencing the same inconvenience even on the latest paramiko version.
To get it corrected I have just reordered the id_rsa keys in .ssh/config file:
1. IdentityFile ~/.ssh/id_rsa 2. IdentityFile ~/.ssh/id_rsa_old
In this way the paramiko gets only the first position, and it seems to do not consider the rest.
I hope this to be in help
P.S. Although the post is relating (Windows) users - the same is applicable for UNIX/LINUX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response we are waiting for your reply, please respond! :)
Projects
None yet
Development

No branches or pull requests

7 participants