9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] TLSServer?
@ 2003-11-10 14:25 Sam
  2003-11-10 15:35 ` David Presotto
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Sam @ 2003-11-10 14:25 UTC (permalink / raw)
  To: 9fans

I need to write a Unix application that uses TLS/SSL.  I
looked at using OpenSSL, but lordy mama -- what an interface.
Since I only need to do the server side of the communication,
I thought perhaps the Plan 9 tls stuff could be used.

Comments?  How much work would it be to get the current
code working in a Unix environ?

Cheers,

Sam




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-10 14:25 [9fans] TLSServer? Sam
@ 2003-11-10 15:35 ` David Presotto
  2003-11-10 15:41 ` Russ Cox
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: David Presotto @ 2003-11-10 15:35 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

You'ld have to take our devtls stuff out of the kernel.  You could run it as
a process that you pipe stuff through.  WOuldn't be too hard.  The
security and extended math libraries have been ported before, I
think rsc probably has them ported to a Unix.

[-- Attachment #2: Type: message/rfc822, Size: 2180 bytes --]

From: Sam <sah@softcardsystems.com>
To: <9fans@cse.psu.edu>
Subject: [9fans] TLSServer?
Date: Mon, 10 Nov 2003 09:25:18 -0500 (EST)
Message-ID: <Pine.LNX.4.30.0311100919570.21648-100000@athena>

I need to write a Unix application that uses TLS/SSL.  I
looked at using OpenSSL, but lordy mama -- what an interface.
Since I only need to do the server side of the communication,
I thought perhaps the Plan 9 tls stuff could be used.

Comments?  How much work would it be to get the current
code working in a Unix environ?

Cheers,

Sam


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-10 14:25 [9fans] TLSServer? Sam
  2003-11-10 15:35 ` David Presotto
@ 2003-11-10 15:41 ` Russ Cox
  2003-11-15 16:01   ` Sam
  2003-11-10 17:21 ` William Ahern
  2003-11-10 20:10 ` Andrew Simmons
  3 siblings, 1 reply; 11+ messages in thread
From: Russ Cox @ 2003-11-10 15:41 UTC (permalink / raw)
  To: 9fans; +Cc: dong

> I need to write a Unix application that uses TLS/SSL.  I
> looked at using OpenSSL, but lordy mama -- what an interface.
> Since I only need to do the server side of the communication,
> I thought perhaps the Plan 9 tls stuff could be used.
>
> Comments?  How much work would it be to get the current
> code working in a Unix environ?

Step 1.  Write a kernel driver to do the TLS record-layer marshalling.
Not so easy.

