Dropbear for iPhone

Matt Johnston matt at ucc.asn.au
Wed Aug 25 19:40:11 WST 2010


The "multi" stuff is defined in the Makefile - compile with
"make MULTI=1" to create the multi-function binary. If
you're only using dbclient it might be easier to just rename
main() in cli-main.c .

libtomcrypt and libtommath are built as static libraries
that are linked to Dropbear. I think you should be able to
run ./configure once, then add all the files including the
"config.h" to your xcode project. I did that one time a few
years ago and it worked OK, though I'm not sure how you'd
run ./configure with the iphone SDK - perhaps point it at
the relevant cross-compiling $CC?

Off the top of my head I think most of dbclient should be
threadsafe at least if there's only a single instance
running, though there are calls to getpwnam() etc that
could need attention. I guess you could replace the
stdin/stdout file descriptor with a unix pipe to your main
program as a way of talking to your UI with minimal changes
to the dropbear code. You will also need to change the code
in cli-chansession.c that sets up terminal control codes.

Cheers,
Matt

On Tue, Aug 24, 2010 at 09:06:36PM -0400, xaos wrote:
>  Hello everyone. This is what I'd like to do:
>
> In my iPhone app, I'd like to call the Dropbear client code in order to create an SSH tunnel
> to another machine. I do not want an independent ssh command-line client.
>
> I will be running the client code from an iPhone thread.
>
> I do not want X11 forwarding or SSH compression.
>
> Easier said than done. I guess.
>
> Quick info about myself: I am a serious developer who knows a few things about iPhone,
> Objective-C, C programming and UNIX. Been with UNIX since '84. Yes, I'm, old(er).
>
> So, I don't need hand holding here, just a few pointers to get me going. Naturally, I will post
> my results as I tend to do, see my blog at: http://www.xm5design.com/
>
> Ok. So my initial code inspection turned out the following:
>
> in "cli-main.c" there is a way to start the code without a "main()" which would clash with the
> "main()" in any iPhone app.
>
> This is good!
>
> However, the defines: "DBMULTI_dbclient" and "DROPBEAR_MULTI" are not
> exactly clear on their meaning.
>
> There is a "cli_dropbear_exit" function that seems to be the central exit gate for the client code.
> If true, this is fantastic since I don't want to Dropbear code to "exit()". I want a nice "return()"
> which will shutdown the dropbear thread gracefully (or re-start).
>
> Problem: I can't really use the Makefile genned by configure since I will execute the code
> from Xcode. Any hints?
>
> I tried a simple test on my OSX machine like this:
>
> ./configure --disable-zlib --disable-syslog --disable-lastlog
>
> and then:
>
> make PROGRAMS="dbclient" >make.log 2>&1
>
> and I got a working client binary. I was able to ssh to another machine, etc, etc..
>
> However when I do: "otool -L dbclient" (otool is like like ldd)
> I only see "/usr/lib/libSystem.B.dylib" no other lib. Does that mean
> I don't need the libraries in "libtomcrypt" and "libtommath" for a simple client code?
>
> Please accept my thanks ahead of time for this. Any help is appreciated.
>
> -George H.


More information about the Dropbear mailing list