Create SSH public key in DD-WRT?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
mc510
DD-WRT Novice


Joined: 16 Sep 2015
Posts: 17

PostPosted: Tue Oct 20, 2015 16:09    Post subject: Create SSH public key in DD-WRT? Reply with quote
I want to initiate an SSH connection from DD-WRT, as client, to a remote server running OpenSSH, but I can't figure out how to create the necessary public/private key pair in DD-WRT.

ssh-keygen isn't available, so I gather that I have to use dropbear. I've already got the autocreated dropbear_rsa_host_key; I take it that this is the private key.

dropbearkey -y -f dropbear_rsa_host_key is said to spit out the corresponding public key, but for me it returns nothing.

If I follow the instructions here and create a new key with dropbearkey -t rsa -f ~/.ssh/id_rsa I still don't get any output from dropbear -y.

What am I missing here?

Brainslayer 14929 on WNDR3300.


Last edited by mc510 on Tue Oct 20, 2015 16:12; edited 1 time in total
Sponsor
h8red
DD-WRT Guru


Joined: 28 Jun 2011
Posts: 580
Location: Vilnius, Lithuania

PostPosted: Tue Oct 20, 2015 16:12    Post subject: Reply with quote
Use puttygen.exe
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

_________________
[Ramips] Nexx WT3020F Openwrt @kernel #4.14.167 (OpenVPN server, Wireguard server, AD blocking, SQM QOS, USB)
mc510
DD-WRT Novice


Joined: 16 Sep 2015
Posts: 17

PostPosted: Tue Oct 20, 2015 16:16    Post subject: Reply with quote
h8red wrote:
Use puttygen.exe
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html


You mean use puttygen to create the keypair on a Windows computer, then copy over to DD-WRT? I was thinking about that as a fallback option ... isn't it also necessary to convert the puttygen private key to dropbear format?
h8red
DD-WRT Guru


Joined: 28 Jun 2011
Posts: 580
Location: Vilnius, Lithuania

PostPosted: Tue Oct 20, 2015 16:26    Post subject: Reply with quote
mc510 wrote:
You mean use puttygen to create the keypair on a Windows computer, then copy over to DD-WRT?

Yes
mc510 wrote:
isn't it also necessary to convert the puttygen private key to dropbear format?

No

_________________
[Ramips] Nexx WT3020F Openwrt @kernel #4.14.167 (OpenVPN server, Wireguard server, AD blocking, SQM QOS, USB)
tmo1138
DD-WRT User


Joined: 24 Mar 2015
Posts: 175
Location: Tacoma, Wa

PostPosted: Tue Oct 20, 2015 19:46    Post subject: Reply with quote
Read sections 2.2.1 and 2.2.2 to set up SSH public key authentication...

http://www.dd-wrt.com/wiki/index.php/SSH

You can skip the dropbear part, you won't need it.

_________________
Routers:
Netgear R8000 - DD-WRT v3.0-r43420 std (06/15/20)
Netgear R9000 - DD-WRT v3.0-r43420 std (06/15/20)


Useful links:

Builds:
ftp://ftp.dd-wrt.com/betas/2020/


dd-wrt supported devices:
http://www.dd-wrt.com/wiki/index.php/Supported_Devices

So long <kong> and thanks for all the fish!
mc510
DD-WRT Novice


Joined: 16 Sep 2015
Posts: 17

PostPosted: Wed Oct 21, 2015 3:27    Post subject: Reply with quote
Okay, got it to work, but it did require a few extra steps. And for anyone coming across this thread, let me reiterate that I am not trying to connect from a PC to my DD-WRT router! I am trying to connect from my DD-WRT router to a remote server.

On Windows, I ran puttygen to create a public and private key (limited to 1024 bits for no real reason), then used puttygen's 'convert' function to save the private key as OpenSSH.

Copied the public key from puttygen and appended to authorized_keys on the remote server.

Copied the new private key to DD-WRT .ssh directory, then ran dropbearconvert openssh dropbear ./id_rsa ./id_rsa.dropbear.

Now ssh user@server.net -i id_rsa.dropbear works!
zdzi
DD-WRT Novice


Joined: 03 Jul 2018
Posts: 21

PostPosted: Sun Dec 10, 2023 19:09    Post subject: Reply with quote
mc510 wrote:
Okay, got it to work, but it did require a few extra steps. And for anyone coming across this thread, let me reiterate that I am not trying to connect from a PC to my DD-WRT router! I am trying to connect from my DD-WRT router to a remote server.

On Windows, I ran puttygen to create a public and private key (limited to 1024 bits for no real reason), then used puttygen's 'convert' function to save the private key as OpenSSH.

Copied the public key from puttygen and appended to authorized_keys on the remote server.

Copied the new private key to DD-WRT .ssh directory, then ran dropbearconvert openssh dropbear ./id_rsa ./id_rsa.dropbear.

Now ssh user@server.net -i id_rsa.dropbear works!


you sir (maybe madam, didn't check Embarassed ) are a frigging genius. I've been wanting to do the same (use dd-wrt to ssh to elsewhere using keys) and this had me stumped. For me I already had the oopenshh key I just needed the convert advice!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum