How Not to copy your SSH private key to your servers
google.com
google.com
Generate the public/private pair on the client machine and the public key is the one you put on other machines to SSH into them.
And if you do require both directions, you should generate separate keys on each host and just exchange the public ones.
Unfortunately for network security, that seems less and less the case these days. I definitely find myself ssh'd into two remote systems relatively often and have a need to copy files between the two. (Swapping arguments to scp is not good enough.)
An example would be a cron job that copies files to a backup server via scp or rsync over ssh. However, this should also be accompanied by host filters in the authorized_keys file to restrict access to specific hosts.
Using pastebin for this is wrong on so many levels.
for example, copy file from local machine:
scp some_file.tar.gz alex@remote_ip:~/
now copy the same file from a remote to the local machine:
scp alex@remote_ip:~/some_file.tar.gz ~/
But seamless logins form anywhere to anywhere in the way you described seems like a bad idea, unless you are willing to implement kerberos, ldap and nfs4, in this way you can just log in into a client machine using your existing credentials (see PAM) and if you have your home directory property mounted you can have public/private keypair on that machine. But this is a lot of work.
Why does everyone seem to think it's okay to build a system where any one compromised box can compromise the rest of the system? this 'jelly doughnut security' is really popular among the PHB types, because it's easy, but it just seems really, really dangerous.
I can't think of any reason at all to copy the private key though.
Sysadmin has two worksations - say a laptop and a desktop. He wants to SSH into all his remote boxen from either. The default reaction might be to just copy his already-authorized private key to his other machine just for ease of use - the proper solution would be to generate a new keypair on the new machine and then copy it to the required remote machines as well, so either can be revoked and tracked separately.
In the same vein: Buffer overflows should never be tolerated, even if they were un-exploitable in some cases because of lucky circumstances.
You should rekey your network on a regular schedule at least as often as you change your passwords.
So, never? http://www.boston.com/bostonglobe/ideas/articles/2010/04/11/...
But you should write them down and keep them in a secure location. Just like you keep a backup of your private keys...
[1] http://arstechnica.com/security/news/2007/09/security-expert... [2] http://pastebin.com/f4b10cc33
Another fun one to find Cisco VPN configuration files, many of which have an encoded (reversible) password within: http://www.google.com/search?q=filetype%3Apcf+Main+Descripti...
headdesk
(OO and compiler/language implementation are two more!)
This would be a good topic for interviews!
Nice find and nice tip, I must say. :)
Security (both physical and infosec) is one of my biggest passions, and I've been writing about it for plenty longer than a decade. Granted, for the first several years, it was a pile of .txt files in an "e-Zine" but still...
If you're serious about security, scp is not secure (open to man-in-the-middle attacks) until you've transferred keys via some other channel or use a PKI that you actually pay attention to.
But that is being ultra-paranoid in my book.
2. If you are setting up servers, you may want to transfer the server public (not private) key to client, but what's the point? Ssh/scp will do it for you anyway, and you already know the remote end public key fingerprint anyway -- since you are setting it up.
So, no, "ultra-paranoid" doesn't explain the pastes in question. "Ultra-ignorant" does :)
Hopefully Linode doesn't have any internal gremlins.
Of course, the weak point there is SSL where the keys themselves are transmitted, but it did well to quell my paranoia.
http://www.google.com/search?hl=en&safe=off&q=site:g...
only a few actual hits in there.