Skip to content

Add strict TLS mode #346

@EtiennePerot

Description

@EtiennePerot

It appears that Syncplay's approach to TLS is to send an initial message over the TCP stream to upgrade the connection to use TLS:

{"TLS": {"startTLS": "send"}}

The server then acknowledges this TLS upgrade request with:

{"TLS": {"startTLS": "true"}}

And then the client sends the TLS ClientHello message, i.e. the TLS handshake begins in earnest, using the same TCP connection.

For this to work properly, the process handling the TCP connection has to speak Syncplay's protocol, or at least it has to understand this particular {"TLS": {"startTLS": "send"}} message. In practice, this means that the Syncplay server itself needs to have access to the certificate and private key.

As a general principle, each process that has such a key loaded in its working memory is a liability -- they may each have their own TLS implementations that may or may not be robust against the latest side-channel attacks or whatnot. In general, the fewer things handling a sensitive piece of data, the better. For this reason, it's useful for most HTTP-like application protocols (e.g. Matrix.org, CalDAV, Mozilla Sync, etc.) to support being run through a reverse proxy that does all the TLS encapsulation, and then passes on the decrypted traffic through a lo-only connection or through a socket file on the machine.

Since Syncplay's protocol isn't HTTP-like, it can't be run through a reverse HTTP proxy. As such, I was trying to get it to work through stunnel, a similar utility that handles the connection, handles all the TLS aspects of it, and forwards all the unencrypted traffic to a local Syncplay server that listens on lo only. However, because Syncplay's client first sends {"TLS": {"startTLS": "send"}} to initiate TLS, this confuses stunnel as it expects the client to directly start with the TLS ClientHello message.

Hence the following request: Would it be possible to add a TLS-only mode to both the Syncplay server and client, which directly talks TLS without this initial startTLS message? This would have the following benefits:

  • No longer susceptible to Man-in-the-Middle attacks (Opportunistic approaches to TLS are inherently susceptible to such attacks)
  • Ability to delegate TLS-handling to another process than Syncplay itself, such as stunnel.
  • (Bonus) Ability to run Syncplay in an inetd-like fashion. As a personal Syncplay server is likely only seldomly used, the ability to have it automatically exit when no one is using it and re-started whenever someone connects would be a nice resource savings. stunnel provides just such a mode.

Somewhat-related issue: #245

Metadata

Metadata

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