mkj / dropbear

Dropbear SSH
https://matt.ucc.asn.au/dropbear/dropbear.html
Other
1.71k stars 403 forks source link

please add the sftp-server, so a static dropbearmulti with sftp func is possible #155

Open MaxPeal opened 2 years ago

MaxPeal commented 2 years ago

please add a standalone version of OpenSSH's sftp-server program, so a make like:

./configure --enable-static
make PROGRAMS="dropbear dbclient scp" MULTI=1

for make a static dropbearmulti with sftp-server func is possible.

mkj commented 2 years ago

It looks like OpenSSH's sftp-server would require at least a dozen .c files to build. It seems relatively separate from other parts of OpenSSH, though would still need various configure tests etc. Perhaps it could be added in a subdirectory - I'm not sure if I'll get to it myself but I wouldn't object if someone wants to add it. Of course we might then need to add sftp client too if OpenSSH removes scp as a server.

MaxPeal commented 2 years ago

And not a import but an easy option in the makefile to auto integrate a separate automatic openssh build?

thom-nic commented 2 years ago

I have just learned that modern releases of openssh have deprecated the scp protocol. When using dropbear as server and an openssh client, legacy scp can be reenabled using the -O flag. But, as the article states the legacy protocol may be completely disabled at some point in the future.

So folks using dropbear as SSH server will need a solution to support sftp for secure file transfer in the future.

MichaIng commented 1 year ago

Not sure if it makes sense to bundle those, since Dropbear and the OpenSSH SFTP server are two entirely dedicated standalone projects which can be plug&play combined trivially by end users? If I'm not mistaken, the only thing that needs to exist on Linux distros is /usr/lib/sftp-server, which is then invoked by clients automatically server-side. And one might want to use alternatives like the Green End SFTP Server. Having separate executables and the ability to e.g. update each separately also is a security aspect.

dadolee commented 1 year ago

Not sure if it makes sense to bundle those, since Dropbear and the OpenSSH SFTP server are two entirely dedicated standalone projects which can be plug&play combined trivially by end users? If I'm not mistaken, the only thing that needs to exist on Linux distros is /usr/lib/sftp-server, which is then invoked by clients automatically server-side. And one might want to use alternatives like the Green End SFTP Server. Having separate executables and the ability to e.g. update each separately also is a security aspect.

I tried to compile Openssh sftp-server, but it cannot be called by Dropbear subsystem. Is there any relevant information about transplanting sftp-server?

MichaIng commented 1 year ago

As said, it works here OOTB with any SFTP server binary located at /usr/lib/sftp-server or /usr/lib/openssh/sftp-server, or anywhere else if the SFTP client allows to define the path. Assure that the binary is executable. Otherwise, some more details, especially what exactly you did, error messages etc would be helpful. But at best in a dedicated issue, to not mess with this feature request.

HansH111 commented 1 year ago

Well I have an integrated small scp integrated in dropbear which does the -f -t -p options and integrates in svr-chansession.c it is only 7,5 kb source, if there is an interest in that I will post that. That way you don't have to rely on an external scp binary or sftp binary. But it is very basic...

takov751 commented 1 year ago

Not sure if it makes sense to bundle those, since Dropbear and the OpenSSH SFTP server are two entirely dedicated standalone projects which can be plug&play combined trivially by end users? If I'm not mistaken, the only thing that needs to exist on Linux distros is /usr/lib/sftp-server, which is then invoked by clients automatically server-side. And one might want to use alternatives like the Green End SFTP Server. Having separate executables and the ability to e.g. update each separately also is a security aspect.

I tried to compile Openssh sftp-server, but it cannot be called by Dropbear subsystem. Is there any relevant information about transplanting sftp-server?

I was able to simple compile sftp-server from the project openssh-portable with

 ./configure --without-openssl --host arm-linux --without-zlib --with-ldflags=-static && make sftp-server

just change to host to your need. And move the binary next to the dropbear or somewhere in the PATH. It should work. I ended up with the dropbearmulti arm 32bit binary 500kb and the sftp-server on itself 600+ kb . It's works like a charm

BrainSlayer commented 1 year ago

i managed to use the openssh sftp server in dd-wrt with dropbear and its just 22 kb on mips platform