4 ms·
"stored the public and private keys in the same directory" People keep harping on that, but as phrased that's not a problem. Wherever you have your private ke
by dllthomas 13y ago
"stored the public and private keys in the same directory"
People keep harping on that, but as phrased that's not a problem. Wherever you have your private key, there's no reason not to also have your public key. The issue is if the private key was living somewhere inappropriate.
Consider that "public and private keys in the same directory" is exactly what happens when you run ssh-keygen on any of the typical setups; failing to then remove the public key is not any kind of a security threat.
- jmillikin 13y agoThe entire purpose of having separate public and private keys is for the private key to be stored in a secure location. That way, when your data-writer is compromised, none of the previously written data is at risk without an additional compromise of the key bastion. If the private key is stored in the same directory, then there no effectively no additional security over simple symmetric-key encryption with a passphrase.
- jdbernard 13y agoYou missed dllthomas's point. The private key should never exist outside a dedicated secure location, the "key bastion" as you say. dllthoms's point was that it doesn't matter if the public key is also present in the secure location. There is no reason the keys have to be stored separately. That is orthogonal to the actual requirement that the private key is private aka. secret. In fact, the public key is public meaning it is assumed that anyone has or could gain access to it. It is purposefully published. So keeping the public key separate is meaningless. Since it is assumed that everyone has access to the public key we must assume that anyone who gains access to the private key has access to both. Ergo there is no reason to not store them both in the secure location.
- jmillikin 13y ago> There is no reason the keys have to be stored > separately. That is orthogonal to the actual requirement > that the private key is private aka. secret. It's effectively required to store the keys separately because if you stored the public key on the key bastion, it would be useless. > In fact, the public key is public meaning it is assumed > that anyone has or could gain access to it. It is > purposefully published. So keeping the private key > separate is meaningless. This makes no sense at all. You're saying that since the public key is public, it's safe to distribute the private key with the public key.
- deleted 13y ago[deleted]
- icebraining 13y agoA public key is a file. It can be stored in more than one place. For example, you can generate both inside the key bastion, and then copy the public key to the public servers, while leaving a copy on the bastion.
- jmillikin 13y agoBut that's not what Linode did. Linode put the private key right next to the public key, where anyone who compromised their web frontend could get at it. If they had kept their private key where it belonged, we wouldn't be having this discussion because their security alert would have said "...and we have verified that no credit card data was accessed".
- dllthomas 13y agoAnd the problem was the private key being on the server running the web front-end, and that's what should be criticized. Presence of a public key does not a webserver make.
- raylu 13y agoHow does storing the public key on the key bastion make it useless?
- jmillikin 13y agoThe public key is used by the webserver to encrypt credit card data. If it was stored in the key bastion, it wouldn't be available to the webserver.
- dllthomas 13y agoOkay, say you have the following scenario: 1) super secure server which handles only the processing of credit cards, handed off to it through a carefully specified API 2) webserver which talks to that server Obviously, the webserver needs the public key. There's no reason to delete the public key from the private server, but not really any reason not to. Now, let's say that, under certain circumstances, system 1 itself needs to add encrypted records. Now you need the key there too. You could 1) generate a different key-pair and track which key touches which, but for records generated by system 1 you're generating a keypair that might as well be a symmetric key, which you've objected to; or 2) you could encrypt those records with a symmetric key, but now you've got additional code paths to audit and maintain; or 3 you could send off a request to an external server but that seems to add more complexity and vulnerability not less. Just using the existing public key to encrypt those records doesn't seem like a bad idea - it's a message to the server in the future from the server now, and messages to someone get encrypted with their public key. Now, you've got a system where you have the public and private key sitting on the same server (and being used on the same server), and if someone does manage to get into that secure server (never impossible) the description I initially complained about would be equally applicable to this setup as to the setup Linode had.
- cma 13y agoWhat he might not realize is that SSH can generate the public key from its "private key" file, so there is literally no good way to have a private key separate from a public key.
- dllthomas 13y agoA private key must be stored in a secure location. Every participant in this conversation agrees on that (I would guess). The presence of the public key in that location doesn't do anything to harm security - if it did, the attacker could just bring a copy. Putting your private key where your public key belongs is bad. Leaving a copy of your public key with your private key where your private key belongs is meaningless.
- jmillikin 13y ago"You are arguing that storing the public and private key in a vault under the ocean is not less secure than just storing the private key there. While that is technically true, it's also missing the point."
- dllthomas 13y agoConsider someone learning their way around this stuff, but not yet well versed. They've heard people on HN talking about how "storing public key and private key together" is bad. Would you recommend they 1) move .ssh/id_dsa.pub to a different directory, or 2) make sure .ssh isn't world-readable? The issue was insecure storage of the private key - presence or absence of the public key is entirely irrelevant.
- jmillikin 13y agoI'd recommend they not store the private key next to the public key; that is, they shouldn't do "scp .ssh/id_dsa* remoteserver:" It doesn't matter whether there's something stored with the private key, both because that location should be secure and because the private key can used to recover the public key.
- dllthomas 13y agoIs the issue that you somehow believe "stored with" is not a commutative relationship? Edited to add: "It doesn't matter whether there's something stored with the private key, both because that location should be secure and because the private key can used to recover the public key." Right, it doesn't matter in what should be the overwhelming majority of cases where "the public and private key are stored in the same directory" so it's a piss-poor test for whether things are obviously being done horribly wrong.
- aioprisan 13y agoYou must be kidding. This is encryption 101. The private key is supposed to be moved to a secure location after key generation.
- tbrownaw 13y agoEr, what? I thought the keypair was supposed to be generated in a secure location (such as your 0700 mode ~/.ssh directory), and then only the public half ever leaves.
- tailrecursion 13y agotwbrownaw is exactly right. If the private key is already in a secure location then there is no need to move it to a secure location. So, any report that the public keys were stored with the private keys means nothing by itself.
- jmillikin 13y agoYou are arguing that storing the public and private key in a vault under the ocean is not less secure than just storing the private key there. While that is technically true, it's also missing the point.
- icebraining 13y agoHow is it missing the point? It tells us that having "both keys in one directory" is, by itself, no evidence of insecurity by Linode.
- deleted 13y ago[deleted]
- dllthomas 13y agoAs others have said: a private key should never be in an insecure location, or it's no longer secure. You have to generate it in a secure location, and since you're generating the key-pair, you'll have both your public and private keys in the same (secure) location until you remove the public key, which I don't see any strong reason to do.
- marshray 13y agoRight. The private key file format typically contains everything needed to regenerate the public key (at least the crypto parameters anyway).
- reeses 13y agoAnd if you have the private key, you can generate the public key! You should never store the private key anywhere!
- dllthomas 13y agoNot even the ram of the crypto module doing the work!