Results 1 to 5 of 5

Thread: Passing SSL connection details to application

  1. #1
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159

    Passing SSL connection details to application

    I am currently finishing off an SSL plugin for IceCS (C#).
    One of the things I would like to do is pass client certificate
    information for a connection to the application, that is,
    through Ice.Current.con().

    Now, a generic way to do so would be to add an (opaque)
    member to Connection, such as (in C# syntax):
    Code:
        
        public interface _ConnectionOperationsNC
        {
            ...
            object info();  <-- new member
        }
    This would also require to add the same kind of new member
    to the Transceiver interface, and the method implemention
    in the ConnectionI class would be:
    Code:
            public object info()
            {
                return _transceiver.info();
            }
    My Transceiver implementation (SslTransceiver in this case)
    can then implement its info() method in any way it sees fit.

    All the application needs to do is cast the object back
    to a known type. Example (I modified the Hello server to
    show the name on the client certificate):
    Code:
        public override void sayHello(Ice.Current current)
        {
            string msg = string.Empty;
            SslStream ssl = current.con.info() as SslStream;
            if (ssl != null) {
                X509Certificate cert = ssl.RemoteCertificate;
                msg = cert.Subject + " says: ";
            }
            msg += "Hello World!";
            System.Console.Out.WriteLine(msg);
        }
    Does that make sense to anyone?

    Karl
    Karl Waclawek

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    Providing this type of information is on our TODO list, but we don't have an estimate on when it will be included in a release.

    I realize you're probably trying to find a way to do this without changing the Ice core, but I think a better approach is something like this:
    Code:
    // Slice
    interface TransportInfo {
        string toString();
    };
    interface X509Certificate { ... };
    interface SslTransportInfo extends TransportInfo {
        X509Certificate getCertificate();
        ...
    };
    interface Connection {
        TransportInfo getTransportInfo();
        ...
    };
    Naturally, this is more complicated, because now we have to wrap the X509 information. But at least it's portable and fits within the Ice object model.

    By the way, the next release of Ice for C# will include the thread-per-connection concurrency model, which will be necessary if the SslStream class in .NET 2.0 cannot be used with the thread-pool model.

    Take care,
    - Mark

  3. #3
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by mes
    I realize you're probably trying to find a way to do this without changing the Ice core, but I think a better approach is something like this:
    Code:
    // Slice
    interface TransportInfo {
        string toString();
    };
    interface X509Certificate { ... };
    interface SslTransportInfo extends TransportInfo {
        X509Certificate getCertificate();
        ...
    };
    interface Connection {
        TransportInfo getTransportInfo();
        ...
    };
    Naturally, this is more complicated, because now we have to wrap the X509 information. But at least it's portable and fits within the Ice object model.
    I agree with the TransportInfo interface. However, there could be multiple plugins for Ssl - one relying on .NET framework, another relying on OpenSSL. Each may have some unique information to expose not present in the other. Therefore it might be better to simply allow the plugin to define the derived interface instead of constraining the information one can pass with a predefined SslTransportInfo definition.

    Quote Originally Posted by mes
    By the way, the next release of Ice for C# will include the thread-per-connection concurrency model, which will be necessary if the SslStream class in .NET 2.0 cannot be used with the thread-pool model.
    I have to admit I do not fully understand the implications of the ICE thread-pool model. From what I can see from the source, _transceiver.write() calls are serialized through a mutex. So should it then matter that SslStream is not thread-safe?

    Is the Session demo a good way to test the thread-pool model with SslStream?

    Karl
    Karl Waclawek

  4. #4
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    In my contrived example, plugins would define their own derived interfaces.

    Regarding the thread pool: I'm not familiar with the SslStream functionality in .NET 2.0, but you mentioned it only supported blocking operations. The thread pool uses non-blocking sockets, so it's quite possible that the thread pool will not behave properly when using an SslStream. There is a similar situation in Java, because the SSL interfaces in J2SE 1.4 do not support select-style functionality, therefore the IceSSL plugin for Java can only be used in thread-per-connection mode.

    - Mark

  5. #5
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by mes
    Hi,
    In my contrived example, plugins would define their own derived interfaces.
    OK, I was thinking the same.
    I have it working right now like you suggested.

    So, I am able to get at lower level information to extract client
    authentication info. That is fine if the SSL endpoint is at the server.

    Now I am faced with a more general problem:
    What if I use Glacier2? The server will not have an SSL endpoint
    directly connected to the client anymore.

    I haven't been able to figure out a way how the existinig Glacier2 would
    be able to forward such client credentials information.

    And even if it was modified to somehow add information to the
    context, this would not be an elegant solution, as the server now would
    have *two* ways to access that info, either using the TransportInfo
    interface, or reading the context.

    This almost looks like the proper way would be to establish some
    "secure circuit" between client and server, regardless of underlying
    transport. But then the use of SSL would be redundant.
    There is an OMG spec called SECP, but it appears quite complex.

    Quote Originally Posted by mes
    Regarding the thread pool: I'm not familiar with the SslStream functionality in .NET 2.0, but you mentioned it only supported blocking operations. The thread pool uses non-blocking sockets, so it's quite possible that the thread pool will not behave properly when using an SslStream. There is a similar situation in Java, because the SSL interfaces in J2SE 1.4 do not support select-style functionality, therefore the IceSSL plugin for Java can only be used in thread-per-connection mode.
    - Mark
    So far it works for me.

    Karl
    Karl Waclawek

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 12-15-2009, 08:36 PM
  2. Intermittent ssl connection failures (hanging)
    By gumshoe in forum Help Center
    Replies: 5
    Last Post: 08-14-2007, 07:23 PM
  3. Can't close ssl connection?
    By liurunfeng in forum Help Center
    Replies: 16
    Last Post: 05-22-2007, 12:10 AM
  4. passing objects
    By nicole in forum Help Center
    Replies: 5
    Last Post: 02-12-2007, 09:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •