Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'am using Putty on windows with key-based authentication to access some of mine servers.

It works totally fine with ~3700-bit key, but with ~17000-bit key it thinks for like 20 seconds on client-side and then just says "Access denied" and asks for a password.

Is there any key length limit or timeout in OpenSSH for key-based authentication?

I understand that using such large keys have not much practical sence, especially when looking at these 20 seconds of calculation, just trying to solve any problems I face :-)...

share|improve this question

3 Answers 3

up vote 5 down vote accepted

At one point I looked into the source of OpenSSL for Diffie-Hellman keys, and found there was an "arbitrary" 10K limit on the size of DH keys. I changed the source for a test, and found that worked. I wrote a bug to the authors, and they replied back that it was design intent to prevent DoS by using massive keys.

Wouldn't surprise me to see something similar in OpenSSH.

share|improve this answer

There is no maximum key size or timeout defined in the protocol (or at least none that you'd be hitting), but an implementation might not support such long keys. A 20-second processing time with the private key doesn't sound high for a 17kbit RSA key. Then the server might not want to spend too much computing power on an unauthenticated user: refusing very large keys is a protection against DoS attacks.

Currently 2048 bits is considered reasonable for an RSA key; 4096 bits is higher than necessary but usually supported; beyond this you shouldn't be surprised if some programs to reject the key.

share|improve this answer
    
This protection looks reasonable. Is it tunable or hardcoded in the sourcecode? –  BarsMonster Jul 14 '10 at 11:40
    
There's no option for this in the manual, so any limit must be in the source code. That said, I don't know if there actually is a protection, I just meant that it would be reasonable to have one. I suspect that AndreasM's answer is closer to the mark. –  Gilles Jul 14 '10 at 16:17

The openssh Server has a LoginGraceTime setting. From the man page:

The server disconnects after this time if the user has not suc-
cessfully logged in.  If the value is 0, there is no time limit.
The default is 120 seconds.

This could be a limit that you are hitting if it is set to 20 seconds.

Wild guess: It could also be that putty itself has this limit, thinking that if the client side processing of the public key authentication takes that long, something is wrong.

share|improve this answer
    
I've thought the same, and set LoginGraceTime 1200 Well, error message is in the console, so I doubt it's something in Putty... –  BarsMonster Jul 14 '10 at 12:41
1  
Check the server logs. With a key size like this I get: RSA_public_decrypt failed: error:04067069:lib(4):func(103):reason(105). (because of the key size apparently.) I'll try a 2^n key. –  AndreasM Jul 14 '10 at 14:12
    
16384 bits seems to work. For results with 32kbits see hermann-uwe.de/blog/… :) –  AndreasM Jul 14 '10 at 14:22
    
You deadly right: Found thid: sshd[1014]: error: RSA_public_decrypt failed: error:04067069:lib(4):func(103):reason(105) So this must be a bug in sshd/OpenSSL :-) –  BarsMonster Jul 15 '10 at 12:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.