Bug 220463 - security/dropbear The generated public key is unusable by dbclient (and ssh)
Summary: security/dropbear The generated public key is unusable by dbclient (and ssh)
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-04 07:30 UTC by dewayne
Modified: 2017-07-05 01:54 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (pkubaj)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dewayne 2017-07-04 07:30:08 UTC
Platform: FreeBSD 11.1Beta3 amd64

Thank-you for maintaining this port and expanding the options.  Which enticed me to try it.

Using key sizes from 1024 to 3072
# dropbearkey -t rsa -s 1024 -f /root/.ssh/dropbear | grep ^ssh-rsa > /root/.ssh/id_dropbear

resulted in

# dbclient -i dropbear 10.0.55.116
dbclient: Exited: String too long

# dbclient -i id_dropbear 10.0.55.116
dbclient: Exited: String too long

Nope I meant to test the public key, in case there was any confusion, similarl for dropbearconvert (below) :/

I used 
# dropbear -F -E -m -p 10.0.55.116:22 -r /usr/local/etc/dropbear/dropbear_rsa_host_key
to verify that dbclient wasn't communication to the server. So the "string too long" is a client issue.

I then tried converting
# dropbearconvert dropbear openssh /root/.ssh/id_dropbear /root/.ssh/test
Exited: String too long

# dropbearconvert openssh dropbear  /root/.ssh/id_dropbear /root/.ssh/test
Error: File does not begin with OpenSSH key header
Error reading key from '/root/.ssh/id_dropbear'

Seems that dropbear is only able to use ssh with passwords, which is a long way from our intended intestial destination:

# dropbear -F -E -m -p 10.0.55.116:666 -m -s -g -j -k -r /usr/local/etc/dropbear/dropbear_rsa_host_key

Hope that you can shed some light on this one.
Comment 1 Piotr Kubaj freebsd_committer freebsd_triage 2017-07-04 17:28:10 UTC
(In reply to dewayne from comment #0)
Sorry, I can't reproduce this error.
Comment 2 dewayne 2017-07-05 01:54:37 UTC
(In reply to Piotr Kubaj from comment #1)
After further investigation - this is how dropbear should be setup.

# Cleanup any old work - 
rm /usr/local/etc/dropbear/dropbear_rsa_host_key /root/.ssh/id_dropbear ; 

# Create host key
dropbearkey -t rsa -f /usr/local/etc/dropbear/dropbear_rsa_host_key

# Create my keys
cd /root/.ssh
dropbearkey -y -f id_rsa | grep "^ssh-rsa " >> authorized_keys

# Prepare for openssh use, if required
dropbearconvert dropbear openssh id_rsa id_rsa_openssh

# Use
dbclient -i id_rsa 10.0.55.115
ssh -i id_rsa_openssh 10.0.5.115

# Success :)