Re: sslio as a STARTTLS wrapper (was Re: sslio error description incomplete/wrong)

Scott Gifford <[email protected]>
Newsgroups gmane.comp.misc.pape.general
Message-ID <[email protected]>
Scott Gifford <[email protected]> writes:

[...]

> My feeling is that we might as well just use 3 pipes, one for control,
> one for read, and one for write.  It keeps everything to a single
> purpose, and leaves the possibility of adding to the protocol, to
> allow things like reading SSL settings over the pipe, or turning SSL
> on and off at various times.

[...]

> I think it's a bad idea to hardcode file descriptor numbers.  That
> makes things difficult if a similar protocol adapter is released
> adding different functionality, and file descriptor numbers have to be
> coordinated between any projects adding layers on top of an UCSPI
> server.
>
> Instead, we can simply put the file descriptor number into an
> environment variable, then get it back out in the client.

Here's a proposal of an UCSPI-TLS standard, and a link to a prototype
implementation using ucspi-ssl and qmail-smtpd (sorry, I know the code
better so it was easier to throw something together fast).  I look
forward to feedback as we refine or replace this.  :)

http://www.suspectclass.com/~sgifford/ucspi-tls/

* The UCSPI-TLS server makes optional SSL services available to the
  client by providing three file descriptors: a control socket, a
  reading pipe, and a writing pipe.

  The file descriptor number of the control socket will be in the
  environment variable SSLCTLFD.

  The file descriptor number of the reading pipe will be in the
  environment variable SSLREADFD, and the file descriptor numer of the
  writing pipe will be in the environment variable SSLWRITEFD.

  It's possible for all three of these file descriptors to be the
  same.

* Standard in and standard out (file descriptors 0 and 1) will be left
  connected directly to the socket, for unencrypted communication.

* The control socket must accept at least these two commands:

  y: Start TLS.

  Y: Start TLS, and send optional SSL connection information back over
     the control socket

* The SSL connection information will be in the in the form of an
  environment string, with zero or more environment variables,
  terminated by two ASII NUL's.  Each environment variable is stored
  as "VAR=val\0", and an additional trailing \0 is used to indicate
  the end of all environment variables.  If there are no variables to
  set, "\0\0" should be used.

  Where possible, the environment variables set should be the same
  ones as Apache's mod_ssl:
 
        http://httpd.apache.org/docs-2.0/mod/mod_ssl.html

* When TLS is started, the UCSPI-TLS server will take control of the
  socket, and the application is expected to switch to the file
  descriptors in SSLREADFD and SSLWRITEFD for all future
  communications.  Using the regular socket after activating TLS will
  probably just confuse the client.

----ScottG.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.