-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate TLS mutual auth support #27
Comments
Do you really mean MTLS, or do you mean mutual auth? |
Please see this comment: https://forums.swift.org/t/generic-http-client-library-pitch/23341/8. Yes, mutual TLS for auth (https://tools.ietf.org/html/draft-ietf-oauth-mtls-03 ) |
Ok, cool: we should probably be consistent in calling that “TLS Mutual Auth” rather than MTLS, which is an ambiguous and uncommon abbreviation. |
This requirement comes from a spec which mandates use of TLS mutual auth and refers to it as MTLS. But I can try to avoid that terminology here. : ) |
Yeah, I saw that in the spec! It’s a strange choice. 😂 Regardless, the requirement is reasonable and NIO has the hooks to support it, though there are problems with the interaction with HTTP/2 and connection pooling that need to be considered. |
Many thanks Cory. Actually I was referring to another API spec which I'll link by private email for your interest. |
@markfinlabs As Cory points out, NIOSSL does support mutual authentication today which works just fine for HTTP/1. I wasn't sure if that was clear from Cory's comment. This is how you would use it: client
And this server
|
Thanks for this reply, very helpful. We should get a chance to test this next week and I'll report back. |
@markfinlabs Did you get the chance to test it? |
Hi @artemredkin. Sorry to drop the ball on this - our key engineer working on NIO suddenly resigned. I had a go myself to test this tonight but can you tell me something basic which I couldn't find quickly in the docs: how best to generate |
@markfinlabs hi, unfortunately there is no way to do that out of the box. If you need func escape(_ value: String) -> String? {
return value.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
}
func encode(key: String, value: String) -> String? {
return escape("\(key)=\(value)")
}
func encode(parameters: [String: String]) -> String {
return parameters.compactMap(encode).joined(separator: "&")
}
request.body = .string(encode(parameters: ["a": "b"])) |
Interesting. Do you think we should add convenience API for |
Good idea, filed #50 |
Thanks @artemredkin for code sample and just to update you. I tested with the external server (external company) I am working with and unfortunately got |
I think that’s because of this: https://github.com/google/boringssl/blob/master/PORTING.md#tls-renegotiation Because renegotiation is a mess protocol and security wise, BoringSSL (and therefore nio-ssl) disables it by default. But @Lukasa will know in much more detail and if that’s something we would ever want to support despite the messiness. I’d say definitely not with at least the user asking for it to be turned on. |
Thanks @weissi, that makes sense. I'll send you a private reply via the email on your GitHub home page to avoid putting some information into the public domain. |
We should add renegotiation support, but have it off by default, and require explicit user intervention to enable it. See apple/swift-nio-ssl#110 for tracking that. With that feature in place it should be possible to work around this issue. |
Thanks @Lukasa, sounds super helpful as I don't think the server I am interfacing with is likely to change quickly. I will still endeavour to test with another server (different company) this week. |
@markfinlabs, @Lukasa implemented this yesterday: apple/swift-nio-ssl#111 . So in theory you can test this today using |
Thanks @weissi, great news. I can wait for v2.2.0 to re-check. |
I have now tested with a second server and everything works fine (including server using custom CA). 😀 |
Great news! Thank you for testing this. |
No pbs, I'll check the renegotiation support after NIO SSL v2.2.0 is released and report back here. |
Just coming back to this for completeness. I successfully used TLS mutual auth with the original server I had a problem with using these options: tlsConfiguration.certificateVerification = .none
tlsConfiguration.renegotiationSupport = .once So thanks for your efforts here everyone. |
Hey @weissi this issue is related to a TLS authentication. Can you help me with that? |
No description provided.
The text was updated successfully, but these errors were encountered: