What's new

dropbearconvert not working

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Rooby

Regular Contributor
Hello

I would like to generate ssh keys with Putty to use them for Router connection from windows.
I also want to connect routers with ssh. Then I need the keys not in OpenSSH format but in dropbear format. The only way is to convert them is using dropbearconvert. But this is not working on the Router. Dropbearconvert is linked to dropbearmulti but is not usable:

Dropbear SSH multi-purpose v2014.66
Make a symlink pointing at this binary with one of the following names:
'dropbear' - the Dropbear server
'dbclient' or 'ssh' - the Dropbear client
'dropbearkey' - the key generator
'scp' - secure copy

How can I convert the keys. I can use dropbearkey to generate but how can I import or convert then for OpenSSH and Putty?
 
Here's what I did to get it working EXACTLY how I wanted. First, I turned off "Enable SSH" in the WebUI, and left it off. This method is probably not for the faint of heart. That said,

Use PUTTYGEN.exe on Windows to produce a SSH-2 RSA 4096 bit public/private key pair.

The PRIVATE key file is your secret to be kept in Windows. Use it in PuTTY, here:
Connection -> SSH -> Auth -> Private key file for authentication.

Set the router username for login with PuTTY, here:
Connection -> Data -> Auto-login username = admin

The PUBLIC key is pasted into the authorized_keys file on your router, here:
Code:
/jffs/dropbear/authorized_keys

Now go to the router and generate your dropbear keys just once. I put everything directly in /jffs/dropbear folder.
Code:
mkdir -p /jffs/dropbear
dropbearkey -t rsa -f /jffs/dropbear/dropbear_rsa_host_key -s 4096
dropbearkey -t dsa -f /jffs/dropbear/dropbear_dss_host_key -s 1024
dropbearkey -t ecdsa -f /jffs/dropbear/dropbear_ecdsa_host_key -s 521

Make a custom login prompt.
Code:
echo "You do not have access. Please go." > /jffs/dropbear/loginprompt

Make a custom script to launch dropbear with our custom configuration.
/jffs/scripts/dropbear-start
Code:
#!/bin/sh

# kill dropbear if it is not ours
((ps | grep -i dropbear) | grep -i "/jffs/") || \
(
  /usr/bin/killall dropbear && sleep 1
)

# start dropbear with our custom configuration
/bin/pidof dropbear > /dev/null 2>&1 || \
(
  rm -rf /root/.ssh
  ln -s /jffs/dropbear /root/.ssh
  rm -rf /etc/dropbear
  ln -s /jffs/dropbear /etc/dropbear
  chown -R `nvram get http_username`:root /jffs/dropbear
  chmod 700 /root/.ssh
  chmod 600 /root/.ssh/*
  /usr/bin/dropbear -p 22 -I 86400 -s -j -k -b /jffs/dropbear/loginprompt
)

Add cron job to run dropbear-start every 5 minutes. This is helpful in case dropbear crashes and there are no more dropbear instances left to start a new dropbear session. In that case you will wait no more than 5 minutes to login again.
/jffs/scripts/services-start
Code:
#!/bin/sh

# add cron job
cru a CheckSSHD  "*/5  *  *  *  *  /jffs/scripts/dropbear-start"

# start dropbear with custom configuration
/jffs/scripts/dropbear-start
 
Last edited:

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top