Skip to content

Way of going from server::Request to the SSL connection #1241

Closed

Description

@alex

hyper 0.10 had https://docs.rs/hyper/0.10.12/hyper/server/request/struct.Request.html#method.ssl to take you from a server request to the SSL connection. This was needed for things like client certificates.

I don't see an equivilant to this functionality in 0.11, it'd be great to bring it back!

Activity

  1. seanmonstar commented on Jul 3, 2017

    @seanmonstar
    Member

    One could currently implement a ServerProto that is able to check the transport for anything before saying it is OK to be used with a Service.

  2. alex commented on Jul 3, 2017

    @alex
    ContributorAuthor

    I'm still learning my way around the tokio ecosystem, but for my application just being able to filter before my application isn't enough, I need the actual contents of the client certificates in the app itself.

  3. seanmonstar commented on Jul 3, 2017

    @seanmonstar
    Member

    A Service serves a connection. Would you need the certificate within the context of each request made on the same connection?

  4. alex commented on Jul 3, 2017

    @alex
    ContributorAuthor

    Yup. (https://github.com/alex/ct-tools is the application, it's an app specifically geared to help people interact with their client certs + certificate transparency)

  5. seanmonstar commented on Jul 3, 2017

    @seanmonstar
    Member

    So, we're considering that Request and Response gain a typemap-like thing that can contain extensions. The original thought is that it would be able to contain HTTP2 extensions, but it could be used to store anything. Perhaps a wrapper can set req.extensions_mut().set(some_cert), and users' services can check for the req.extensions().get::<Cert>() (or whatever the type is).

  6. alex commented on Jul 3, 2017

    @alex
    ContributorAuthor

    I'm not very familiar with the internals of hyper -- is the hyper 0.10 approach of exposing the ssl<T>() method no longer technically possible, or just not consistent with the API you're trying to offer?

  7. seanmonstar commented on Jul 3, 2017

    @seanmonstar
    Member

    The Request and Response have no concept of the underlying transport by design. So that previous method can't really work.

  8. alex commented on Jul 3, 2017

    @alex
    ContributorAuthor

    I suppose the extensions dealio makes as much sense as anything, given that constraint.

  9. seanmonstar commented on Jul 13, 2017

    @seanmonstar
    Member

    Another alternative is that since the Service is constructed at the start of the connection and used to serve all requests on it, the certificate could be grabbed in a NewService implementation and stored on the Service.

    struct ClientCertService {
        cert: Option<Cert>,
    }
    
    impl Service for ClientCertService {
        fn call(req: Request) -> Self::Future {
            // check self.cert
        }
    }

    This would require NewService to gain a way to inspect the transport...

  10. alex commented on Jul 13, 2017

    @alex
    ContributorAuthor

    Hmmm, that makes a fair bit of sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions