Escenario: HTTPs e SNI

De MediaWiki
Revisión del 11:10 9 feb 2026 de Joselv (discusión | contribuciones) (→‎Fortificando HTTPS)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Ir a la navegación Ir a la búsqueda

Introdución

Esquema de rede do escenario.

Configuración do escenario

Configuración do server

Tómase como punto de partida o servidor web ó remate do escenario anterior. Un punto a ter en conta á hora de implantar esta práctica é que van convivir no mesmo servidor sitios web https cun socket propio e sitios web https compartindo o mesmo socket grazas a SNI.

Se vos resulta complicado ou con vistas a montalo en prácticas co alumnado e para distinguir as dúas técnicas preferides que non convivan no mesmo server, o único que habería que facer é eliminar as IPs adicionais e deshabilitar os sitios web de www.tenda1.example e www.tenda2.example co comando a2dissite.

Para deshabilitar os sitios tendaprobas, tanto por http como por https:

$ sudo a2dissite www.tenda1.example.conf
$ sudo a2dissite www.tenda1.example-ssl.conf 
$ sudo a2dissite www.tenda2.example.conf
$ sudo a2dissite www.tenda2.example-ssl.conf 
$ sudo systemctl reload apache2
$ sudo apache2ctl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   127.0.0.1 (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

Configurar a resolución DNS dende os clientes

Para poder acceder ós sitios web dende os clientes hai que configurar a resolución dns. Igual que no escenario anterior hai dúas solucións:

  • Instalar un servidor dns cunha zona para cada un dos dominios probas1.example, probas2.example e probas3.example
  • Nos equipos cliente poden engadirse as entradas correspondentes ós hosts www.probas1.example, www.probas2.example e www.probas3.example no arquivo hosts.

Aínda que non é a mellor solución, por ser un escenario de probas escolleuse a segunda por ser a máis rápida e sinxela.

A modo de exemplo así quedaría o arquivo hosts dun cliente linux:

$ cat /etc/hosts
127.0.0.1       localhost
127.0.1.1       lxd
192.0.2.11      www.tenda1.example
192.0.2.12      www.tenda2.example
192.0.2.13      www.probas1.example www.probas2.example www.probas3.example

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

SNI

No escenario anterior cada dominio accesible por https tiña un socket (IP/porto) adicado. As razóns hai que buscalas no funcionamento do protocolo http e na forma de establecemento da canle cifrada SSL/TLS. Supoñamos por un momento que un servidor web teña unha única IP para todos os dominios aloxados; por exemplo, www.tendaprobas1.com e www.tendaprobas2.com. Nesta situación, cando o servidor web Apache recibe unha solicitude http dun cliente, revisa a cabeceira Host da solicitude para ver cal dos dominios aloxados (virtualhosts baseados en nome) é o que lle interesa ó cliente. Desta forma, pode consultar o arquivo de configuración correcto e recuperar a información pedida polo cliente. Na seguinte imaxe pode observarse unha solicitude http onde na cabeceira Host especifícase que o dominio de interese é www.tendaprobas1.com:

Mensaxe http coa cabeceira Host especificando o dominio www.tendaprobas1.com

Fig. Cabeceira HTTP coa cabeceira Host indicando o sitio web de interese

Se usamos https é de supoñer que o cliente debería recibir o certificado asociado ó dominio polo que pregunta cando se vaia a establecer a canle SSL/TLS. Pero aquí é onde aparece o problema; xa que durante as mensaxes intercambiadas para crear a canle SSL/TLS, non se especifica o dominio e a canle cifrada crease antes de que o cliente envíe a solicitude http coa cabeceira Host. Polo tanto, o servidor Apache non sabe que certificado usar por que non sabe que dominio concreto quere visitar o cliente:

SSL/TLS sen SNI

Fig. Establecemento dunha canle SSL/TLS e a problemática do certificado a usar

Se cada dominio está nunha IP (ou socket) diferente, este problema desaparece ó non poder equivocarse o servidor, xa que o único que ten que facer o servidor é usar o certificado do sitio web asociado á IP onde contacta o cliente:

SSL/TLS sen SNI pero con varias IPs

Fig. Establecemento de canles SSL/TLS usando sockets adicados a cada sitio web

A solución un dominio-unha IP funciona, pero desaproveita direccións. Para superar esta limitación creouse unha extensión de TLS chamada SNI (Server Name Indication), onde o cliente durante o establecemento da canle TLS indica o dominio ó que se quere conectar; permitindo desta forma que o servidor web seleccione o certificado axeitado.

SSL/TLS con SNI

Fig. Establecemento da canles SSL/TLS usando SNI

A continuación pode verse nos seguintes paquetes capturados co sniffer Wireshark o establecemento da conexión entre o cliente e o servidor. No primeiro podemos ver como o cliente envía o nome de dominio na extensión SNI do TLS e no segundo a resposta do servidor enviando o certificado correspondente:

Establecemento SSL/TLS con extensisón SNI

Fig. O cliente establece a conexión e indica o dominio de interese (www.tendaprobas1.com) na extensión SNI

Establecemento SSL/TLS con extensisón SNI - resposta do servidor

Fig. Resposta do servidor enviando o certificado axeitado para www.tendaprobas1.com

SNI fai que un servidor poida utilizar múltiples certificados nunha mesma dirección IP e número de porto, permitindo que múltiples sitios web seguros (https) poidan ser servidos nunha mesma IP sen que todos os sitios compartan un certificado común. Este concepto é equivalente ó concepto de host virtuais baseados en nome de http/1.1 pero para https. SNI non está limitado a https, estando dispoñible para calquera outro servizo que funcione sobre TLS.

Non todos, pero a gran maioría dos navegadores, servidores e proxys web soportan SNI e na seguinte URL pode verse unha listaxe listaxe concreta.

Apache con HTTPS e SNI

Sitio por defecto

O sitio por defecto será o sitio ó que vaia Apache cando reciba unha petición http destinada a unha IP-porto e que non se poida asignar a un virtualhost concreto ó comparar a cabeceira Host e a directiva ServerName dos virtualhosts activos no servidor. O acceso por http ó sitio por defecto xa está activado no escenario anterior e procederemos a activar o acceso por https que usan os certificado snake-oil:

sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost 192.0.2.13:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo nano /etc/apache2/sites-available/default-ssl.conf
<IfModule mod_ssl.c>
        <VirtualHost 192.0.2.13:443>
                ServerAdmin webmaster@localhost
                ...
                SSLEngine on

                #   A self-signed (snakeoil) certificate can be created by installing
                #   the ssl-cert package. See
                #   /usr/share/doc/apache2/README.Debian.gz for more info.
                #   If both key and certificate are stored in the same file, only the
                #   SSLCertificateFile directive is needed.
                SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
                SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
                ...
sudo a2ensite default-ssl.conf
sudo systemctl reload apache2
sudo apache2ctl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
192.0.2.11:443         www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example-ssl.conf:1)
192.0.2.11:80          www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example.conf:1)
192.0.2.12:443         www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example-ssl.conf:1)
192.0.2.12:80          www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example.conf:1)
192.0.2.13:80          server5C (/etc/apache2/sites-enabled/000-default.conf:1)
192.0.2.13:443         server5C (/etc/apache2/sites-enabled/default-ssl.conf:2)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default 
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

Nos arquivos de configuración do sitio por defecto /etc/apache2/sites-enabled/000-default.conf e /etc/apache2/sites-enabled/default-ssl.conf o DocumentRoot está definido como /var/www/html. Para modificar a páxina index.html hai que editala:

$ sudo nano /var/www/html/index.html

<html>
<head><title>Sitio Web por defecto</title></head>
<body>
<b>Sitio Web por defecto</b>
</body>
</html>

Accedendo cun navegador a 192.0.2.13 por http e https (aceptando o certificado autoasinado 'snakeoil') cárgase a páxina principal:

Sitio Web por defecto

Sitio Web por defecto https

Fig. Acceso por http e https ó sitio por defecto

Sitio www.probas1.example

Segundo o enunciado, o acceso ó dominio www.probas1.example é unicamente a través de http; polo tanto, creamos un arquivo de configuración para acceder por http a www.probas1.example:

$ sudo nano /etc/apache2/sites-available/www.probas1.example.conf
<VirtualHost 192.0.2.13:80>
    ServerName www.probas1.example
    ServerAdmin webmaster@probas1.example
    DocumentRoot /var/www/probas1.example
    ErrorLog ${APACHE_LOG_DIR}/probas1.example_error.log
    CustomLog ${APACHE_LOG_DIR}/probas1.example_access.log combined
</VirtualHost>

