(Plesk per Linux) Rafforzare le connessioni utilizzando DANE¶
Riassunto
Se le connessioni al server di posta sono protette utilizzando un certificato SSL/TLS, puoi renderle più resistenti agli attacchi downgrade e man-in-the-middle abilitando DNS-based Authentication of Named Entities (DANE). DANE protegge anche dai furti d’identità del sito web causati dalla compromissione delle autorità certificanti.
In this topic, you will learn how to harden connections to the server using DANE: automatically via SSL It! and manually. Note that this topic is not meant to be an exhaustive source of information about DANE or TLSA DNS records.
In Plesk, you can harden connections to the server using DANE in the following ways:
- Automatically by using the SSL It! extension.
- Manually by generating a hash of the SSL/TLS certificate’s public key, and then adding a TLSA DNS record.
Each way has its own advantages as well as downsides.
The automatic implementation of DANE using SSL It! is easy and needs just a few clicks. However, you can harden only one connection type with DANE: to the mail server for an individual domain. Additionally, you can use DANE only with Let’s Encrypt certificates. If you want to use DANE with SSL/TLS certificates of other certificate authorities, choose the manual implementation.
The manual implementation of DANE is a multistep procedure, which requires time and effort (even though we provide you with a step-by-step guide below). As for the benefits, you can harden connections not only to the mail server but also other ones secured with SSL/TLS certificates. You can also use DANE with SSL/TLS certificates of any certificate authorities, not limited to Let’s Encrypt only.
Regardless of the way you choose, you will need to make sure your server and/or hosted domains meet certain requirements necessary for using DANE.
(Automatically) Hardening Mail Connections Using DANE¶
Before you can automatically harden a connection to the mail server using DANE, make sure your server and hosted domains have the following configuration:
- For the Plesk server: - The mail service is enabled. - DKIM is enabled. - Plesk is the primary DNS server.
- For the domain whose connection to the mail server you want to harden using DANE: - The mail service is enabled. - DKIM is enabled. - The MX record exists and it resolves to the IP address of the Plesk server. - DNSSEC is enabled.
If all the conditions above are fulfilled, you can harden a connection to the mail server using DANE with the help of the SSL It! extension.
Hardening a Mail Connection Using DANE via SSL It!¶
Vai su Siti web e domini e trova il dominio richiesto.
Fai clic su Certificati SSL/TLS.
Under «Install a free basic certificate provided by Let’s Encrypt», click Install.
Keep the «Secure the domain name» checkbox selected.
(Optional) Select other checkboxes depending on subdomains you want to secure.
Select the «Assign the certificate to the mail domain» and «DANE support» checkboxes.
Fai clic su Ottieni gratis.
Wait a while until the created TLSA records necessary for DANE are propagated to the DNS server, and then click Install.
SSL It! has secured your domain with a Let’s Encrypt certificate and also hardened the domain’s connection to the mail server using DANE.
Automatically Renewing Certificates with DANE¶
SSL It! automatically renews free SSL/TLS certificates from Let’s Encrypt 30 days in advance of their expiration. If a certificate was issued with DANE support, SSL It! will configure it for a new certificate as well.
When a new certificate is ready to be installed on the domain, SSL It! creates a corresponding set of TLSA records and sets a timer for 24 hours (it is the default value). After the timer expires, the next run of the SSL It! «Keep websites secured» task installs the new certificate and removes old TLSA records. Depending on the configured settings, Plesk also sends an email notification on the certificate renewal.
If desired, you can change the default 24-hour interval between the creation of TLSA records and the installation of a new certificate by adding lines of the following pattern to the panel.ini file:
[ext-sslit]
dane-confirmation-interval-in-hours = <the number of hours>
Ad esempio:
[ext-sslit]
dane-confirmation-interval-in-hours = 12
Disabling DANE Support in SSL It!¶
By default, DANE support is enabled in SSL It! if the Plesk server and hosted domains meet the configuration criteria necessary for DANE. It means that you and your customers can see and select the «DANE support» checkbox under «Assign the certificate to the mail domain» when securing a domain with a Let’s Encrypt certificate.
To safeguard your customers, you may want to disable DANE support in SSL It! by hiding the corresponding checkbox. To do so, add the following lines to the panel.ini file:
[ext-sslit]
daneEnabled = false
(Manually) Hardening Server Connections Using DANE¶
You can harden connections via any application protocol that is already secured using an SSL/TLS certificate via the corresponding combination of transport protocol and port (for example, «TCP/25» for SMTP, «TCP/443» for HTTPS, and so on).
Il rafforzamento delle connessioni tramite uno specifico protocollo applicativo è una procedura composta da due passaggi:
- Prima di tutto, devi generare un hash della chiave pubblica del certificato SSL/TLS. Sebbene tu possa anche usare la chiave pubblica senza hash o l’hash dell’intero certificato, in questo esempio utilizzeremo l’hash di una chiave pubblica.
- Dopodiché devi aggiungere un record DNS TLSA specificando un numero di parametri necessari, incluso l’hash.
Devi ripetere i passaggi precedenti per ogni protocollo applicativo che desideri rafforzare.
Nel seguente esempio, forniamo i passaggi per rafforzare le connessioni SMTP al server di posta per un singolo dominio. Puoi usarli come riferimento per rafforzare altre connessioni, se desideri farlo.
Prerequisiti¶
Prima di rafforzare le connessioni SMTP utilizzando DANE per un singolo dominio, devi fare quanto segue:
Protezione delle connessioni al server SMTP¶
Nota
Nell’esempio che trovi di seguito, utilizzeremo l’hash SHA-256 della chiave pubblica del certificato SSL/TLS, e non l’intero certificato. Così facendo non avrai bisogno di aggiornare il record TLSA al momento del rinnovo del certificato, a meno che non cambi anche la chiave pubblica.
Generazione dell’hash della chiave pubblica di un certificato
Vai su Siti web e domini e trova il dominio richiesto.
Fai clic su Certificati SSL/TLS.
Trova il certificato che protegge il server di posta (quello contrassegnato con «Protegge la posta») e fai clic sull’icona
per scaricare il certificato come file
*.pem
.Posiziona il file
*.pem
su una macchina Linux ed esegui il seguente comando (assicurati di cambiare la cartella di lavoro in quella contenente il file e di sostituire «certificate.pem» con il nome corretto del file):openssl x509 -in certificate.pem -pubkey -noout | openssl rsa -pubin -outform der | sha256sum | awk '{print $1}'
L’output che ne risulta (ad esempio, 499e42e36d7b04529725a1f8036e0f7cf1030b4e25a3fa1988f2572e1ce70d28
) è l’hash SHA-256 che dovrai usare quando creerai il registro DNS TLSA.
Aggiungere il record DNS TLSA
- Accedi a Plesk.
- Vai su Siti web e domini e trova il dominio richiesto.
- Vai nella scheda Hosting e DNS e fai clic su DNS.
- Clicca su Aggiungi record.
- Seleziona «TLSA» dal menu a discesa «Tipo di record».
- (Opzionale) Specifica un TTL per il record. Se non hai la certezza di quale sia il TTL ottimale, lascia il campo «TTL» vuoto. In questo caso, verrà utilizzato il valore TTL predefinito.
- Specifica la porta «25». Non aggiungere il carattere di sottolineatura, verrà fatto automaticamente.
- Specifica il protocollo «tcp». Non aggiungere il carattere di sottolineatura, verrà fatto automaticamente.
- Inserisci «posta» nel campo «Nome del dominio».
- Seleziona «3, DANE-EE» dal menu a discesa «Utilizzo».
- Seleziona «1, SPKI» dal menu a discesa «Selettore».
- Seleziona «1, SHA-256» dal menu a discesa «Tipo di macchina».
- Incolla nel campo «Dati associazione certificato» l’hash della chiave pubblica del certificato che hai generato in precedenza.
- Fai clic su OK e su Aggiorna per applicare le modifiche alla zona DNS.
Viene aggiunto un record DNS TLSA e vengono applicate le modifiche alla zona DNS. Una volta propagate le modifiche al DNS (di solito la procedura richiede circa 24 ore), DANE diventerà attivo per le connessioni SMTP al dominio.