uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.84k stars 569 forks source link

SSLApp - SSL_ERROR_SYSCALL #1077

Closed felipeavilis closed 2 months ago

felipeavilis commented 2 months ago

After change my server to SSL im getting this error:

$ curl https://stream.domain.com:9001 -iv
*   Trying x.x.x.x:9001...
* Connected to stream.domain.com (x.x.x.x) port 9001 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to stream.domain.com:9001
* Closing connection 0
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to stream.domain.com:9001

I noted that SSL options is not checking file. Even if file does not exists it does not send me any error.

const app = uWS.SSLApp();

app.ws("/*", {
  /* Options */
  idleTimeout: 32,
  maxBackpressure: 1024,
  maxPayloadLength: 16 * 1024 * 1024,
  commpression: 0,

  /* SSL Options */
  key_file_name: './tls/server.key',
  cert_file_name: './tls/server.crt',
  ca_file_name: './tls/server.full-ca.bundle',
  dh_params_file_name: './tls/dhparam.pem',

What am i doing wrong?

uNetworkingAB commented 2 months ago

App.listen will fail

felipeavilis commented 2 months ago

App.listen will fail

Tks for the quickly reply @uNetworkingAB! I found the error. I was setting SSL options in app.ws insted of app.

const app = uWS.SSLApp({
  /* SSL Options */
  key_file_name: './tls/server.key',
  cert_file_name: './tls/server.crt',
  ca_file_name: './tls/server.full-ca.bundle',
  dh_params_file_name: './tls/dhparam.pem',
});

app.ws("/*", {
  /* Options */
  idleTimeout: 32,
  maxBackpressure: 1024,
  maxPayloadLength: 16 * 1024 * 1024,
  commpression: 0,
felipeavilis commented 2 months ago

Close it