Creación do directorio especificado no DocumentRoot e creación da páxina index.html do sitio:

$ sudo mkdir /var/www/probas1.example
$ sudo nano /var/www/probas1.example/index.html
<html>
<head><title>Sitio de PROBAS 1</title></head>
<body>
<b>Sitio de PROBAS 1</b>
</body>
</html>

Activación do sitio e verificación:

$ sudo a2ensite www.probas1.example.conf 
$ sudo systemctl reload apache2
$ sudo apache2ctl -S
...

VirtualHost configuration:

192.0.2.11:443         www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example-ssl.conf:1)
192.0.2.11:80          www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example.conf:1)
192.0.2.12:443         www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example-ssl.conf:1)
192.0.2.12:80          www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example.conf:1)
192.0.2.13:443         server5C (/etc/apache2/sites-enabled/default-ssl.conf:2)
192.0.2.13:80          is a NameVirtualHost
         default server server5C (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost server5C (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost www.probas1.example (/etc/apache2/sites-enabled/www.probas1.example.conf:1)
...

Fixarse como no mesmo socket <192.0.2.13,tcp,80> están dous sitios web diferentes (o sitio por defecto e www.probas1.example). Grazas a cabeceira Host que envía o cliente web, o servidor Apache sabe que páxina servir.

Acceso a www.probas1.example por http:

Sitio Web probas1

Fig. Acceso por http ó sitio www.probas1.example

No caso de acceder a www.probas1.example por https ocurrirá o seguinte:

A resolución dns de www.probas1.example é 192.0.2.13 (a IP do servidor web). O cliente web vai á IP 192.0.2.13 porto 443 e pide a páxina principal do dominio www.probas1.example Como non hai ningún sitio web no servidor que cumpra co anterior, o servidor web envía o certificado snakeoil e no caso de aceptalo devolve o sitio web por defecto. Sitio Web por defecto https

Fig. Acceso por https ó sitio www.probas1.example

Sitio www.probas2.example

Segundo o enunciado, o acceso ó dominio www.probas2.example será tanto de http coma de https; polo tanto teremos que crear dous arquivos de configuración, un para acceder por http e outro para acceder por https. Ademais, o acceso á carpeta segredo do sitio web ten que ser por https, bloqueándose o acceso no caso de facelo por http. Obrigar a usar https para acceder a un recurso pode facerse a través da directiva de configuración SSLRequireSSL.

Procedemos a crear o arquivo de configuración para http:

$ sudo nano /etc/apache2/sites-available/www.probas2.example.conf
<VirtualHost 192.0.2.13:80>
    ServerName www.probas2.example
    ServerAdmin webmaster@probas2.example
    DocumentRoot /var/www/probas2.example

    <Directory    /var/www/probas2.example/segredo>
        SSLRequireSSL
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/probas2.example_error.log
    CustomLog ${APACHE_LOG_DIR}/probas2.example_access.log combined
</VirtualHost>

Creamos o directorio especificado en DocumentRoot e editamos a páxina index.html do sitio:

sudo mkdir /var/www/probas2.example
sudo nano /var/www/probas2.example/index.html
<html>
<head><title>Sitio de PROBAS 2</title></head>
<body>
<b>Sitio de PROBAS 2</b>
</body>
</html>

Creamos a carpeta segredo e editamos a páxina index.html da carpeta segredo:

sudo mkdir /var/www/probas2.example/segredo                                                                                           
sudo nano /var/www/probas2.example/segredo/index.html
<html>
<head><title>TOP SECRET</title></head>
<body>
<b>TOP SECRET</b>
</body>
</html>

Creamos o certificado dixital autoasinado e gardámos o certificado e a clave privada na carpeta /etc/apache2/certificados:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/certificados/www.probas2.example.key -out /etc/apache2/certificados/www.probas2.example.crt
Generating a 2048 bit RSA private key
................+++
.........................................+++
writing new private key to '/etc/apache2/certificados/www.probas2.example.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:ES
State or Province Name (full name) [Some-State]:España
Locality Name (eg, city) []:Santiago
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Probas2 S.A.
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:www.probas2.example
Email Address []:admin@probas2.example

A continuación creamos o arquivo de configuración para https:

$ sudo nano /etc/apache2/sites-available/www.probas2.example-ssl.conf 
<VirtualHost 192.0.2.13:443>
    ServerName www.probas2.example
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/probas2.example
    SSLEngine on
    SSLCertificateFile /etc/apache2/certificados/www.probas2.example.crt
    SSLCertificateKeyFile /etc/apache2/certificados/www.probas2.example.key
    ErrorLog ${APACHE_LOG_DIR}/probas2.example_error.log
    CustomLog ${APACHE_LOG_DIR}/probas2.example_access.log combined
</VirtualHost>

Activamos o sitio ww.probas2.example tanto por http como por https:

$ sudo a2ensite www.probas2.example.conf 
$ sudo a2ensite www.probas2.example-ssl.conf 
$ sudo systemctl reload apache2
$ sudo apache2ctl -S
...
VirtualHost configuration:
192.0.2.11:443         www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example-ssl.conf:1)
192.0.2.11:80          www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example.conf:1)
192.0.2.12:443         www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example-ssl.conf:1)
192.0.2.12:80          www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example.conf:1)
192.0.2.13:443         is a NameVirtualHost
         default server server5C (/etc/apache2/sites-enabled/default-ssl.conf:2)
         port 443 namevhost server5C (/etc/apache2/sites-enabled/default-ssl.conf:2)
         port 443 namevhost www.probas2.example (/etc/apache2/sites-enabled/www.probas2.example-ssl.conf:1)
192.0.2.13:80          is a NameVirtualHost
         default server server5C (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost server5C (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost www.probas1.example (/etc/apache2/sites-enabled/www.probas1.example.conf:1)
         port 80 namevhost www.probas2.example (/etc/apache2/sites-enabled/www.probas2.example.conf:1)
...

Agora temos que:

  • No socket <192.0.2.13,tcp,80> hai tres sitios web (por defecto, www.probas1.example e www.probas2.example) e novamente grazas á cabeceira Host o servidor sabe cal debe servir.
  • No socket <192.0.2.13,tcp,443> hai dous sitios web (por defecto e www.probas2.example) e grazas á SNI o servidor sabe que certificado debe servir para establecer a canle cifrada, e permitir ó cliente autenticar ó servidor (saber se está conectado co verdadeiro server).

Analizando a saída do comando apache2ctl podemos ver que:

  • No port tcp/80 están dispoñibles o servidor por defecto, o sitio www.probas1.example e o sitio www.probas2.example.
  • No port tcp/443 están dispoñibles o servidor por defecto e o sitio www.probas2.example.

Probamos a acceder por http e https a www.probas2.example:

Sitio Web probas2

Sitio Web probas2 https

Fig. Fig. Acceso por http e https ó sitio www.probas2.example

No caso de acceder por http á carpeta segredo aparecerá un erro ó estar prohibido este tipo de acceso:

Cartafol segredo

Fig. Erro ó acceder por http á carpeta segredo do sitio www.probas2.com

Os erros de acceso por http a segredo quedan recollidos nos logs do sitio:

$ cat /var/log/apache2/probas2.example_error.log 
...
[Sun May 07 19:31:56.352785 2023] [ssl:error] [pid 3090:tid 140003761964800] [client 192.0.2.1:56556] AH02219: access to /var/www/probas2.example/segredo failed, reason: SSL connection required
ubuntu@server5C:~$

Pero o acceso por https está autorizado:

Cartafol segredo

Fig. Acceso autorizado por https á carpeta segredo do sitio www.probas2.example

Sitio www.probas3.example

Creación do arquivo de configuración para http. Emprégase a directiva Redirect para reenviar ós clientes que acceden por http a unha conexión segura https:

$ sudo nano /etc/apache2/sites-available/www.probas3.example.conf
<VirtualHost 192.0.2.13:80>
    ServerName www.probas3.example
    ServerAdmin webmaster@probas3.example
    DocumentRoot /var/www/probas3.example

    Redirect permanent / https://www.probas3.example/

    ErrorLog ${APACHE_LOG_DIR}/probas3.example_error.log
    CustomLog ${APACHE_LOG_DIR}/probas3.example_access.log combined
</VirtualHost>

Edición da páxina index.html do sitio:

$ sudo mkdir /var/www/probas3.example
$ sudo nano /var/www/probas3.example/index.html
<html>
<head><title>Sitio de PROBAS 3</title></head>
<body>
<b>Sitio de PROBAS 3</b>
</body>
</html>

Creación certificado dixital:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/certificados/www.probas3.example.key -out /etc/apache2/certificados/www.probas3.example.crt
Generating a 2048 bit RSA private key
..+++
...........+++
writing new private key to '/etc/apache2/certificados/www.probas3.example.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:ES
State or Province Name (full name) [Some-State]:España
Locality Name (eg, city) []:Santiago
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Probas3 S.A.
Organizational Unit Name (eg, section) []:Dpto. Ventas       
Common Name (e.g. server FQDN or YOUR name) []:www.probas3.example
Email Address []:admin@probas3.example

Creación do arquivo de configuración para https:

sudo nano /etc/apache2/sites-available/www.probas3.example-ssl.conf
<VirtualHost 192.0.2.13:443>
    ServerName www.probas3.example
    ServerAdmin webmaster@probas3.example 
    DocumentRoot /var/www/probas3.example
    SSLEngine on
    SSLCertificateFile /etc/apache2/certificados/www.probas3.example.crt
    SSLCertificateKeyFile /etc/apache2/certificados/www.probas3.example.key
    ErrorLog ${APACHE_LOG_DIR}/probas3.example_error.log
    CustomLog ${APACHE_LOG_DIR}/probas3.example_access.log combined
</VirtualHost>

Activación do sitio ww.probas3.example:

$ sudo a2ensite www.probas3.example.conf 
$ sudo a2ensite www.probas3.example-ssl.conf 
$ sudo systemctl reload apache2
$ sudo apache2ctl -S
...
VirtualHost configuration:
192.0.2.11:443         www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example-ssl.conf:1)
192.0.2.11:80          www.tenda1.example (/etc/apache2/sites-enabled/www.tenda1.example.conf:1)
192.0.2.12:443         www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example-ssl.conf:1)
192.0.2.12:80          www.tenda2.example (/etc/apache2/sites-enabled/www.tenda2.example.conf:1)
192.0.2.13:443         is a NameVirtualHost
         default server server5C (/etc/apache2/sites-enabled/default-ssl.conf:2)
         port 443 namevhost server5C (/etc/apache2/sites-enabled/default-ssl.conf:2)
         port 443 namevhost www.probas2.example (/etc/apache2/sites-enabled/www.probas2.example-ssl.conf:1)
         port 443 namevhost www.probas3.example (/etc/apache2/sites-enabled/www.probas3.example-ssl.conf:1)
