You are not logged in.

#1 2011-03-26 03:15:21

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

ssh secret key management

Hi,

I'm quite saavy in regards to ssh. I use ssh-agent and I ssh into my mom's and my girlfriend's boxes for doing maintenance.
Suppose that I have an account on those boxes :

* Should I create a new key pair, using the same passphrase?
-OR-
* May I safely scp my secret key to all of my account's .ssh directory? The point would be to only have to add one public key to every authorized_keys file.

Thank you,
Alexandre

P.S. the correct spelling is "savvy"

Last edited by a_neutrino (2011-03-26 16:21:01)

Offline

#2 2011-03-26 09:09:14

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: ssh secret key management

a_neutrino wrote:

I'm quite saavy in regards to ssh

Sure about that tongue  Why would you need your secret key on their machines at all?  That's the whole point of a key pair.  Use the pub key.

Last edited by graysky (2011-03-26 09:11:26)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2011-03-26 16:09:43

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: ssh secret key management

graysky wrote:

Why would you need your secret key on their machines at all?

For example, I have an account on my mother's machine. When I'm at her place, I log in and then ssh in my own box to do some work. I also have virtual machines I play around with. I also intend to buy a used laptop. If I copy the same key pair on all the machines I control, then it's much easier to manage the authorized_keys list and ssh back and forth. I'm just looking for  opinions and recommendations from people who might be in the same situation or who knows better.

Offline

#4 2011-03-26 16:16:32

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: ssh secret key management

Why ssh into the local box instead of just su'ing?

Offline

#5 2011-03-26 16:20:41

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: ssh secret key management

Ramses de Norre wrote:

Why ssh into the local box instead of just su'ing?

Did I say that?

Offline

#6 2011-03-26 17:05:52

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: ssh secret key management

a_neutrino wrote:
Ramses de Norre wrote:

Why ssh into the local box instead of just su'ing?

Did I say that?

Oh, I misread your post smile

Offline

#7 2011-03-26 20:38:53

rowdog
Member
From: East Texas
Registered: 2009-08-19
Posts: 118

Re: ssh secret key management

It's less safe than not putting your key out there but the risks should be minimal as long as you have a good passphrase. If an attacker can get your private key file they can attempt to brute force it but they will still have to defeat DSA (or whatever you use).

Offline

#8 2011-03-26 21:35:08

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: ssh secret key management

That's not totally true in the case where a machine is compromised and the passphrase you use is logged (a way or another). When this happens, there's no need to do a brute force attack on the key.

That said, you have a lot less access control if you are using a single key everywhere. And if the key get compromised, then it's a lot more work to manage then if you had used a single key for each user/box. Also, I don't see how managing a key pair per user/box is more work than copying a private key all over the place. I mean, does it really make sense for users on your virtual machines to be able to login to your mom's computer ?

Offline

#9 2011-03-27 01:14:23

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: ssh secret key management

To summarize:

Re-using the same secret key on all boxes:
pros:
smile adding one line on authorized_keys allows me to log in from all boxes
cons:
sad less secure
sad less flexible access management
sad I get funny reactions in the forum (jk)

Creating a fresh key pair for every box:
pros:
smile ssh-copy-id makes it easy (just discovered that command)
smile fine-grained access management
cons:
hmm all gone


Thank you for your input. Feel free to keep posting if you have further points, I'll keep reading.

hexanol wrote:

does it really make sense for users on your virtual machines to be able to login to your mom's computer ?

No, it doesn't. My virtual machines are for my own use for learning and testing purposes. Anyways, what I really was looking for was to know what people generally did for this specific part of key management. I think what confused me was that one usually wants no more than one secret key when using GnuPG (exept for sub-keys).

Offline

#10 2011-03-29 14:54:49

kang
Member
Registered: 2010-08-07
Posts: 83

Re: ssh secret key management

No you should not put your  private key everywhere, unless you really trust those places.

There are several possibilities, ranging from different keys, smart card with opengpg (which works with SSH), usb stick, to  password access, etc
Many of these are decent security wise and quite convenient but none solves the bare issue:

* if the machine is compromised, someone can access your main workstation, even if it's difficult (smart card), it's possible and not inhuman either.

Yet, there is one security solution exactly made for your problem, introducing (*music*) one-time passwords.

You basically have a list of one time passwords and use the first one to connect, it will work _only once_ then be invalid. Next connection, will use the next password and so on.
You gotta keep the physical list with you, of course. If the computer is compromised they cannot reconnect to your system (they can still use the current connection if they're very skilled, or if you have set a master control ssh socket for example of course - but at this point you probably have noticed and disconnected, and the above is pretty high level)

See man ssh and skeyinit. Use skeyinit to generate your list, make it as long as you need and print it out. Don't copy it digitally as it would void any security of course. Don't use it without a list (aka connect with first pass and generate new for the next time) as it's equally insecure.

Good luck!

Last edited by kang (2011-03-29 14:55:12)

Offline

#11 2011-03-29 17:19:11

Stebalien
Member
Registered: 2010-04-27
Posts: 1,237
Website

Re: ssh secret key management

If you are willing to spend some time and $25 you should look into Yubikeys and yubico-pam.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

Board footer

Powered by FluxBB