Using a public/private key pair is fairly convenient for logging in to frequented hosts, but if I'm using a key pair with no password, is that any safer (or less safe) than a password? The security around my private key file is paramount, but say my magical private key file was just a list of passwords to various hosts, is there a difference?
|
|
My answer is that using public key pairs is a much wiser thing to do than using passwords or lists of passwords. I will focus on things that are not widely known about different forms of SSH authentication, and I see no other answers mentioning them. First of all, you must understand that user authentication is a different and separate process than the establishment of the secure channel. In laymans terms what this means is that first, the public key of the server is used (if accepted!) to construct the secure SSH channel, by enabling the negotiation of a symmetric key which will be used to protect the remaining session, enable channel confidentiality, integrity protection and server authentication. After the channel is functional and secure, authentication of the user takes place. The two usual ways of doing that is by using a password or a public key pair. The password based authentication works as you can imagine: The client sends his password over the secure channel, the server verifies that this is indeed the password of the specific user and allows access. In the public key case, we have a very different situation. In this case, the server has the public key of the user stored. What happens next is that the server creates a random value (nonce), encrypts it with the public key and sends it to the user. If the user is who is supposed to be, he can decrypt the challenge and send it back to the server, who then confirms the identity of the user. It is the classic challenge-response model. As you can imagine, in the first case the password is actually sent to the server, in the second your private key never leaves the client. In the imaginary scenario that someone intercepts the SSL traffic, and is able to decrypt it (using a compromised server private key, or if you accept a wrong public key when connecting to the server) - your private details will never fall in the hand of the attacker. There are other advantages of using a public key pair: The private key should not be stored in cleartext in your client pc as you suggest. This of course leaves the private key file open to compromise. It should be stored encrypted, and need you to provide a usually long passphrase to decrypt it each time it is used. Of course this means that you will have to provide the long passphrase each time you connect to a server, to unlock your private key - There are ways around that. You can increase the usuability of the system by using an authentication agent: This is a piece of software that unlocks your keys for the current session, when you log in to gnome for example or when you first ssh into your client, so you can just type 'ssh remote-system-ip' and log in, without providing a passphrase, and do that multiple times until you log out of your session. So, to sum up, using public key pairs offers considerably more protection than using passwords or password lists which can be captured if the client or the secure session is compromised. In the case of not using a passphrase (which shouldn't happen), still public key pairs offer protection against compromised sessions. |
|||||||||||
|
|
Compared to a stored list of (long and random) passwords, a stored SSH private key offers the same security: things are safe as long as your private file remains private. The private key, however, is much more convenient, both practically (right now, the SSH clients support it out-of-the-box, contrary to a custom file of passwords which you must use with some manual copy&paste) and theoretically (you can reuse the same key for each host you want to connect to, whereas a list of passwords will grow linearly with the number of contacted hosts, unless you reuse the same password for multiple hosts, which is bad). |
|||||
|
|
It depends on which threats you consider. The main point of public/private key authentication is not to let your secret out, even to the party you're authenticating to. For this reason, using keys is better, as you never send your secret outsite your machine. However, if the threat you consider is local, and if you don't protect your private keys with a password, storing a list of passwords in clear is about the same storing the private keys without protection. For this reason, it's useful to protect your private keys with a password and use tools such as ssh-agent (for convenience). On OSX, this can also be integrated with the KeyChain, so that you may not even need to unlock the private key (at the application level, only at the security daemon level) to be able to use it via SSH (essentially, the KeyChain and security daemon take care of ssh-agent). |
|||||||
|
|
The main difference between using a private key without password and using plain text password for SSH authorization is authorizing by something you have (your private key) or by something you know (your memorized password). They are different breed, but it's hard to say that one is ultimately better or more secure. Authorizing by something you have is normally harder for the attacker to replicate out of the the blue - it's easier to brute-force/guess your simpler password than to replicate your key. But it has a major drawback - now keeping your private key really secret becomes paramount. If you use something only you know (memorized password), it should be easier to keep it that way (at least theoretically). But if you have to memorize it, then you probably use something not that complex. So it's for you to decide, what's more probable - your strong private key being stolen or not so strong password guessed (or acquired in some other manner). There's one exception here - if you mean in your question that you'll be storing really long, complex and random passwords in your secret file instead of using a private key, then there's probably |
|||||
|
|
Song, Wagner, and Tian have shown that it is possible to speed up brute-force password searches roughly 50 times by using timing information from The attack makes two assumptions:
Public keys are not only more convenient, but more secure against certain threats. |
|||
|
|
|
If you are using "software" keys (meaning keys stored in your .ssh directory or equivalent) you are basically on the same level as storing passwords. OpenSSH now has almost decent PKCS#11 support, same is available in KiTTY(a PuTTY fork) thus for really making use of pubkey authentication, go for a smart card. Then there is real difference from passwords. A software keyfile, protected by a password, can be replicated the same way as a plain password, whereas a smart card can not. |
|||||||||||||
|