192.0.2.13:80          is a NameVirtualHost
         default server server5C (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost server5C (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost www.probas1.example (/etc/apache2/sites-enabled/www.probas1.example.conf:1)
         port 80 namevhost www.probas2.example (/etc/apache2/sites-enabled/www.probas2.example.conf:1)
         port 80 namevhost www.probas3.example (/etc/apache2/sites-enabled/www.probas3.example.conf:1)
...

O acceso por http é redirixido a https grazas a directiva Redirect. Analizando o log probas3.example_access.log podemos ver o código de resposta 301 do servidor ante a petición da páxina principal do sitio e como na seguinte liña vólvese a recibir a mesma solicitude e o servidor proporciona a resposta (código 200).

$ cat /var/log/apache2/probas3.example_access.log 
...
192.0.2.1 - - [07/May/2023:20:46:38 +0000] "GET / HTTP/1.1" 301 586 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0"
192.0.2.1 - - [07/May/2023:20:46:41 +0000] "GET / HTTP/1.1" 200 2664 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0"
192.0.2.1 - - [07/May/2023:20:46:41 +0000] "GET /favicon.ico HTTP/1.1" 404 520 "https://www.probas3.example/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0"
...

Sitio Web probas3

Fig. Acceso por https ó sitio www.probas3.example

Conclusión

Vemos que é posible acceder a diferentes sitios correndo no mesmo socket (IP-porto) por https grazas a SNI e o envío por parte do cliente do nome de dominio na extensión SNI do TLS.

Na seguinte imaxe podemos ver o paquete Client Hello durante o establecemento da canle cifrada para https://www.probas2.example

SNI probas2.example

Fig. Extensión SNI indicando o sitio www.probas2.example

Na seguinte imaxe podemos ver o paquete Client Hello durante o establecemento da canle cifrada para https://www.probas3.example

Fortificando HTTPS

Os últimos anos foron un desastre para os protocolos SSL/TLS ó aparecer varias vulnerabilidades que fixeron que a gran maioría das versións e implementacións destes protocolos estén consideradas a día de hoxe como 'mortas'.

Algunhas das vulnerabilidades máis salientables dende o ano 2011 e lograron que a día de hoxe unicamente sexa considerado seguro TLS:

  • BEAST
  • CRIME
  • Heartbleed
  • Reverse Heartbleed
  • POODLE
  • FREAK
  • Logjam

No sitio web de seguridade security by default hai un interesante artigo onde se fala destas vulnerabilidades e do estado do SSL nos concellos, onde revisaban varias webs empregando a solución online SSL Server Test de Qualys SSL Labs.

Debido a todos os problemas indicados, novas vulnerabilidades que aparecen e a unha maior concienciación en materia de seguridade, a día de hoxe as configuracións SSL/TLS dos servidores web empezan a vir con valores por defecto seguros, e en moitos casos pouco ou nada hai que retocar. A pesar disto, é unha boa práctica revisar o estado da configuración e modificala para fortificala. Para axudarnos nesta tarefa existen ferramentas que automatizan a análise e proporcionan indicacións das accións a levar:

Análise online

Qualys SSL oferta análises do estado do SSL tanto dun servidor web como das capacidades SSL/TLS dun cliente web.

O problema da análise do servidor web é que éste ten que estar na web, polo tanto no noso escenario teremos que recorrer a outro software.

Análises internas

Existen diversas ferramentas que permiten realizar este tipo de análises e vermos dúas: testssl e nmap.

testssl testssl.sh é unha ferramenta de liña de comandos que permite testar a seguridade SSL/TLS sen necesidade de que o server teña que estar exposto en Internet. Para poder usala procedemos á descargala e descomprimila:

$ git clone --depth 1 https://github.com/drwetter/testssl.sh.git
$ cd testssl.sh/
~/testssl.sh 
$ ls -lhF
drwxrwxr-x 2 asir asir 4,0K feb  7 22:58 bin/
-rw-rw-r-- 1 asir asir  22K feb  7 22:58 CHANGELOG.md
-rw-rw-r-- 1 asir asir 5,7K feb  7 22:58 Coding_Convention.md
-rw-rw-r-- 1 asir asir 2,0K feb  7 22:58 CONTRIBUTING.md
-rw-rw-r-- 1 asir asir 5,3K feb  7 22:58 CREDITS.md
drwxrwxr-x 2 asir asir 4,0K feb  7 22:58 doc/
-rw-rw-r-- 1 asir asir 3,1K feb  7 22:58 Dockerfile
-rw-rw-r-- 1 asir asir 1,4K feb  7 22:58 Dockerfile.alpine
-rw-rw-r-- 1 asir asir 3,6K feb  7 22:58 Dockerfile.md
drwxrwxr-x 2 asir asir 4,0K feb  7 22:58 etc/
-rw-rw-r-- 1 asir asir 6,9K feb  7 22:58 FAQ.md
-rw-rw-r-- 1 asir asir  18K feb  7 22:58 LICENSE
-rw-rw-r-- 1 asir asir  62K feb  7 22:58 openssl-iana.mapping.html
-rw-rw-r-- 1 asir asir  11K feb  7 22:58 Readme.md
drwxrwxr-x 3 asir asir 4,0K feb  7 22:58 t/
-rwxrwxr-x 1 asir asir 1,3M feb  7 22:58 testssl.sh*
drwxrwxr-x 2 asir asir 4,0K feb  7 22:58 utils/
Lanzamos a análise contra www.probas2.example:
~/testssl.sh 
$ ./testssl.sh --wide https://www.probas2.example
#####################################################################
  testssl.sh version 3.3dev from https://testssl.sh/dev/
  (79db276 2026-01-15 15:19:45)

  This program is free software. Distribution and modification under
  GPLv2 permitted. USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

  Please file bugs @ https://testssl.sh/bugs/
#####################################################################

  Using OpenSSL 1.0.2-bad (Mar 28 2025)  [~179 ciphers]
  on incus:./bin/openssl.Linux.x86_64

Testing all IPv4 addresses (port 443): 192.0.2.13
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Start 2026-02-07 22:59:40        -->> 192.0.2.13:443 (www.probas2.example) <<--

 A record via:           /etc/hosts 
 rDNS (192.0.2.13):      www.probas1.example. www.probas2.example. www.probas3.example.
 Service detected:       HTTP

 Testing protocols via sockets except NPN+ALPN 

 SSLv2      not offered (OK)
 SSLv3      not offered (OK)
 TLS 1      not offered
 TLS 1.1    not offered
 TLS 1.2    offered (OK)
 TLS 1.3    offered (OK): final
 QUIC       Local problem: No OpenSSL QUIC support
 NPN/SPDY   not offered
 ALPN/HTTP2 http/1.1 (offered)

 Testing cipher categories 

 NULL ciphers (no encryption)                      not offered (OK)
 Anonymous NULL Ciphers (no authentication)        not offered (OK)
 Export ciphers (w/o ADH+NULL)                     not offered (OK)
 LOW: 64 Bit + DES, RC[2,4], MD5 (w/o export)      not offered (OK)
 Triple DES Ciphers / IDEA                         not offered
 Obsoleted CBC ciphers (AES, ARIA etc.)            offered
 Strong encryption (AEAD ciphers) with no FS       offered (OK)
 Forward Secrecy strong encryption (AEAD ciphers)  offered (OK)


 Testing server's cipher preferences 


Hexcode  Cipher Suite Name (OpenSSL)       KeyExch.   Encryption  Bits     Cipher Suite Name (IANA/RFC)
-----------------------------------------------------------------------------------------------------------------------------
SSLv2
 - 
SSLv3
 - 
TLSv1
 - 
TLSv1.1
 - 
TLSv1.2 (no server order, thus listed by strength)
 xc030   ECDHE-RSA-AES256-GCM-SHA384       ECDH 521   AESGCM      256      TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384              
 xc028   ECDHE-RSA-AES256-SHA384           ECDH 521   AES         256      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384              
 xc014   ECDHE-RSA-AES256-SHA              ECDH 521   AES         256      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA                 
 x9f     DHE-RSA-AES256-GCM-SHA384         DH 2048    AESGCM      256      TLS_DHE_RSA_WITH_AES_256_GCM_SHA384                
 xcca8   ECDHE-RSA-CHACHA20-POLY1305       ECDH 521   ChaCha20    256      TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256        
 xccaa   DHE-RSA-CHACHA20-POLY1305         DH 2048    ChaCha20    256      TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256          
 xc0a3   DHE-RSA-AES256-CCM8               DH 2048    AESCCM8     256      TLS_DHE_RSA_WITH_AES_256_CCM_8                     
 xc09f   DHE-RSA-AES256-CCM                DH 2048    AESCCM      256      TLS_DHE_RSA_WITH_AES_256_CCM                       
 x6b     DHE-RSA-AES256-SHA256             DH 2048    AES         256      TLS_DHE_RSA_WITH_AES_256_CBC_SHA256                
 x39     DHE-RSA-AES256-SHA                DH 2048    AES         256      TLS_DHE_RSA_WITH_AES_256_CBC_SHA                   
 xc077   ECDHE-RSA-CAMELLIA256-SHA384      ECDH 521   Camellia    256      TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384         
 xc4     DHE-RSA-CAMELLIA256-SHA256        DH 2048    Camellia    256      TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256           
 x88     DHE-RSA-CAMELLIA256-SHA           DH 2048    Camellia    256      TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA              
 x9d     AES256-GCM-SHA384                 RSA        AESGCM      256      TLS_RSA_WITH_AES_256_GCM_SHA384                    
 xc0a1   AES256-CCM8                       RSA        AESCCM8     256      TLS_RSA_WITH_AES_256_CCM_8                         
 xc09d   AES256-CCM                        RSA        AESCCM      256      TLS_RSA_WITH_AES_256_CCM                           
 x3d     AES256-SHA256                     RSA        AES         256      TLS_RSA_WITH_AES_256_CBC_SHA256                    
 x35     AES256-SHA                        RSA        AES         256      TLS_RSA_WITH_AES_256_CBC_SHA                       
 xc0     CAMELLIA256-SHA256                RSA        Camellia    256      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256               
 x84     CAMELLIA256-SHA                   RSA        Camellia    256      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA                  
 xc051   ARIA256-GCM-SHA384                RSA        ARIAGCM     256      TLS_RSA_WITH_ARIA_256_GCM_SHA384                   
 xc053   DHE-RSA-ARIA256-GCM-SHA384        DH 2048    ARIAGCM     256      TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384               
 xc061   ECDHE-ARIA256-GCM-SHA384          ECDH 521   ARIAGCM     256      TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384             
 xc02f   ECDHE-RSA-AES128-GCM-SHA256       ECDH 521   AESGCM      128      TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256              
 xc027   ECDHE-RSA-AES128-SHA256           ECDH 521   AES         128      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256              
 xc013   ECDHE-RSA-AES128-SHA              ECDH 521   AES         128      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA                 
 x9e     DHE-RSA-AES128-GCM-SHA256         DH 2048    AESGCM      128      TLS_DHE_RSA_WITH_AES_128_GCM_SHA256                
 xc0a2   DHE-RSA-AES128-CCM8               DH 2048    AESCCM8     128      TLS_DHE_RSA_WITH_AES_128_CCM_8                     
 xc09e   DHE-RSA-AES128-CCM                DH 2048    AESCCM      128      TLS_DHE_RSA_WITH_AES_128_CCM                       
 xc0a0   AES128-CCM8                       RSA        AESCCM8     128      TLS_RSA_WITH_AES_128_CCM_8                         
 xc09c   AES128-CCM                        RSA        AESCCM      128      TLS_RSA_WITH_AES_128_CCM                           
 x67     DHE-RSA-AES128-SHA256             DH 2048    AES         128      TLS_DHE_RSA_WITH_AES_128_CBC_SHA256                
 x33     DHE-RSA-AES128-SHA                DH 2048    AES         128      TLS_DHE_RSA_WITH_AES_128_CBC_SHA                   
 xc076   ECDHE-RSA-CAMELLIA128-SHA256      ECDH 521   Camellia    128      TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256         
 xbe     DHE-RSA-CAMELLIA128-SHA256        DH 2048    Camellia    128      TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256           
 x45     DHE-RSA-CAMELLIA128-SHA           DH 2048    Camellia    128      TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA              
 x9c     AES128-GCM-SHA256                 RSA        AESGCM      128      TLS_RSA_WITH_AES_128_GCM_SHA256                    
 x3c     AES128-SHA256                     RSA        AES         128      TLS_RSA_WITH_AES_128_CBC_SHA256                    
 x2f     AES128-SHA                        RSA        AES         128      TLS_RSA_WITH_AES_128_CBC_SHA                       
 xba     CAMELLIA128-SHA256                RSA        Camellia    128      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256               
 x41     CAMELLIA128-SHA                   RSA        Camellia    128      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA                  
 xc050   ARIA128-GCM-SHA256                RSA        ARIAGCM     128      TLS_RSA_WITH_ARIA_128_GCM_SHA256                   
 xc052   DHE-RSA-ARIA128-GCM-SHA256        DH 2048    ARIAGCM     128      TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256               
 xc060   ECDHE-ARIA128-GCM-SHA256          ECDH 521   ARIAGCM     128      TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256             
TLSv1.3 (no server order, thus listed by strength)
 x1302   TLS_AES_256_GCM_SHA384            ECDH 253   AESGCM      256      TLS_AES_256_GCM_SHA384                             
 x1303   TLS_CHACHA20_POLY1305_SHA256      ECDH 253   ChaCha20    256      TLS_CHACHA20_POLY1305_SHA256 
 x1301   TLS_AES_128_GCM_SHA256            ECDH 253   AESGCM      128      TLS_AES_128_GCM_SHA256                             

 Has server cipher order?     no (NOT ok)
 (limited sense as client will pick)

 Testing robust forward secrecy (FS) -- omitting Null Authentication/Encryption, 3DES, RC4 

 FS is offered (OK) , ciphers follow (client/browser support is important here) 

Hexcode  Cipher Suite Name (OpenSSL)       KeyExch.   Encryption  Bits     Cipher Suite Name (IANA/RFC)
-----------------------------------------------------------------------------------------------------------------------------
 x1302   TLS_AES_256_GCM_SHA384            ECDH 253   AESGCM      256      TLS_AES_256_GCM_SHA384                             
 x1303   TLS_CHACHA20_POLY1305_SHA256      ECDH 253   ChaCha20    256      TLS_CHACHA20_POLY1305_SHA256                       
 xc030   ECDHE-RSA-AES256-GCM-SHA384       ECDH 521   AESGCM      256      TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384              
 xc028   ECDHE-RSA-AES256-SHA384           ECDH 521   AES         256      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384              
 xc014   ECDHE-RSA-AES256-SHA              ECDH 521   AES         256      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA                 
 x9f     DHE-RSA-AES256-GCM-SHA384         DH 2048    AESGCM      256      TLS_DHE_RSA_WITH_AES_256_GCM_SHA384                
 xcca8   ECDHE-RSA-CHACHA20-POLY1305       ECDH 521   ChaCha20    256      TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256        
 xccaa   DHE-RSA-CHACHA20-POLY1305         DH 2048    ChaCha20    256      TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256          
 xc0a3   DHE-RSA-AES256-CCM8               DH 2048    AESCCM8     256      TLS_DHE_RSA_WITH_AES_256_CCM_8                     
 xc09f   DHE-RSA-AES256-CCM                DH 2048    AESCCM      256      TLS_DHE_RSA_WITH_AES_256_CCM                       
 x6b     DHE-RSA-AES256-SHA256             DH 2048    AES         256      TLS_DHE_RSA_WITH_AES_256_CBC_SHA256                
 x39     DHE-RSA-AES256-SHA                DH 2048    AES         256      TLS_DHE_RSA_WITH_AES_256_CBC_SHA                   
 xc077   ECDHE-RSA-CAMELLIA256-SHA384      ECDH 521   Camellia    256      TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384         
 xc4     DHE-RSA-CAMELLIA256-SHA256        DH 2048    Camellia    256      TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256           
 x88     DHE-RSA-CAMELLIA256-SHA           DH 2048    Camellia    256      TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA              
 xc053   DHE-RSA-ARIA256-GCM-SHA384        DH 2048    ARIAGCM     256      TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384               
 xc061   ECDHE-ARIA256-GCM-SHA384          ECDH 521   ARIAGCM     256      TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384             
 x1301   TLS_AES_128_GCM_SHA256            ECDH 253   AESGCM      128      TLS_AES_128_GCM_SHA256                             
 xc02f   ECDHE-RSA-AES128-GCM-SHA256       ECDH 521   AESGCM      128      TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256              
 xc027   ECDHE-RSA-AES128-SHA256           ECDH 521   AES         128      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256              
 xc013   ECDHE-RSA-AES128-SHA              ECDH 521   AES         128      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA                 
 x9e     DHE-RSA-AES128-GCM-SHA256         DH 2048    AESGCM      128      TLS_DHE_RSA_WITH_AES_128_GCM_SHA256                
 xc0a2   DHE-RSA-AES128-CCM8               DH 2048    AESCCM8     128      TLS_DHE_RSA_WITH_AES_128_CCM_8                     
 xc09e   DHE-RSA-AES128-CCM                DH 2048    AESCCM      128      TLS_DHE_RSA_WITH_AES_128_CCM                       
 x67     DHE-RSA-AES128-SHA256             DH 2048    AES         128      TLS_DHE_RSA_WITH_AES_128_CBC_SHA256                
 x33     DHE-RSA-AES128-SHA                DH 2048    AES         128      TLS_DHE_RSA_WITH_AES_128_CBC_SHA                   
 xc076   ECDHE-RSA-CAMELLIA128-SHA256      ECDH 521   Camellia    128      TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256         
 xbe     DHE-RSA-CAMELLIA128-SHA256        DH 2048    Camellia    128      TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256           
 x45     DHE-RSA-CAMELLIA128-SHA           DH 2048    Camellia    128      TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA              
 xc052   DHE-RSA-ARIA128-GCM-SHA256        DH 2048    ARIAGCM     128      TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256               
 xc060   ECDHE-ARIA128-GCM-SHA256          ECDH 521   ARIAGCM     128      TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256             

 KEMs offered                 None
 Elliptic curves offered:     prime256v1 secp384r1 secp521r1 X25519 X448 
 Finite field group:          ffdhe2048 ffdhe3072 ffdhe4096 ffdhe6144 ffdhe8192
 TLS 1.2 sig_algs offered:    RSA-PSS-RSAE+SHA512 RSA-PSS-RSAE+SHA384 RSA-PSS-RSAE+SHA256 RSA+SHA512 RSA+SHA384 RSA+SHA256 RSA+SHA224 
 TLS 1.3 sig_algs offered:    RSA-PSS-RSAE+SHA512 RSA-PSS-RSAE+SHA384 RSA-PSS-RSAE+SHA256 

 Testing server defaults (Server Hello) 

 TLS extensions               "server name/#0" "max fragment length/#1" "supported_groups/#10" "EC point formats/#11" "application layer protocol negotiation/#16" "encrypt-then-mac/#22" "extended master secret/#23" "session ticket/#35" "supported versions/#43" "key share/#51" "renegotiation info/#65281"
 Session Ticket RFC 5077 hint 300 seconds, session tickets keys seems to be rotated < daily
 SSL Session ID support       yes
 Session Resumption           tickets: yes, ID: yes
 TLS 1.3 early data support   no early data offered
 TLS clock skew               Random values, no fingerprinting possible 
 Certificate Compression      none
 Client Authentication        none
 Signature Algorithm          SHA256 with RSA
 Server key size              RSA 2048 bits (exponent is 65537)
 Server key usage             --
 Server extended key usage    --
 Serial                       097DCD41CA874227BA1F8427DB1020E33582ED5B (OK: length 20)
 Fingerprints                 SHA1 227AC7A42A00EC30E5A771721D0DCF6921EEBC6B
                              SHA256 6366F3F8D7187C5161F4DCB75E0582D5F78059A52602863006CD6E23112E6E6A
 Common Name (CN)             www.probas2.example  (CN in response to request w/o SNI: server-https.platega.example )
 subjectAltName (SAN)         missing (NOT ok) -- Browsers are complaining
 Trust (hostname)             via CN only -- Browsers are complaining (w/o SNI: certificate does not match supplied URI)
 Chain of trust               NOT ok (self signed)
 EV cert (experimental)       no 
 Certificate Validity (UTC)   364 >= 60 days (2026-02-07 21:50 --> 2027-02-07 21:50)
 ETS/"eTLS", visibility info  not present
 Certificate Revocation List  --
  Running client simulations (HTTP) via sockets 

 Browser                      Protocol  Cipher Suite Name (OpenSSL)       Forward Secrecy
------------------------------------------------------------------------------------------------
 Android 7.0 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
 Android 8.1 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
 Android 9.0 (native)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 10.0 (native)        TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 11/12 (native)       TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 13/14 (native)       TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 15 (native)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Chrome 101 (Win 10)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Chromium 137 (Win 11)        TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Firefox 100 (Win 10)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Firefox 137 (Win 11)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 IE 8 Win 7                   No connection
 IE 11 Win 7                  TLSv1.2   ECDHE-RSA-AES256-SHA384           256 bit ECDH (P-256)
 IE 11 Win 8.1                TLSv1.2   ECDHE-RSA-AES256-SHA384           256 bit ECDH (P-256)
 IE 11 Win Phone 8.1          TLSv1.2   AES128-SHA256                     No FS
 IE 11 Win 10                 TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       256 bit ECDH (P-256)
 Edge 15 Win 10               TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       253 bit ECDH (X25519)
 Edge 101 Win 10 21H2         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Edge 133 Win 11 23H2         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Safari 18.4 (iOS 18.4)       TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Safari 15.4 (macOS 12.3.1)   TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Safari 18.4 (macOS 15.4)     TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Java 7u25                    No connection
 Java 8u442 (OpenJDK)         TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 Java 11.0.2 (OpenJDK)        TLSv1.3   TLS_AES_128_GCM_SHA256            256 bit ECDH (P-256)
 Java 17.0.3 (OpenJDK)        TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 Java 21.0.6 (OpenJDK)        TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 go 1.17.8                    TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 LibreSSL 3.3.6 (macOS)       TLSv1.3   TLS_CHACHA20_POLY1305_SHA256      253 bit ECDH (X25519)
 OpenSSL 1.0.2e               TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       256 bit ECDH (P-256)
 OpenSSL 1.1.1d (Debian)      TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 OpenSSL 3.0.15 (Debian)      TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 OpenSSL 3.5.0 (git)          TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 Apple Mail (16.0)            TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       256 bit ECDH (P-256)
 Thunderbird (91.9)           TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)


 Rating (experimental) 

 Rating specs (not complete)  SSL Labs's 'SSL Server Rating Guide' (version 2009r from 2025-05-16)
 Specification documentation  https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide
 Protocol Support (weighted)  0 (0)
 Key Exchange     (weighted)  0 (0)
 Cipher Strength  (weighted)  0 (0)
 Final Score                  0
 Overall Grade                T
 Grade cap reasons            Grade capped to T. Issues with chain of trust (self signed)

 Done 2026-02-07 23:02:56 [ 203s] -->> 192.0.2.13:443 (www.probas2.example) <<--

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Done testing now all IP addresses (on port 443): 192.0.2.13

 OCSP URI                     --
                              NOT ok -- neither CRL nor OCSP URI provided
 OCSP stapling                not offered
 OCSP must staple extension   --
 DNS CAA RR (experimental)    not offered
 Certificate Transparency     --
 Certificates provided        1
 Issuer                       www.probas2.example (probas2 from ES)
 Intermediate Bad OCSP (exp.) Ok


 Testing HTTP header response @ "/" 

 HTTP Status Code             200 OK
 HTTP clock skew              0 sec from localtime
 Strict Transport Security    not offered
 Public Key Pinning           --
 Server banner                Apache/2.4.52 (Ubuntu)
 Application banner           --
 Cookie(s)                    (none issued at "/")
 Security headers             --
 Reverse Proxy banner         --


 Testing vulnerabilities 

 Heartbleed (CVE-2014-0160)                not vulnerable (OK), no heartbeat extension
 CCS (CVE-2014-0224)                       not vulnerable (OK)
 Ticketbleed (CVE-2016-9244), experiment.  not vulnerable (OK)
 Opossum (CVE-2025-49812)                  not vulnerable (OK)
 ROBOT                                     not vulnerable (OK)
 Secure Renegotiation (RFC 5746)           supported (OK)
 Secure Client-Initiated Renegotiation     not vulnerable (OK)
 CRIME, TLS (CVE-2012-4929)                not vulnerable (OK)
 BREACH (CVE-2013-3587)                    potentially NOT ok, "gzip" HTTP compression detected. - only supplied "/" tested
                                           Can be ignored for static pages or if no secrets in the page
 POODLE, SSL (CVE-2014-3566)               not vulnerable (OK), no SSLv3 support
 TLS_FALLBACK_SCSV (RFC 7507)              No fallback possible (OK), no protocol below TLS 1.2 offered
 SWEET32 (CVE-2016-2183, CVE-2016-6329)    not vulnerable (OK)
 FREAK (CVE-2015-0204)                     not vulnerable (OK)
 DROWN (CVE-2016-0800, CVE-2016-0703)      not vulnerable on this host and port (OK)
                                           make sure you don't use this certificate elsewhere with SSLv2 enabled services, see
                                           https://search.censys.io/search?resource=hosts&virtual_hosts=INCLUDE&q=6366F3F8D7187C5161F4DCB75E0582D5F78059A52602863006CD6E23112E6E6A
 LOGJAM (CVE-2015-4000), experimental      common prime with 2048 bits detected: RFC3526/Oakley Group 14 (2048 bits),
                                           but no DH EXPORT ciphers
 BEAST (CVE-2011-3389)                     not vulnerable (OK), no SSL3 or TLS1
 LUCKY13 (CVE-2013-0169), experimental     potentially VULNERABLE, uses cipher block chaining (CBC) ciphers with TLS. Check patches
 Winshock (CVE-2014-6321), experimental    not vulnerable (OK)
 RC4 (CVE-2013-2566, CVE-2015-2808)        no RC4 ciphers detected (OK)

Podemos ver que o server pode traballar con TLS1.2 e TLS1.3, que aparecen varios "Not ok" relacionados cos protocolos de cifrado ofrecidos e co noso certificado autoasinado e que podemos ser vulnerables a BREACH (CVE-2013-3587) e LUCKY13 (CVE-2013-0169). Nos acometeremos a fortificación das comunicacións https asignando ás seguintes directivas os valores recomendados para impedir ou mitigar os ataques anteriores:

SSLCompression: permite habilitar a compresión de datos no nivel SSL/TLS. O ataque CRIME emprega a compresión a nivel SSL polo que haberá que configurar a directiva a off. SSLProtocol: permite controlar que versións de SSL/TLS usaranse. Aínda que os posibles valores desta directiva aparecen na seguinte táboa débese deshabilitar SSLv2 e SSLv3. SSLv2 SSL versión 2.0 SSLv3 SSL versión 3.0 TLSv1 TLS v1.0 TLSv1.1 revisión de TLSv1.0 definido en RFC 4346 (con openssl 1.0.1 ou posterior) TLSv1.2 revisión de TLSv1.1 definido en RFC 5246 (con openssl 1.0.1 ou posterior) TLSv1.3 revisión de TLSv1.2 definido en RFC 8446 (con openssl 1.0.1 ou posterior) All representa '+SSLv3 +TLSv1' ou se usamos opensssl 1.0.1 ou posterior '+SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2' SSLHonorCipherOrder: permite indicar se as preferencias do servidor prevalecen sobre as do cliente no establecemento da canle SSL/TLS. Cando se escolle un cifrado durante a negociación SSL/TLS, normalmente as preferencias do cliente son usadas (valor off); sen embargo, o recomendado é que teñan prioridade as do servidor (valor on).

SSLCipherSuite permite indicar as especificacións de cifrado que se permiten usar ó cliente.

Imos modificar o arquivo de configuración do módulo ssl de apache para que os novos valores destas directivas afecten a todos os sitios web do servidor Apache e recollan os valores recomendados polo equipo de seguridade de Mozilla.

No exemplo escollesmos unha configuración intermedia: https://mozilla.github.io/server-side-tls/ssl-config-generator/

$ dpkg -l | grep -i apache2
ii  apache2                         2.4.52-1ubuntu4.18                       amd64        Apache HTTP Server
...
$ dpkg -l | grep -i openssl
ii  openssl                         3.0.2-0ubuntu1.21                       amd64        Secure Sockets Layer toolkit - cryptographic utility
...

Mozilla SSL Configuration Generator

Fig. Mozilla SSL Configuration Generator

Editamos a configuración engadindo as recomendación de Mozilla (comentando as directivas con valores vellos xa presentes como SSLProtocol e SSLCipherSuite por exemplo)

$ sudo nano /etc/apache2/mods-available/ssl.conf 
...
# intermediate configuration
SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
SSLHonorCipherOrder     off
SSLSessionTickets       off
SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
$ sudo systemctl restart apache2

Lanzamos novamente a análise e vemos que xa non se ofertan todos os protocolos SSL/TLS e que ademasi arranxáronse algunhas das advertencias:

~/testssl.sh $ ./testssl.sh --wide https://www.probas2.example
#####################################################################
  testssl.sh version 3.3dev from https://testssl.sh/dev/
  (79db276 2026-01-15 15:19:45)

  This program is free software. Distribution and modification under
  GPLv2 permitted. USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

  Please file bugs @ https://testssl.sh/bugs/
#####################################################################

  Using OpenSSL 1.0.2-bad (Mar 28 2025)  [~179 ciphers]
  on incus:./bin/openssl.Linux.x86_64

Testing all IPv4 addresses (port 443): 192.0.2.13
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Start 2026-02-07 23:15:19        -->> 192.0.2.13:443 (www.probas2.example) <<--

 A record via:           /etc/hosts 
 rDNS (192.0.2.13):      www.probas1.example. www.probas2.example. www.probas3.example.
 Service detected:       HTTP

 Testing protocols via sockets except NPN+ALPN 

 SSLv2      not offered (OK)
 SSLv3      not offered (OK)
 TLS 1      not offered
 TLS 1.1    not offered
 TLS 1.2    offered (OK)
 TLS 1.3    offered (OK): final
 QUIC       Local problem: No OpenSSL QUIC support
 NPN/SPDY   not offered
 ALPN/HTTP2 http/1.1 (offered)

 Testing cipher categories 

 NULL ciphers (no encryption)                      not offered (OK)
 Anonymous NULL Ciphers (no authentication)        not offered (OK)
 Export ciphers (w/o ADH+NULL)                     not offered (OK)
 LOW: 64 Bit + DES, RC[2,4], MD5 (w/o export)      not offered (OK)
 Triple DES Ciphers / IDEA                         not offered
 Obsoleted CBC ciphers (AES, ARIA etc.)            not offered
 Strong encryption (AEAD ciphers) with no FS       not offered
 Forward Secrecy strong encryption (AEAD ciphers)  offered (OK)


 Testing server's cipher preferences 

Hexcode  Cipher Suite Name (OpenSSL)       KeyExch.   Encryption  Bits     Cipher Suite Name (IANA/RFC)
-----------------------------------------------------------------------------------------------------------------------------
SSLv2
 - 
SSLv3
 - 
TLSv1
 - 
TLSv1.1
 - 
TLSv1.2 (no server order, thus listed by strength)
 xc030   ECDHE-RSA-AES256-GCM-SHA384       ECDH 384   AESGCM      256      TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384              
 x9f     DHE-RSA-AES256-GCM-SHA384         DH 2048    AESGCM      256      TLS_DHE_RSA_WITH_AES_256_GCM_SHA384                
 xcca8   ECDHE-RSA-CHACHA20-POLY1305       ECDH 384   ChaCha20    256      TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256        
 xccaa   DHE-RSA-CHACHA20-POLY1305         DH 2048    ChaCha20    256      TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256          
 xc02f   ECDHE-RSA-AES128-GCM-SHA256       ECDH 384   AESGCM      128      TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256              
 x9e     DHE-RSA-AES128-GCM-SHA256         DH 2048    AESGCM      128      TLS_DHE_RSA_WITH_AES_128_GCM_SHA256                
TLSv1.3 (no server order, thus listed by strength)
 x1302   TLS_AES_256_GCM_SHA384            ECDH 253   AESGCM      256      TLS_AES_256_GCM_SHA384                             
 x1303   TLS_CHACHA20_POLY1305_SHA256      ECDH 253   ChaCha20    256      TLS_CHACHA20_POLY1305_SHA256                       
 x1301   TLS_AES_128_GCM_SHA256            ECDH 253   AESGCM      128      TLS_AES_128_GCM_SHA256                             

 Has server cipher order?     no
 (limited sense as client will pick)

 Testing robust forward secrecy (FS) -- omitting Null Authentication/Encryption, 3DES, RC4 

 FS is offered (OK) , ciphers follow (client/browser support is important here) 

Hexcode  Cipher Suite Name (OpenSSL)       KeyExch.   Encryption  Bits     Cipher Suite Name (IANA/RFC)
-----------------------------------------------------------------------------------------------------------------------------
 x1302   TLS_AES_256_GCM_SHA384            ECDH 253   AESGCM      256      TLS_AES_256_GCM_SHA384                             
 x1303   TLS_CHACHA20_POLY1305_SHA256      ECDH 253   ChaCha20    256      TLS_CHACHA20_POLY1305_SHA256                       
 xc030   ECDHE-RSA-AES256-GCM-SHA384       ECDH 384   AESGCM      256      TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384              
 x9f     DHE-RSA-AES256-GCM-SHA384         DH 2048    AESGCM      256      TLS_DHE_RSA_WITH_AES_256_GCM_SHA384                
 xcca8   ECDHE-RSA-CHACHA20-POLY1305       ECDH 384   ChaCha20    256      TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256        
 xccaa   DHE-RSA-CHACHA20-POLY1305         DH 2048    ChaCha20    256      TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256          
 x1301   TLS_AES_128_GCM_SHA256            ECDH 253   AESGCM      128      TLS_AES_128_GCM_SHA256                             
 xc02f   ECDHE-RSA-AES128-GCM-SHA256       ECDH 384   AESGCM      128      TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256              
 x9e     DHE-RSA-AES128-GCM-SHA256         DH 2048    AESGCM      128      TLS_DHE_RSA_WITH_AES_128_GCM_SHA256                

 KEMs offered                 None
 Elliptic curves offered:     prime256v1 secp384r1 X25519 
 DH group offered:            RFC3526/Oakley Group 14 (2048 bits)
 TLS 1.2 sig_algs offered:    RSA-PSS-RSAE+SHA512 RSA-PSS-RSAE+SHA384 RSA-PSS-RSAE+SHA256 RSA+SHA512 RSA+SHA384 RSA+SHA256 RSA+SHA224 
 TLS 1.3 sig_algs offered:    RSA-PSS-RSAE+SHA512 RSA-PSS-RSAE+SHA384 RSA-PSS-RSAE+SHA256 

 Testing server defaults (Server Hello) 

 TLS extensions               "server name/#0" "max fragment length/#1" "supported_groups/#10" "EC point formats/#11" "application layer protocol negotiation/#16" "extended master secret/#23" "supported versions/#43" "key share/#51" "renegotiation info/#65281"
 Session Ticket RFC 5077 hint no -- no lifetime advertised
 SSL Session ID support       yes
 Session Resumption           tickets no, ID: yes
 TLS 1.3 early data support   no early data offered
 TLS clock skew               Random values, no fingerprinting possible 
 Certificate Compression      none
 Client Authentication        none
 Signature Algorithm          SHA256 with RSA
 Server key size              RSA 2048 bits (exponent is 65537)
 Server key usage             --
 Server extended key usage    --
 Serial                       097DCD41CA874227BA1F8427DB1020E33582ED5B (OK: length 20)
 Fingerprints                 SHA1 227AC7A42A00EC30E5A771721D0DCF6921EEBC6B
                              SHA256 6366F3F8D7187C5161F4DCB75E0582D5F78059A52602863006CD6E23112E6E6A
 Common Name (CN)             www.probas2.example  (CN in response to request w/o SNI: server-https.platega.example )
 subjectAltName (SAN)         missing (NOT ok) -- Browsers are complaining
 Trust (hostname)             via CN only -- Browsers are complaining (w/o SNI: certificate does not match supplied URI)
 Chain of trust               NOT ok (self signed)
 EV cert (experimental)       no 
 Certificate Validity (UTC)   364 >= 60 days (2026-02-07 21:50 --> 2027-02-07 21:50)
 ETS/"eTLS", visibility info  not present
 Certificate Revocation List  --
 OCSP URI                     --
                              NOT ok -- neither CRL nor OCSP URI provided
 OCSP stapling                not offered
 OCSP must staple extension   --
 DNS CAA RR (experimental)    not offered
 Certificate Transparency     --
 Certificates provided        1
 Issuer                       www.probas2.example (probas2 from ES)
 Intermediate Bad OCSP (exp.) Ok


 Testing HTTP header response @ "/" 

 HTTP Status Code             200 OK
 HTTP clock skew              0 sec from localtime
 Strict Transport Security    not offered
 Public Key Pinning           --
 Server banner                Apache/2.4.52 (Ubuntu)
 Application banner           --
 Cookie(s)                    (none issued at "/")
 Security headers             --
 Reverse Proxy banner         --


 Testing vulnerabilities 

 Heartbleed (CVE-2014-0160)                not vulnerable (OK), no heartbeat extension
 CCS (CVE-2014-0224)                       not vulnerable (OK)
 Ticketbleed (CVE-2016-9244), experiment.  not vulnerable (OK), no session ticket extension
 Opossum (CVE-2025-49812)                  not vulnerable (OK)
 ROBOT                                     Server does not support any cipher suites that use RSA key transport
 Secure Renegotiation (RFC 5746)           supported (OK)
 Secure Client-Initiated Renegotiation     not vulnerable (OK)
 CRIME, TLS (CVE-2012-4929)                not vulnerable (OK)
 BREACH (CVE-2013-3587)                    potentially NOT ok, "gzip" HTTP compression detected. - only supplied "/" tested
                                           Can be ignored for static pages or if no secrets in the page
 POODLE, SSL (CVE-2014-3566)               not vulnerable (OK), no SSLv3 support
 TLS_FALLBACK_SCSV (RFC 7507)              No fallback possible (OK), no protocol below TLS 1.2 offered
 SWEET32 (CVE-2016-2183, CVE-2016-6329)    not vulnerable (OK)
 FREAK (CVE-2015-0204)                     not vulnerable (OK)
 DROWN (CVE-2016-0800, CVE-2016-0703)      not vulnerable on this host and port (OK)
                                           make sure you don't use this certificate elsewhere with SSLv2 enabled services, see
                                           https://search.censys.io/search?resource=hosts&virtual_hosts=INCLUDE&q=6366F3F8D7187C5161F4DCB75E0582D5F78059A52602863006CD6E23112E6E6A
 LOGJAM (CVE-2015-4000), experimental      common prime with 2048 bits detected: RFC3526/Oakley Group 14 (2048 bits),
                                           but no DH EXPORT ciphers
 BEAST (CVE-2011-3389)                     not vulnerable (OK), no SSL3 or TLS1
 LUCKY13 (CVE-2013-0169), experimental     not vulnerable (OK)
 Winshock (CVE-2014-6321), experimental    not vulnerable (OK)
 RC4 (CVE-2013-2566, CVE-2015-2808)        no RC4 ciphers detected (OK)


 Running client simulations (HTTP) via sockets 

 Browser                      Protocol  Cipher Suite Name (OpenSSL)       Forward Secrecy
------------------------------------------------------------------------------------------------
 Android 7.0 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
 Android 8.1 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
 Android 9.0 (native)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 10.0 (native)        TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 11/12 (native)       TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 13/14 (native)       TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Android 15 (native)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Chrome 101 (Win 10)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Chromium 137 (Win 11)        TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Firefox 100 (Win 10)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Firefox 137 (Win 11)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 IE 8 Win 7                   No connection
 IE 11 Win 7                  TLSv1.2   DHE-RSA-AES256-GCM-SHA384         2048 bit DH  
 IE 11 Win 8.1                TLSv1.2   DHE-RSA-AES256-GCM-SHA384         2048 bit DH  
 IE 11 Win Phone 8.1          No connection
 IE 11 Win 10                 TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       256 bit ECDH (P-256)
 Edge 15 Win 10               TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       253 bit ECDH (X25519)
 Edge 101 Win 10 21H2         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Edge 133 Win 11 23H2         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Safari 18.4 (iOS 18.4)       TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Safari 15.4 (macOS 12.3.1)   TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Safari 18.4 (macOS 15.4)     TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 Java 7u25                    No connection
 Java 8u442 (OpenJDK)         TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 Java 11.0.2 (OpenJDK)        TLSv1.3   TLS_AES_128_GCM_SHA256            256 bit ECDH (P-256)
 Java 17.0.3 (OpenJDK)        TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 Java 21.0.6 (OpenJDK)        TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 go 1.17.8                    TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
 LibreSSL 3.3.6 (macOS)       TLSv1.3   TLS_CHACHA20_POLY1305_SHA256      253 bit ECDH (X25519)
 OpenSSL 1.0.2e               TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       256 bit ECDH (P-256)
 OpenSSL 1.1.1d (Debian)      TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 OpenSSL 3.0.15 (Debian)      TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 OpenSSL 3.5.0 (git)          TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
 Apple Mail (16.0)            TLSv1.2   ECDHE-RSA-AES256-GCM-SHA384       256 bit ECDH (P-256)
 Thunderbird (91.9)           TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)


 Rating (experimental) 

 Rating specs (not complete)  SSL Labs's 'SSL Server Rating Guide' (version 2009r from 2025-05-16)
 Specification documentation  https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide
 Protocol Support (weighted)  0 (0)
 Key Exchange     (weighted)  0 (0)
 Cipher Strength  (weighted)  0 (0)
 Final Score                  0
 Overall Grade                T
 Grade cap reasons            Grade capped to T. Issues with chain of trust (self signed)

 Done 2026-02-07 23:17:37 [ 146s] -->> 192.0.2.13:443 (www.probas2.example) <<--

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Done testing now all IP addresses (on port 443): 192.0.2.13

