07/12/2009, 08:22 AM
|
#1 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 102
Likes Received: 0
Thanks: 16
Thanked 12 Times in 9 Posts
|
I have rooted and installed dropbear, and everything is working great. I'm pretty new to the whole concept of using SSH, so I have a question.
From what I understand, it is possible to prevent brute force attacks against a an SSH server (in this case, the Pre) to determine the correct password by using a public and private key. I've done a little research on this but am confused how to implement this on the Pre. How do I generate public and private keys with dropbear, and use these keys with Putty on a windows machine to SSH with my Pre? Do I even need a password if I am using these keys? If someone would be willing to explain not only how to do it, but give a brief description also of what is actually going on, I'd appreciate it all the more. I'm here to learn, people!
|
07/12/2009, 08:27 AM
|
#2 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 102
Likes Received: 0
Thanks: 16
Thanked 12 Times in 9 Posts
|
Just to make it more clear what I'm talking about, I am interested in learning how to implement method #2 found at this link (an article on making your SSH connections more secure):
How to Secure SSH Server from Attacks |
07/12/2009, 09:28 AM
|
#3 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 258
Likes Received: 0
Thanks: 7
Thanked 34 Times in 24 Posts
|
Its pretty easy to do.. No, you do not need to use a password once you have keys set up -- in fact, once I have public key authentication set up on anything I have control of, I disable the ability to use password logins on the SSH server. I strongly suggest using a passphrase with your key -- without it, if someone gets a hold of your keyfile, they'll have free access to use it. On the page you linked to, in the section "Method 2: Using SSH Public/Private Key Authentication", at Step 3 -- enter a passphrase in the two fields puttygen provides. If you do not want to keep entering the passphrase in every time you use the key, you can use Pageant (inlcuded in the putty.zip), which is an authentication agent. You basically load your key the first time, enter the passphrase, and the agent will push through your key for you each time automatically without having to enter the passphrase a second time.
For the instructions on that page, to modify it for Dropbear: 1) Log into your Pre with Putty using your username. Make the filesystem read/write: Code:
sudo mount -o remount,rw / 3) Type the following: Code:
mkdir .ssh Code:
chmod 700 ~/.ssh 5) Go to your SSH session in Putty 6) Enter the following: Code:
vi ~/.ssh/authorized_keys 8) You can right-click the mouse -- that should paste the contents of your public key to the vi window 9) Once its pasted, press ESC in vi to return to command mode. Then: Code:
:x 10) Set the proper permissions on authorized_keys: Code:
chmod 600 ~/.ssh/authorized_keys Once you get public key auth working, its a good idea to then disable password authentication. To do this, you need to edit the optware-dropbear script in /etc/event.d: Code:
sudo vi /etc/event.d/optware-dropbear Code:
exec /opt/sbin/dropbear -s -g -F -p 222 Make the filesystem readonly again: Code:
sudo mount -o remount,ro / Code:
sudo -i reboot Sorry -- this was a quick writeup.. It may need some tweaking. Last edited by RickNY; 10/04/2009 at 12:35 AM. Reason: Corrected typo, added chmod for authorized_keys |
07/12/2009, 04:26 PM
|
#4 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 102
Likes Received: 0
Thanks: 16
Thanked 12 Times in 9 Posts
|
Thanks Rick this answer came much more quickly and detailed than I expected! I haven't done it yet but I'll be sure to thank and give you feed back when I do.
I might be paranoid, but this seems like information that really ought to be on the Pre Dev Wiki- if thousands of people have used the Pre Dev Wiki to get password-enabled SSH working on their Pres, and enough of them follow the directions on enabling connecting via SSH over the EVDO connection, you could have a major security problem that could easily be avoided. I don't know a whole lot about this stuff, but it seems like it would be easy enough for a smarty pants hacker to sniff the sprintpcs range of ip addresses, find open port 222 (dead giveaway that a person used the Pre Dev to install SSH on their Pre, no?), and brute force their way into the thing. From there, it would be easy to steal all kinds of information, alter system files, backdoors, VIRUSES.... nightmare! This (or a strong password) seems like a good solution to stop that from happening. Thoughts from anyone who knows more about this stuff? I really am pretty clueless when it comes right to it. |
07/12/2009, 06:23 PM
|
#5 (permalink) | |
|
Member
![]() Join Date: Jun 2009
Posts: 102
Likes Received: 0
Thanks: 16
Thanked 12 Times in 9 Posts
|
Rick, some quick corrections to the instructions above.
This line didn't work as written: Quote:
chmod 700 .ssh That worked fine for me. Other than that, perfect! Thanks! |
|
07/12/2009, 09:45 PM
|
#6 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 258
Likes Received: 0
Thanks: 7
Thanked 34 Times in 24 Posts
|
Actually was supposed to be Code:
chmod 700 ~/.ssh Also, I dont know how strict the checks are in Dropbear, but you should also do a: Code:
chmod 600 ~/.ssh/authorized_keys Last edited by RickNY; 07/12/2009 at 11:10 PM. |
07/12/2009, 11:19 PM
|
#7 (permalink) | |
|
Member
![]() Join Date: Jun 2009
Posts: 258
Likes Received: 0
Thanks: 7
Thanked 34 Times in 24 Posts
|
Quote:
|
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|



