¿Letsencrypt en un puerto no estándar?

¿Letsencrypt en un puerto no estándar?

Tengo un fenómeno extraño que no puedo explicar. Estoy ejecutando un nginx con letsencrypt y un servidor de aplicaciones Java. El nginx escucha en 443 y el servidor de aplicaciones en 8008. Ambos usan SSL y el mismo certificado. Nginx funciona de maravilla, pero el servidor de aplicaciones es extraño:

Prueba esta URL

  • El cartero carga sin error
  • CURL se carga sin error
  • Safari en macOS se carga sin errores
  • Chrome en macOS carga la página, pero la recuperación de JavaScript /openapi.jsonfalla, tambiénla descarga directa
  • Firefox en macOS falla (no se puede establecer una conexión segura)
  • Safari en iOS falla

Usando curl -v --http1.1 https://frascati.projectkeep.io:8008/openapi/espectáculos:

curl -v --http1.1 https://frascati.projectkeep.io:8008/openapi/
*   Trying 18.218.218.93...
* TCP_NODELAY set
* Connected to frascati.projectkeep.io (18.218.218.93) port 8008 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=frascati.projectkeep.io
*  start date: Jan 27 13:46:16 2020 GMT
*  expire date: Apr 26 13:46:16 2020 GMT
*  subjectAltName: host "frascati.projectkeep.io" matched cert's "frascati.projectkeep.io"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
> GET /openapi/ HTTP/1.1
> Host: frascati.projectkeep.io:8008
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer: 
> 
< HTTP/1.1 200 OK
< accept-ranges: bytes
< content-length: 1394
< cache-control: public, max-age=86400
< last-modified: Mon, 27 Jan 2020 16:05:19 GMT
< date: Mon, 27 Jan 2020 18:11:52 GMT
< content-type: text/html;charset=UTF-8
< 
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>

Actualizar

A modo de comparación, aquí se muestra la salida de nginx para elmismo contenido:

 curl -v https://frascati.projectkeep.io/openapi/
*   Trying 18.218.218.93...
* TCP_NODELAY set
* Connected to frascati.projectkeep.io (18.218.218.93) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=frascati.projectkeep.io
*  start date: Jan 27 13:46:16 2020 GMT
*  expire date: Apr 26 13:46:16 2020 GMT
*  subjectAltName: host "frascati.projectkeep.io" matched cert's "frascati.projectkeep.io"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
> GET /openapi/ HTTP/1.1
> Host: frascati.projectkeep.io
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer: 
> 
< HTTP/1.1 200 OK
< Server: nginx/1.16.1
< Date: Mon, 27 Jan 2020 18:07:02 GMT
< Content-Type: text/html;charset=UTF-8
< Content-Length: 1394
< Connection: keep-alive
< accept-ranges: bytes
< cache-control: public, max-age=86400
< last-modified: Mon, 27 Jan 2020 16:05:19 GMT
< 
<!-- HTML for static distribution bundle build -->

¿Qué extraño?

Respuesta1

Como salió en los comentarios a la pregunta:

  1. Su servidor de aplicaciones utiliza Java 8 con JSSE,

  2. Tiene TLSv1.3configurado entre los posibles protocolos TLS.

El problema descrito es causado por lafalta de soporte para TLSv1.3en la implementación SSLContext estándar de Java. Entonces:

  • curlpropone TLShasta la versión 1.3
  • el servidor acepta, luego se ahoga

Observación: Si está utilizando Tomcat, lo OpenSSLImplementationadmite TLSv1.3si la biblioteca nativa subyacente lo hace.

información relacionada