Con esta nova configuración, xa non hai avisos relacionados con Lucky13 por exemplo. Habería que ir probando configuracións ata acadar o nivel desexado, tendo en conta que limitar o tipo de SSL/TLS a usar pode provocar que certos navegadores teñan problemas ó acceder por https, sobre todo si se trata de versións vellas.

nmap

Nmap xa foi utilizado no Escenario 4A para facer barridos de portos e detección de servizos. NSE (Nmap Scripting Engine) permite ampliar a potencia e versatilidade de nmap xa que, a través de scripts, permite automatizar unha gran variedade de tarefas de rede: exploracións de rede, detección avanzada de servizos, detección e explotación de vulnerabilidades, detección de portas traseiras/backdoors, ..., habendo centos de scripts. Por exemplo, no seu día publicouse unha versión do servidor FTP vsftpd cunha porta traseira e esta vulnerabilidade podémola descubrir lanzado o script NSE ftp-vsftpd-backdoor:

$ sudo nmap --script ftp-vsftpd-backdoor  -p 21 192.168.1.47
Starting Nmap 7.01 ( https://nmap.org ) at 2017-11-12 02:06 CET
Nmap scan report for 192.168.1.47
Host is up (0.00028s latency).
PORT   STATE SERVICE
21/tcp open  ftp
| ftp-vsftpd-backdoor: 
|   VULNERABLE:
|   vsFTPd version 2.3.4 backdoor
|     State: VULNERABLE (Exploitable)
|     IDs:  CVE:CVE-2011-2523  OSVDB:73573
|       vsFTPd version 2.3.4 backdoor, this was reported on 2011-07-04.
|     Disclosure date: 2011-07-03
|     Exploit results:
|       Shell command: id
|       Results: uid=0(root) gid=0(root)
|     References:
|       http://osvdb.org/73573
|       https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/ftp/vsftpd_234_backdoor.rb
|       http://scarybeastsecurity.blogspot.com/2011/07/alert-vsftpd-download-backdoored.html
|_      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-2523
MAC Address: 08:00:27:CF:70:13 (Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 1.79 seconds

Usando o script ssl-enum-ciphers podemos facer un estudo do estado do SSL/TLS no noso servidor e co plugin ssl-cert podemos ver a infomación do certificado do sitio:

$ nmap -Pn -sV --script ssl-cert,ssl-enum-ciphers -p 443 www.probas2.example

Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-02-07 23:22 CET
Nmap scan report for www.probas2.example (192.0.2.13)
Host is up (0.000063s latency).
rDNS record for 192.0.2.13: www.probas1.example

PORT    STATE SERVICE  VERSION
443/tcp open  ssl/http Apache httpd 2.4.52
| ssl-enum-ciphers: 
|   TLSv1.2: 
|     ciphers: 
|       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 2048) - A
|       TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A
|     compressors: 
|       NULL
|     cipher preference: client
|   TLSv1.3: 
|     ciphers: 
|       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|     cipher preference: client
|_  least strength: A
|_http-server-header: Apache/2.4.52 (Ubuntu)
| ssl-cert: Subject: commonName=www.probas2.example/organizationName=probas2/stateOrProvinceName=Spain/countryName=ES
| Issuer: commonName=www.probas2.example/organizationName=probas2/stateOrProvinceName=Spain/countryName=ES
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-02-07T21:50:30
| Not valid after:  2027-02-07T21:50:30
| MD5:   0adb:9608:da74:1d98:340c:32ed:be43:dad0
|_SHA-1: 227a:c7a4:2a00:ec30:e5a7:7172:1d0d:cf69:21ee:bc6b
MAC Address: 10:66:6A:84:39:02 (Unknown)
Service Info: Host: server-https

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 13.05 seconds

En anos anteriores unha análise dun servidor Apache recén instalado e coa configuración por defecto daba dous avisos:

  • Aviso asociado a SSLv3 relativo á incidencia CVE-2014-3566 (ataque POODLE); polo que e tras revisar a información sobre a vulnerabilidade, desaconséllase desactivar SSLv3.
  • Aviso en TLSv1.1 e TLSv1.2 onde se indica que o algoritmo de cifrado RC4 (empregado para mitigar o ataque BEAST) xa non é necesario e non se aconsella o seu uso.
$ nmap -Pn -sV --script ssl-enum-ciphers -p 443 www.probas2.com
Starting Nmap 7.01 ( https://nmap.org ) at 2017-11-13 14:59 CET
Nmap scan report for www.probas2.com (192.168.1.254)
Host is up (0.00052s latency).
rDNS record for 192.168.1.254: www.probas1.com
PORT    STATE SERVICE  VERSION
443/tcp open  ssl/http Apache httpd 2.4.7
|_http-server-header: Apache/2.4.7 (Ubuntu)
| ssl-enum-ciphers: 
|   SSLv3: 
|     ciphers: 
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA (dh 2048) - C
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_SEED_CBC_SHA (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - A
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - A
|       TLS_RSA_WITH_SEED_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: client
|     warnings: 
|       CBC-mode cipher in SSLv3 (CVE-2014-3566)
|   TLSv1.0: 
|     ciphers: 
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA (dh 2048) - C
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_SEED_CBC_SHA (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - A
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - A
|       TLS_RSA_WITH_SEED_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: client
|   TLSv1.1: 
|     ciphers: 
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA (dh 2048) - C
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_SEED_CBC_SHA (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - A
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - A
|       TLS_RSA_WITH_SEED_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: client
|     warnings: 
|       Weak cipher RC4 in TLSv1.1 or newer not needed for BEAST mitigation
|   TLSv1.2: 
|     ciphers: 
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA (dh 2048) - C
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_SEED_CBC_SHA (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_RC4_128_SHA (secp256r1) - A
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_CAMELLIA_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - A
|       TLS_RSA_WITH_SEED_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: client
|     warnings: 
|       Weak cipher RC4 in TLSv1.1 or newer not needed for BEAST mitigation
|_  least strength: C
Service Info: Host: bogus_host_without_reverse_dns

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 13.08 seconds

Uso de ferramentas

O uso de ferramentas é moi interesante xa que axuda ós administradores na labor de localizar vulnerabilidades ou configuracións non seguras. Algunhas moi coñecidas son:

  • testssl
  • nmap
  • NSE
  • sslscan
  • Nessus

É tarefa dos administradores revisar a información dispoñible sobre os servidores que xestionan para configuralos da forma máis robusta posible ó tempo que proporcionan os servizos esperados.