OpenSSH Management - Understanding RSA/DSA Authent 95
Paul writes "I found this useful article, over at developerWorks Linux Zone that clearly explains RSA/DSA authentication. It covers what you need to get passwordless authentication implemented using RSA and DSA authentication protocols."
Re:Decrypt This (Score:1)
Re:lucky for you foreigners ... (Score:2)
OpenBSD and OpenSSH are both all-American products. Canada is, after all, a renegade 51st State we just have not bothered to annex yet.
Re:passwordless authentication (Score:2)
There are ways of combatting this, but I haven't read the SSH protocol docs in detail, so I can't tell you what they do to deal with it. I can tell you that a Server fingerprinting mechanism exists which allows you to positively identify the server you are talking to if you already know what the fingerprint is supposed to be. Most SSH clients cache the fingerprint from each server you access the first time you connect. If it changes, you are warned. Of course, if the Man in the Middle attack occurs the first time you connect, you are screwed.
I also can tell you that the answer to the last question is "No, so far." The magic of the RSA algorithm is that you can give an attacker your public key (from which he can generate as many encrypted/unencrypted challenge pairs as he likes), and so far no one has a good (i.e. "fast") way to get the private key.
Re:[OT] unsigned long long long ... long long int (Score:2)
> (as in GNU) C or C++ math libraries for handling
> massive bit-widths like you get in RSA keys?
You want gmp, the GNU Multiprecision Library. The latest release is 3.1.1, available from ftp://ftp.gnu.org/gnu/gmp/ .
Re:passwordless authentication (Score:1)
Re:Convenience or security? (Score:2)
The convenience actually comes in the next part (or when you type "man ssh-agent"): you can have a local program remember your keys after you give it the passphrase once, and then you can authenticate multiple connections with a single use of the passphrase. Really nice for those cvs over ssh sessions (add, add, update, update, commit).
Also, it means you can have the authentication even closer than the local machine (an even more local machine, smart card, etc) without the remote machine having to know or do anything different.
Re:I wonder if /. editors read the links... (Score:1)
Cygwin has all the SSH utilities, as well as the daemon. And if someone can't figure out how to invoke them from Cygwin, a shell script link could easily be put on their desktop.
That being said, we also use Cygwin to tie together the windows and nix machines.
Re:Question (Score:1)
You're missing his point. RSA can be used for encryption (and therefore key exchange), but DSA is signature only and can't (on its own).
Looking at an ssl man page, the answer is in version 2 of the protocol they are both used for signature only because the actual session key is derived using Diffie-Hellman.
--
One thing worries me (Score:2)
This seems to me to say that when our client decrypts the servers random-number challenge, it sends back the decrypted random number in the clear. This is fine as long as the algorithm used is never compromised, but if it is, wouldn't the cleartext random number help an eavesdropper decrypt the session? Wouldn't it be better to re-encrypt the random number using the server's public key and send that?
Re:Yes, but.... (Score:2)
Actually, you can use another identity and restrict what it does. On the server machine you can put an entry for the second key on your .authorized_keys which reads like: (blame /-code for the ugly formatting)
And presto, you have a passphraseless passwordless authorization that can perform a specific action on the remote host only if the connection comes from a trusted box. There are other options, you can read it all in sshd(8).
Re:Take *two* passwords into the shower? (Score:1)
Take *two* passwords into the shower? (Score:2)
Re:Take *two* passwords into the shower? (Score:2)
Or perhaps you just mean that Debian automatically starts ssh-agent for you on login (which other distributions, eg Mandrake, do as well).
Re:[OT] unsigned long long long ... long long int (Score:1)
http://www.perfsci.com/free/giantint/freesoftwa
Found it when researching the Pi topic. I'm a Richard Crandal fan since he developed FEE (Fast Elliptic Encryption) while at NeXT.
Re:Convenience or security? (Score:2)
Now, if you substitute some form of directory system (Kerberos/LDAP/NDS/AD/NIS/whatever), you could have a system where you are externally authenticated as you login, and then you use that authentication to seemlessly get the proper level of access on remote machines through encrypted connections. Doesn't help you get a shell at your hosting company's webserver, but a better solution for institutional use than SSH.
--
Re:I thought the man pages sucked. (Score:2)
I read the man pages for each release of OpenSSH as they came out. And eventually, with the help of several articles found on Google, I figured out how to do SSH V2 passwordless login and file transfer.
The most recent release of the OpenSSH docs is much better than previous, and I recommend everyone upgrade their packages. And much kudos to the OpenSSH team - they are fixing the docs, and the software is truly great.
But you won't understand everything you need to from the man pages unless you already grok rsh, rlogin, rcp, bind & name resolution, etc. The man pages are for people who are replacing insecure protocols, and who already understand them... not for people starting from a blank slate. Newbies should read this article, and the next one when it comes out, and Jay Beale's stuff too.
--Charlie
***note VERSION ONE of SSH is NO GOOD you may as well use RLOGIN. And you should not allow rhosts files on your systems for any reason.***
Re:Single point of failure? (Score:2)
There is no real way around this, but often this is an acceptable risk. For example, I use the same password on K5 and slashdot, a different one for all my named user accounts, and several machines at work share a root password. All my machines at home have the same root (not the same as any mentioned above, though) password.
This works because I don't care if anyone else pretends to be me on K5 or
So, manage your exposure as required by your circumstances. Remember keystroke loggers catch ALL passwords, and the only truly secure box is powered down in a locked room.
--Charlie
Re:Question (Score:2)
How is it that SSH2 can use a signature algorithm to do real encryption?
DSA is used for authentication only. All other communication is encrypted with a different cipher, like 3des or blowfish.
Re:What about SSH2? (Score:2)
1.) You need to use the -t option with ssh-keygen (i.e. ssh-keygen -t dsa) and
2.) The file names are different. For DSA, the file name is ~/.ssh/id_dsa instead of ~/.ssh/identity, and so forth.
Re:Cryptography awareness (Score:1)
[Kinda-OT] GnuPG (Score:2)
--
Using RSA authentication without a password (Score:4)
exec ssh-agent sh -c 'ssh-add <
This pops up a window which asks for your passphrase, then ssh-agent stays resident with your unlocked secret key. After 5 seconds, it spawns windowmaker (obviously, replace this with your wm of choice).
It sets an environment variable (SSH_AGENT_PID) with the process ID of ssh-agent and another one (SSH_AUTH_SOCK) which is the socket to use to communicate with ssh-agent. So when you try to ssh to somewhere, ssh checks for these variables and gets your unlocked key from ssh-agent transparently, and you ssh with no password. But without your passphrase to unlock it at the beginning of your X session, nobody else can use it (don't forget to xlock if you go anywhere
--
Re:Using RSA authentication without a password (Score:2)
Re:I wonder if /. editors read the links... (Score:1)
Something else omitted was the wonderful world of Putty, a MIT-licensed (~BSD) Windows set of SSH utilities, including scp and sftp. Without these tools (and cygwin/XFree86), management of our very heterogenous environment would be untenable!
Brian /dev/random > /dev/kmem'
1st Generation AI: 'cat
Re:passwordless authentication (Score:2)
But yes, if the keystrokes were the (only) relevent part of the generation of the key, it would be a non-random key that could be actively predicted by repeating the phrase. This can be modified by a proper random seed to mangle the phrase appropriately, but then everything depends on the randomness of that random seed. :)
Re:passwordless authentication (Score:2)
Hmmm... The way I understood the article, you're not signing; you're decrypting. The server that you are logging into sends you a random number which it has encrypted using your public key. Ssh on your end then decrypts that number using your private key and sends it back to the server. If it matches what the server originally generated, you're in.
"Intelligence is the ability to avoid doing work, yet getting the work done".
Re:lucky for you foreigners ... (Score:2)
"Intelligence is the ability to avoid doing work, yet getting the work done".
Re:I'll be damned... (and use a password) (Score:2)
Using only a private key with no passphrase for authentication is slightly less secure because in that case, someone would just need to *obtain* that key somehow. That could be accomplished by exploiting various bugs, using trojan scripts, or just plain old user stupidity (i.e. accidentally emailing it out to a mailing list-- worse things have happened!)
"Intelligence is the ability to avoid doing work, yet getting the work done".
Re:[OT] unsigned long long long ... long long int (Score:1)
It's an arbritrary-length math library, allowing for (more or less) unlimited length numbers. From the webpage:
More info is available at http://www.swox.com/gmp/ [swox.com]
Re:passwordless authentication (Score:1)
I'm sure that getting that number wouldn't do you any good because surely it's not going to challenge you with the same number each time.
Your private key is never sent to the server.
Re:Convenience or security? (Score:1)
Using their logic where the main reason to do this is so you don't have to enter a password is just crazy.
If you don't use passphrase protection on your private key, it's just as risky as creating a shell script that sends your password automatically or entering into a program like SecureCRT and having it remember it.
In fact, since SecureCRT encrypts the saved password, this seems like it's more secure than having a non-passphrase protected private key hanging around.
After you set this up, can you still log in via remotely using your password?
Re:What about SSH2? (Score:1)
Re:I wonder if /. editors read the links... (Score:2)
For Version 1:
ssh-keygen .ssh/identity.pub targethost:fooid
.ssh
.ssh/authorized_keys
[return]
[return]
[return]
scp
[type password]
ssh targethost
[type password]
mkdir
cat fooid >>
Done. Now, if you want version 2 (DSA-based):
ssh-keygen -t dsa .ssh/id_dsa.pub targethost:fooid2
.ssh
.ssh/authorized_keys2
[return]
[return]
[return]
scp
[type password]
ssh targethost
[type password]
mkdir
cat fooid2 >>
The "cd" command may fail, if you already have a .ssh directory on your target system.
You probably want to have a look at your permissions as well. Homedir and .ssh should be world readable and executable. .ssh/* should be readable except for .identity, id_dsa and random_seed which should only be readable/writeable by owner. You should also own all of the above files.
--
Aaron Sherman (ajs@ajs.com)
Yes, but.... (Score:2)
The classic example is using a SSH tunnel to retrieve mail from an ISP that doesn't support encrypted POP/IMAP sessions. I've also seen it used to implement a secure alternative to NIS.
While you could, theoretically, specify a different "identity" file for automated scripts, it offers little benefit since SSH doesn't provide a way of restricting rights based on the public key.
Re:Question (Score:1)
Someone please explain.
Re:Decrypt This (Score:2)
You know you're a hardcore slasdotter when:
17) You have two accounts with moderation points at the same time -- and you know about it.
--
Re:Passwordless Authentication (Score:1)
1. Hostbased Authentication
2. rhosts/shosts authentication
3. ssh-agent
4. Kerberos
If you're looking for passphraseless-entry for interactive use, this is the right answer, IMHO. You kinit to get a TGT. Then you can ssh into any host in the kerberos realm "for free". And using ssh ticket-forwarding you can even chain the ssh sessions from host to host. That allows you to do something cool like:
ssh -t foo.bar.com ssh -t guinness.bar.com ssh -t iron.bar.com xemacs -nw
without having to type a passphrase. Or say that your desktop is sand, and you've ssh'd into law, and then you decide you want to ssh into upc. You don't have to pop a new Eterm on sand to ssh to upc. You can just ssh from law to upc without a passphrase. This doesn't require home directory sharing across the machines (which you might not want on a server, say). And it doesn't require the maintenance of host keys, because it's still user authentication.
Of course, it does require the mantenance of a kerberos realm, but that's the right thing to do anyway. (krb5 patches for openssh are available)
it's the best way...bar none,
Michael
Re:Take *two* passwords into the shower? (Score:1)
--
Steve Jackson
Re:passwordless authentication (Score:2)
The password never gets sent to the server, though. That's the key difference. You get a challenge sent to you, and if you can use your private key to sign the challenge, you are allowed access.
You can copy your public key all over the place without compromising your password this way. Your password never leaves the local host.
Re:passwordless authentication (Score:2)
Erm, I'm not entirely sure what you're asking -- your public key is already at the server, so your signing (or decryption, as someone else pointed out... I'm no expert so I am not sure which one...) is validated against the server's copy of your public key. Is that what you were wondering?
Re:passwordless authentication (Score:1)
Well, that's the point of SSH, you can't sniff a password.
You can spend a lot of time studying secure interaction, but in a nutshell, here's how it works with (I'm not intimantely familiar with SSH, so I'm making some assumptions):
You have your account on localhost and remotehost (To use the same terminology as the article).
REMOTEHOST generates a public key, which is widely published. You get a copy of this key on localhost (SSH does this automagically, but not technically securely the first time you connect).
When you SSH from localhost, it asks for remotehosts public key. SSH compares it to the cached, verified (hopefully this has been done in some degree) key.
Information is then encrypted before being sent over the link. (Most protocols use public key methods for negotiation, and then a faster algorithm such as RC4 for data transfer).
Your password is never sent in the clear, and therefore can't be sniffed. The only way to obtain it is to compromise one of the hosts.
Re:Cryptography awareness (Score:1)
The difficult part is more how you do distributed file sharing well. The Napster model still provides a central point to DoS / Sue, and gnapster doesn't scale... The freenet project ( http://freenet.sourceforge.net/ [sourceforge.net])might interest you, as it's trying to do distributed sharing with privacy / anonymity.
Re:passwordless authentication (Score:3)
Re:OPENSSL (Score:2)
Question (Score:2)
This leads on to my question: The article says that SSH1 used the patented RSA key, but SSH2 uses DSA keys to work around the patent. How is it that SSH2 can use a signature algorithm to do real encryption?
Re:I wonder if /. editors read the links... (Score:2)
I wonder if /. editors read the links... (Score:4)
Re:There's another good article... (Score:1)
Part I - Using ssh [linuxgazette.com]
Part II - ssh suite: Sftp, scp and ssh-agent [linuxgazette.com]
Part III - Using ssh-agent for SSH1 and OpenSSH [linuxgazette.com]
Abbreviated Version [securityportal.com]
The authoritative source [openssh.org]
Mmmnnkay? Mnnnkay.
Further Reading (Score:2)
Stupid, Stupid Protocols: Telnet, FTP, rsh/rcp/rlogin [securityportal.com]
Re:Take *two* passwords into the shower? (Score:1)
Personally I appreciate Debian's approach to this - when you log in, you are doing so indirectly through ssh-agent, which keeps your ssh key available during your session.
Anyone, feel free to correct me on this stuff.
Re:Take *two* passwords into the shower? (Score:1)
emacs ange-ftp sftp (Score:1)
Re:Cryptography awareness (Score:2)
The only "intuitive" interface is the nipple. After that, it's all learned.
look ma! no passphrase! (Score:2)
Re:I wonder if /. editors read the links... (Score:2)
Re:Take *two* passwords into the shower? (Score:1)
Re:lucky for you foreigners ... (Score:2)
Re:Cryptography awareness (Score:2)
Re:ssh-agent: I don't think the author gets it (Score:2)
If they've got root, they can just install a trojan ssh client as easily, and capture your pass(word|phrase|key) regardless of how you're storing it.
Read the man page?? (Score:2)
You'll get a lot more by just reading them than this article. (Especially since you can only see half of it.)
Passwordless Authentication (Score:2)
1. Hostbased Authentication
Host based Authentication can be done with both protocol 1 and 2. You use ssh-keyscan for protocol 1 from the destination machine, and copy the
2. rhosts/shosts authentication
You can enable rhost and/or shost authentication, which then allows a user to create a
3. ssh-agent
This isn't truly passwordless, but if you have your RSA/DSA keys set up, you can run the ssh-agent either in your xterm or through your
exec echo "ssh-add ~/.ssh/id_dsa<
So when I log into X, I'm prompted one time for my id_dsa key, and then everywhere where I've put my id_dsa.pub file, I get "passwordless" access.
ssh-agent: I don't think the author gets it (Score:1)
The author seems to think that an ``advantage'' of using ssh-agent (unencrypted private keys in memory) vs. unencrypted private keys on disk is that somehow stuff in memory is harder to get to.
For starters, you'd better turn off /proc:
anybody with a fractional brain
who gets root can surely dig the password out
of there. Oh, and turn off /dev/mem. Oh, and make
sure that nobody can install a trojan ssh-agent...
Look, the only real advantage of the ssh-agent approach (or for that matter, typing a passphrase every time your key is used) that I'm aware of is not that it helps against being broken into. It does help when your machine is confiscated. Because it is difficult (though not in principle impossible) to tell what was in RAM once it is powered down, if you pull the plug when the bad guys come bursting in (and if you are running without swap space, so that your bits don't end up on disk anyhow :-) your
accounts on other machines should be safe from
exploration (up to rubber hoses).
This scenario doesn't apply to you? You're not willing to run without swap? Then for pity's sake, just use an unencrypted private key on disk.
To put it another way: what SSH acknowledges is the reality that if someone breaks into your system, they have to be really dumb not to be able to get into all the systems you can get into. ssh-agent is a tool for special-case situations.
Re:Convenience or security? (Score:1)
--
Re:One thing worries me (Score:2)
Correct me if I'm wrong... but it doesn't get transmitted as plaintext, the communication between the two machines is encrypted with blowfish or 3des.
--
Re:passwordless authentication (Score:1)
the thing i wonder though, is couldn't you still sniff the packet just like you would a password, except rather than "mypassword6" you get "23857723984...653765846358" or something?
then use that to connect initially?
(except you'd still need to know how to decrypt the bash prompt, etc. but it wouldn't be entirely useless, i suppose, if you could capture certain actions somehow)
passwordless authentication (Score:2)
so, in the end, it's still using a password of sorts?
passwordless authentication (Score:2)
Re:[OT] unsigned long long long ... long long int (Score:1)
Re:[OT] unsigned long long long ... long long int (Score:1)
[OT] unsigned long long long ... long long int (Score:2)
Re:passwordless authentication (Score:1)
DSA sends a number, you sign it and send it back to the server. This is the same as signing a message with GPG. DSA is considered more secure (the algorithm is better), bacause you'd have to guess the entire key rather than just a number.
Now I have a question: What if some evil user decided to put his key in some user's home directory (maybe they left it writable?) ? Seems like a great way to steal accounts
Re:passwordless authentication (Score:1)
Re:passwordless authentication (Score:4)
The text - or mouse movement - you (probably) entered when the key was generated was intended as a source of unique input, hopefully containing enough entropic characteristics to create a secure non-pattern based key set.
The then probably had the option to encrypt the key using a passphrase which you'd then have to use when authenticating using that key set.
The main difference here is that the passphrase is not a required part of a key set, and it is not the main cryptographic mechanism of the authentication process.
--CTH
Re:passwordless authentication (Score:1)
This has always been my (naive? correct me please) concern about this.. could a ssh client be hacked to fake a 'signed challenge' since this is all at the client? Or am I missing something (e.g. returned signed key still has to be authenticated at host).
Inquiring minds want to know
Re:passwordless authentication (Score:1)
Just trying to truly understand this.
Cryptography awareness (Score:1)
That's why we need to develop cryptographic awareness in the general public. If everyone was informed about the benefits of cryptography, there'd be pressure against export restrictions and the like. Even more important is the question of key management -- it might be worth implementing many of the marvelous ideas enabled by cryptography, if only people managed to understand how important a private key is, and started seriously protecting them.
Re:Cryptography awareness (Score:1)
Perfectly possible. You don't even need to worry about how it'd happen -- just use a cryptographic library. There's something along these lines using GPG (IIRC, it's called GPGme.) If properly implemented in C++, you could seamlessly switch between secure and unsecure mode, without having to rewrite any functions! (Of course, once we start stripping off any application-specific aspects, we'd eventually arrive at some sort of Secure Sockets Layer, with public-key emphasis and tight integration with the application.)
Re:lucky for you foreigners ... (Score:2)
The US modified their export regulations back in 1996 transferring cryptographic export to the US Department of Commerce Bureau of Export Administration (BXA [doc.gov]), and not relating it under ITAR [pmdtc.org] (Department of State I believe) which was what classified it as Dual-Use Technologies, which also includes nuclear material, weapons, supercomputers, etc.
Re:Question (Score:3)
RSA and DSA are two algorithms which are used in a similar (interchanagable for our purposes) fashion.
The article says that SSH1 used the patented RSA key
The RSA patent in the US (# 4,405,829) expired in September 2000.
How is it that SSH2 can use a signature algorithm to do real encryption?
The actual transport encryption is done via a symmetric cipher algorithm such as Triple-DES (3DES), Blowfish, or IDEA (patented in US, Europe) which are much faster (~ 1000-1500 times) than public key algorithms. The RSA or DSA is used to negotiate the key to be used by the symmetric cipher (which uses the same key to encrypt and decrypt, hence "symmetric").
Re:Single point of failure? (Score:1)
There's another good article... (Score:4)
Have phun.
What about SSH2? (Score:1)
Decrypt This (Score:2)
Yay for encryption! (Score:1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lucky for you foreigners ... (Score:4)
Otherwise we'd have to ask those of you reading the featured article [ibm.com] apply some mental floss and forget what you've just read, shred any hard-copies you took to the bathroom with you, and format hard drive just to insure that you haven't accidentally cached it somewhere.
Convenience or security? (Score:2)
I get the feeling from reading this that they want to use RSA/DSA for convenience. It confuses me as to how it is more convenient to enter a passphrase rather than a password. I know that this has definite benefits, but I don't think that they covered them very well in their intro.
I think that there should be more information about the other benefits of using this encryvtion rather than "Wouldn't you rather just type: ssh myname@myhost instead of entering a username and password?"
DocWatson
OPENSSL (Score:1)
Re:Decrypt This (Score:1)
Re:Decrypt This (Score:1)
Justin Dubs
Re:Cryptography awareness (Score:3)
I thought of something regarding PGP earlier today in response to the file sharing story this morning:
Develop a file-sharing network where data is encrypted using PGP's style of encryption. Remote user generates a temporary symmetric key based on keystrokes, mouse movements, etc, encrypts the file you want using that temp key, then encrypts the temp using your public key, then transmit the pair to you. Decrypt the temp key using your private key, then decrypt the shared file. Use a similar scheme of things when searching for files and other data transmissions. Naturally we want all this to be transparent to the user and happen automatically. Only problem with this is it is processor intensive and may slow things down because of all the math work involved in encrpytion/decryption process.
I'll be damned... (and use a password) (Score:1)
Anyway, when using the ssh-agent for no-password-required logons, you can STILL have a security issue if someone compromises your account (or your machine!). They may not know what your private key is, but they can use it just like you do. Just to be safe, pick and use a good password.
Re:passwordless authentication (Score:1)
Just wondering if you intercept the communication from the client, let him ask for the random number to the server, wait for the server to send him the challenge, and then, when the client sends bask the unencrympted random number, you block it, then send it yourself. Would the server still be waiting for it? Is there a client recognition system (ip adress, mac adress...)?
I guess the only way this would work would be to control a gateway or any transition point.
Or could the fact of intercepting the encrypted challenge, and the unencrypted one lead to the discovery of the private key....?
I'm not a pro in this, that's why i ask these questions...
The solution is easy... (Score:2)
Uhhh.. they still make floppies right??
Re:One thing worries me (Score:1)
The actual session would be encrypted, yes. After all, that's part of the point. But the initial phase isn't part of the session. That's when they have to do things like set up the shared key the two systems will use for the session, stuff like that.
Re:passwordless authentication (Score:1)