You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ansible: p must be exactly 1024, 2048, or 3072 bits long #909
Running ansible 2.2, I'm unable to connect to any of my raspberry pi hosts from OSX. Connection via ssh is fine:
➜ vz git:(entity-init) ✗ ansible keller -m shell -a "echo foo"
paramiko: The authenticity of host '192.168.0.48' can't be established.
The ssh-rsa key fingerprint is xxxxx.
Are you sure you want to continue connecting (yes/no)?
yes
No handlers could be found for logger "paramiko.transport"
keller | UNREACHABLE! => {
"changed": false,
"msg": "p must be exactly 1024, 2048, or 3072 bits long",
"unreachable": true
}
known_hosts shows all keys as ecdsa-sha2-nistp256.
#899 is why is "authenticity ... can't be established" even though the ecdsa host key is in known_hosts. but it doesn't explain "p must be exactly ...". Are you by any chance using a 768 bit or 4096 bit rsa authentication key (for password-less ssh)?
You would have to generate a new ssh key. It's unlikely that you have a valid ssh key which has this problem; it's more likely that your ssh key is being misinterpreted as the wrong type of key (and then the bytes in the key don't make sense). This patch for paramiko may fix it: #1606
Activity
andig commentedon Feb 23, 2017
Might this be related to #899? Not being a crypto guy- is there anything I could do as workaround?
ploxiln commentedon Feb 23, 2017
#899 is why is "authenticity ... can't be established" even though the ecdsa host key is in known_hosts. but it doesn't explain "p must be exactly ...". Are you by any chance using a 768 bit or 4096 bit rsa authentication key (for password-less ssh)?
andig commentedon Feb 23, 2017
I'm guessing how to answer:
Don't ask me why/where those 1023 bits are coming from...
ploxiln commentedon Feb 23, 2017
Yup, 1023-bit dsa keys exist, but they're not common, so not everything supports them. Your problem is from cryptography (dependency of paramiko 2.x):
https://github.com/pyca/cryptography/blob/master/src/cryptography/hazmat/primitives/asymmetric/dsa.py#L132
I suggest you switch to an RSA-2048 key (or RSA-3072).
andig commentedon Feb 23, 2017
Thanks for letting me know- will make the switch then 👍🏻
davehodg commentedon Apr 2, 2020
OK, so how do I set q?
I've got ansible failing to connect to a server with:
"msg": "q must be exactly 160, 224, or 256 bits long",ploxiln commentedon Apr 2, 2020
You would have to generate a new ssh key. It's unlikely that you have a valid ssh key which has this problem; it's more likely that your ssh key is being misinterpreted as the wrong type of key (and then the bytes in the key don't make sense). This patch for paramiko may fix it: #1606