Dvc: SSH cannot establish connection, push(Windows)

Created on 19 Apr 2020  路  4Comments  路  Source: iterative/dvc

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!

awaiting response

Most helpful comment

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.

All 4 comments

Hi @Sunny-Day200 !

Havent seen that error before. Maybe something is off with your certificates? E.g. https://github.com/paramiko/paramiko/issues/750 seems similar.

good

Closing as stale.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luchoPipe87 picture luchoPipe87  路  69Comments

ChrisHowlin picture ChrisHowlin  路  35Comments

gcoter picture gcoter  路  38Comments

dmpetrov picture dmpetrov  路  35Comments

dmpetrov picture dmpetrov  路  64Comments