If you want the Plan 9 interface (just pushtls and use the resulting fd
in normal I/O), the right thing to do seems to be to create a pipe and
then run openssl in a child encrypting between the pipe and your old fd.
Then you can use the pipe as your normal encrypted fd.  There was a
library that did this (either with or without SSL) (by someone in
Australia, perhaps?) but I cannot find it online anymore.  Presumably
it's not _too_ hard to write the appropriate program using OpenSSL
(maybe it's even an example).  The pipe+exec code is trivial.

I think Dong Lin has code that does this somewhere.

Russ


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-10 14:25 [9fans] TLSServer? Sam
  2003-11-10 15:35 ` David Presotto
  2003-11-10 15:41 ` Russ Cox
@ 2003-11-10 17:21 ` William Ahern
  2003-11-10 20:10 ` Andrew Simmons
  3 siblings, 0 replies; 11+ messages in thread
From: William Ahern @ 2003-11-10 17:21 UTC (permalink / raw)
  To: 9fans

On Mon, Nov 10, 2003 at 09:25:18AM -0500, Sam wrote:
> I need to write a Unix application that uses TLS/SSL.  I
> looked at using OpenSSL, but lordy mama -- what an interface.
> Since I only need to do the server side of the communication,
> I thought perhaps the Plan 9 tls stuff could be used.

It takes ~10 calls into OpenSSL in my TLS-able server to load trusted certs,
load the keys, install the descriptor and use it in my IO routines. Much,
much easier than I initially thought when I first dove into the horrible
documentation. And some of the crypto primitives are written in assembly,
which can make a big difference depending on your server's usage pattern.

All-in-all, OpenSSL was much simpler than it looks from 10,000 feet.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-10 14:25 [9fans] TLSServer? Sam
                   ` (2 preceding siblings ...)
  2003-11-10 17:21 ` William Ahern
@ 2003-11-10 20:10 ` Andrew Simmons
  3 siblings, 0 replies; 11+ messages in thread
From: Andrew Simmons @ 2003-11-10 20:10 UTC (permalink / raw)
  To: 9fans

At 09:25 10/11/2003 -0500, you wrote:
>I need to write a Unix application that uses TLS/SSL.  I
>looked at using OpenSSL, but lordy mama -- what an interface.
>Since I only need to do the server side of the communication,
>I thought perhaps the Plan 9 tls stuff could be used.
>
>Comments?  How much work would it be to get the current
>code working in a Unix environ?
>
>Cheers,
>
>Sam

I use OpenSSL under Windows, and find it very good. The build process is a
bit painful, and the online documentation is dreadful, but if you get a
copy of the O'Reilly book "Network Security with OpenSSL" it all becomes
remarkably simple. They've even provided a sample server application for
you to copy.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-10 15:41 ` Russ Cox
@ 2003-11-15 16:01   ` Sam
  2003-11-15 17:24     ` Russ Cox
  0 siblings, 1 reply; 11+ messages in thread
From: Sam @ 2003-11-15 16:01 UTC (permalink / raw)
  To: 9fans; +Cc: dong

> If you want the Plan 9 interface (just pushtls and use the resulting fd
> in normal I/O), the right thing to do seems to be to create a pipe and
> then run openssl in a child encrypting between the pipe and your old fd.
> Then you can use the pipe as your normal encrypted fd.  There was a
> library that did this (either with or without SSL) (by someone in
> Australia, perhaps?) but I cannot find it online anymore.  Presumably
> it's not _too_ hard to write the appropriate program using OpenSSL
> (maybe it's even an example).  The pipe+exec code is trivial.

Sorry for the late response - I just got back to looking at this today.

There's only one problem with the pleasantly trivial solution above.  The
unices still have unidirectional pipes, so I can't read and write the
returned fd.

I'm looking at implementing serveopenssl(int, ...) that takes an already
set up socket fd ready for accept and the tls cert necessities.  I plan
to return a socket descriptor for a unix domain server, and as I get
completed tls connections I'll make a client connect to the udom server
and marshal data back and forth.

Sure seems like a lot of work just to get the security insulated from
the application code.  Suggestions welcomed.

Sam




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-15 17:24     ` Russ Cox
@ 2003-11-15 16:31       ` Sam
  2003-11-16  4:14       ` boyd, rounin
  1 sibling, 0 replies; 11+ messages in thread
From: Sam @ 2003-11-15 16:31 UTC (permalink / raw)
  To: 9fans

> You can use socketpair to get a two-way pipe.

Someone else just pointed that out to me.  Thanks
for not letting me "reimplement it, poorly," though.

:)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-15 16:01   ` Sam
@ 2003-11-15 17:24     ` Russ Cox
  2003-11-15 16:31       ` Sam
  2003-11-16  4:14       ` boyd, rounin
  0 siblings, 2 replies; 11+ messages in thread
From: Russ Cox @ 2003-11-15 17:24 UTC (permalink / raw)
  To: 9fans

> There's only one problem with the pleasantly trivial solution above.  The
> unices still have unidirectional pipes, so I can't read and write the
> returned fd.

You can use socketpair to get a two-way pipe.

Russ


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-15 17:24     ` Russ Cox
  2003-11-15 16:31       ` Sam
@ 2003-11-16  4:14       ` boyd, rounin
  2003-11-16  4:46         ` William Josephson
  1 sibling, 1 reply; 11+ messages in thread
From: boyd, rounin @ 2003-11-16  4:14 UTC (permalink / raw)
  To: 9fans

> You can use socketpair to get a two-way pipe.

surely you jest.

8th Ed had bi-directional pipes [cross connected streams].

streams, not sewers, nor sockets.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-16  4:14       ` boyd, rounin
@ 2003-11-16  4:46         ` William Josephson
  2003-11-16  7:12           ` boyd, rounin
  0 siblings, 1 reply; 11+ messages in thread
From: William Josephson @ 2003-11-16  4:46 UTC (permalink / raw)
  To: 9fans

On Sun, Nov 16, 2003 at 05:14:45AM +0100, boyd, rounin wrote:
> > You can use socketpair to get a two-way pipe.
>
> surely you jest.
>
> 8th Ed had bi-directional pipes [cross connected streams].

Most modern Unix variants have bidirectional pipes, too.
Except when they don't.  As ugly as it is, socketpair is
the portable way to make the bidirectional pipe.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] TLSServer?
  2003-11-16  4:46         ` William Josephson
@ 2003-11-16  7:12           ` boyd, rounin
  0 siblings, 0 replies; 11+ messages in thread
From: boyd, rounin @ 2003-11-16  7:12 UTC (permalink / raw)
  To: 9fans

> Most modern Unix variants have bidirectional pipes, too.
> Except when they don't.  As ugly as it is, socketpair is
> the portable way to make the bidirectional pipe.

sockets?  where shall i begin?



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-11-16  7:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 14:25 [9fans] TLSServer? Sam
2003-11-10 15:35 ` David Presotto
2003-11-10 15:41 ` Russ Cox
2003-11-15 16:01   ` Sam
2003-11-15 17:24     ` Russ Cox
2003-11-15 16:31       ` Sam
2003-11-16  4:14       ` boyd, rounin
2003-11-16  4:46         ` William Josephson
2003-11-16  7:12           ` boyd, rounin
2003-11-10 17:21 ` William Ahern
2003-11-10 20:10 ` Andrew Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).