News for hackers. Stuff that matters.
Re:How Not to copy your SSH private key to your servers by th0ma5 on Monday April 19, 2010 @11:15AM (#1276874)
if you want to set up seamless logins of an account to anywhere from anywhere, you need to copy around both because any node could either be on the client or server side of the challenge and response.
Re:How Not to copy your SSH private key to your servers by axod on Monday April 19, 2010 @11:19AM (#1276881)
Seems like that's a serious edge case. Most times (IMHO) you'd be going one direction.

And if you do require both directions, you should generate separate keys on each host and just exchange the public ones.

Re:How Not to copy your SSH private key to your servers by ax0n on Monday April 19, 2010 @12:31PM (#1277086)
You're absolutely correct, but it's actually pretty common to distribute that public key all over hell and then start shuffling the private one around between the ones you find yourself ssh-ing off of. At my last job, this practice among wayward sysadmins caused me a lot of gnashing of teeth.
Re:How Not to copy your SSH private key to your servers by dedward on Monday April 19, 2010 @07:20PM (#1278142)
Wrong move though - really there should be one key per machine - and then ssh-agent set up properly to take care of the intermediate machines so you can bounce around. Using the same private key on multiple machines is just asking for trouble when you need to revoke something...
Re:How Not to copy your SSH private key to your servers by ax0n on Tuesday April 20, 2010 @12:33AM (#1278640)
Oh, believe me, I know. That's why I said it caused me much gnashing of teeth. SSH, particularly OpenSSH, is such a thing of beauty. It's a shame most sysads that I've dealt with abuse it like it's rsh and telnet.
Re:How Not to copy your SSH private key to your servers by fragmede on Monday April 19, 2010 @01:54PM (#1277376)
I'd agree that uni-directional transfer is an edge case when you have only one server.

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.)

Re:How Not to copy your SSH private key to your servers by xilun666 on Monday April 19, 2010 @02:31PM (#1277480)
Doing so, you expose yourself in propagating penetration from a compromised server to a previously secure one.
Re:How Not to copy your SSH private key to your servers by frodwith on Monday April 19, 2010 @11:21AM (#1276888)
In that case, use an ssh-agent and agent forwarding. Then you only need your private key on the box you're actually sitting at.
Re:How Not to copy your SSH private key to your servers by mbreese on Monday April 19, 2010 @11:26AM (#1276902)
Unless you want to use headless logins...

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.

Re:How Not to copy your SSH private key to your servers by jsn on Monday April 19, 2010 @12:33PM (#1277093)
For obvious reasons, you're much better off generating a new keypair for that (not reusing any existing private keys).
Re:How Not to copy your SSH private key to your servers by barrkel on Monday April 19, 2010 @12:25PM (#1277068)
Automating ssh, however, is surprisingly painful.
Re:How Not to copy your SSH private key to your servers by rcoder on Monday April 19, 2010 @07:53PM (#1278199)
This is why Net::SSH and Paramiko are so wonderful. Using the OpenSSH binaries through a pair of pipes is certainly a pain, but if you grok the protocol, either of those libraries can make it really easy to wire up secure pipes between machines.
Re:How Not to copy your SSH private key to your servers by danieldon on Monday April 19, 2010 @02:20PM (#1277445)
Why wouldn't you just generate a new key pair?
Re:How Not to copy your SSH private key to your servers by wizard_2 on Monday April 19, 2010 @12:37PM (#1277108)
With python you have Fabric and paramiko which makes automating ssh very strait forward.
Re:How Not to copy your SSH private key to your servers by arethuza on Monday April 19, 2010 @11:28AM (#1276905)
Isn't that a pretty broken design? Copying private keys around sounds like a really bad idea.
Re:How Not to copy your SSH private key to your servers by avolkov on Monday April 19, 2010 @04:08PM (#1277696)
Wow, wait, I don't get it. You can copy from anywhere to anywhere with just one set of public private key.

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.

Re:How Not to copy your SSH private key to your servers by lsc on Monday April 19, 2010 @08:24PM (#1278244)
Ugh. don't do that. if you /must/ have a system like that (and it's never a great idea) keep your private keys on one box, and enable agent forwarding. It's not as good as just enabling the one-way ssh, but it's not nearly as bad as scattering your keys.

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.

Re:How Not to copy your SSH private key to your servers by danieldon on Monday April 19, 2010 @02:05PM (#1277407)
I feel like I'm missing something here. Why would someone copy around a single private key instead of generating a new key pair for each user@host?
Re:How Not to copy your SSH private key to your servers by ars on Monday April 19, 2010 @03:43PM (#1277642)
You don't need to generate a new keypair - just copy your (single) public key to the authorized_keys file on each machine.

I can't think of any reason at all to copy the private key though.

Re:How Not to copy your SSH private key to your servers by dedward on Monday April 19, 2010 @07:23PM (#1278148)
No that's backwards - the reason is laziness.

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.

Re:How Not to copy your SSH private key to your servers by lenni on Monday April 19, 2010 @11:18AM (#1276880)
So, you're saying that people paste their key online so they don't have to carry it around on a USB stick? Wow.
Re:How Not to copy your SSH private key to your servers by Legion on Monday April 19, 2010 @11:38AM (#1276924)
He didn't say it was the right way to do it. He didn't even say what he was describing was a good idea. He just offered an answer to the question, "Why would people copy a private key around?". Obviously, people are doing it for some reason, misguided as the reason may be.
Re:How Not to copy your SSH private key to your servers by lenni on Monday April 19, 2010 @02:27PM (#1277466)
That's what I meant. I simply could't believe that someone would do this.
Re:How Not to copy your SSH private key to your servers by bluesmoon on Monday April 19, 2010 @02:48PM (#1277513)
ssh-agent?
Re:How Not to copy your SSH private key to your servers by philf on Monday April 19, 2010 @02:41PM (#1277500)
Or create a pair for each...