-
Notifications
You must be signed in to change notification settings - Fork 25
Raw Socket API: Support for secure sockets #10
Comments
As for secure UDP, it's your suggestion Claes :) A spec exists and it is implemented (OpenSSL does have support for instance). I personally don't know of use for secure UDP, but why not. Yes, client authentification must be available. There are use cases when you want to be certain that you are talking with the real (authentified server) and the server wants to be certain that the client is who it pretends it is. Yes, constructor must be given keys, etc. It is quite complicated. |
On Jul 4, 2013 7:19 PM, "Lin Ke-Fong" [email protected] wrote:
The "why not" is always easy to answer: Adding features to the web platform comes at a very high cost. It requires Adding something only once we have strong use cases means not wasting time So we should only add secure UDP support if there are strong demand for it. / Jonas |
Regarding secure UDP, I agree with you. I don't know of actual use case. And adding support for anything related to security, is gonna be high cost. Besides, if secured datagram is really needed, then you can just use a secure TCP socket (SSL) to exchange a symmetric encryption key (like AES). Then open a UDP socket and exchange encrypted packet with peer. Still, Claes may have actual use cases that require it. Let's wait till he's back. |
If UDP grows in usage, and people come to rely on it for communication, won't it be subject to surveillance like other Web content? If so, then that is pretty strong motivator to secure it from the start. |
Please keep in mind that the main use cases for the UDP and TCP socket APIs is compatibility with existing hardware and software. When deploying something new using WebSocket and PeerConnection is preferable since their security model enables us to expose them to all apps and pages. UDP and TCP sockets can only be exposed to just signed ones. To put it another way: I hope that UDPSocket usage doesn't grow in usage. I hope PeerConnection does. PeerConnection already has nice features like, goes through firewalls, protects the remote party, and is encrypted. |
@sicking good point :) |
Some notes/ questions on secure sockets follow below. I hope that 4D, and/or other security experts, could provide input to be discussed at the Toronto meeting. I guess that in most cases something very easy is enough. Then there are use cases, e.g. corporate e-mail, which will require a more detailed control. Questions to be discussed follow:
|
Simplest (and probably most common) case for client socket is to take the server's certificate, authenticate it, and do the key exchange (SSL handshake), then the secure session is open and running. This is what happens when using SSL for HTTPS or emails (SMTP, IMAP). To add support for that scenario, from an API point of view, would just require adding a secureFlag in constructor and an UpgradeToSecure() method (STARTTLS). This is the simplest case, the client doesn't authenticate itself, no need to manage keys and stuff. Because the API is also intended to be rather complete, client authentication must be supported too. This will require to add options/arguments to specify security credentials (public key, certificate, etc). Server side is the more complicated because of wide range of options. |
Ok, thanks Ke-Fong. Looking into the specification this would mean:
The addition of startTLS() should be quite straightforward and I can make a proposal. For Client autjentication and and TCPServer socket I would be happy for more expert input. |
On Mon, Aug 19, 2013 at 2:02 AM, Claes Nilsson [email protected] wrote:
What would happen to data that is sent between startTLS() is called,
Sounds good. / Jonas |
Another option is to have two more ReadyStates:
This means that the first step for send() would be:
|
A STARTTLS initiates the TLS/SSL handshake, authentifying peers and negociating encryption keys, this can take a little time and may fail for various reasons (unable to validate certificate, unsupported encryption method, etc). It of course requires a readyState and an event (for example "onsecured" or "onupgraded") when the handshake complete. I don't think it makes sense to send (queue) data while waiting for the handshake to complete : Why send data when you're not even sure that your peer is authentified and secure communication is possible. Regarding the "open" and "opensecure" readyStates, I don't think it is a good idea to have to two states for "open". For instance, code for SMTP in SSL (port 465) and non-SSL (25) differs only in connection. Otherwise this is transparent for user. Having to states would require two if cases to check for state. Would rather recommend to make "secure" an attribute instead. |
Thanks Ke-Fong. A potential definition of an upgradeToSecure() method based on promises could be: Method definition: Promise upgradeToSecure (); Upgrades an existing insecure TCP connection to an encrypted (TLS or SSL) connection, instead of using a separate port for encrypted communication. This method is known as “STARTTLS”. No parameters. Return type: Promise Stepwise description: The upgradeToSecure method when invoked must run the following steps:
|
Please avoid throwing exceptions - always return the promise and then asynchronously call the error instead. |
Ok, thanks for comments Marcos. I am not yet sure on how to design methods based on promises. Looking forward to your page https://github.com/w3ctag/promises-spec-text :-). I am also not sure when a task needs to be queued. Compare with the TCPSocket constructor step 7. Here I state "Attempt to connect to the requested address and port in the background (without blocking scripts).". Could we have some wording analogous to this for STARTTLS, e.g. For the operation completing successfully I just follow the same pattern as the Task Scheduler API. |
Comment from Patrcik Manus/Mozilla:
[Claes] Patrick, please see the discussion at #10 . |
RFC 6520 lists a couple of reasons in the context of TLS/DTLS. https://tools.ietf.org/html/rfc6520. I'm not sure if and how they intersect with modern web apps, though. The mobile shell also uses it. http://mosh.mit.edu/. I'm not sure if the project would have any interest in a Web 2.0 port. |
Support for secure sockets need more investigation. Some issues:
The text was updated successfully, but these errors were encountered: