Operating System Linux

SNI on DirectAdmin: Always Enabled, enable_ssl_sni Was Removed

DirectAdmin has had SNI permanently enabled since version 1.63.5. Learn what replaced enable_ssl_sni, how mail_sni works and how to verify per-domain certificates.

Server Name Indication (SNI) lets a server present a different TLS certificate for each hostname on a single IP address, so every domain on a shared IP can have its own certificate. On current DirectAdmin releases there is nothing to switch on: SNI is always enabled and the old enable_ssl_sni setting no longer exists. This article explains what changed, how to confirm the state of your server, and how to give each domain its own certificate on a shared IP.

What happened to enable_ssl_sni

For years DirectAdmin shipped with enable_ssl_sni=0 in /usr/local/directadmin/conf/directadmin.conf. With that default the panel refused to install a certificate for a domain unless the account owned a dedicated IP address, and older tutorials tell you to change the value to 1 and restart the directadmin service.

DirectAdmin 1.63.5, released on 20 January 2022, removed the option. The changelog entry is titled "SNI support is always on" and states that enable_ssl_sni has been removed from the configuration and that SNI is now always supported. On any release from 1.63.5 onwards:

  • You do not need to add enable_ssl_sni=1 to directadmin.conf. The setting is not recognised.
  • The dedicated-IP check for certificates is gone. Users on a shared IP can install or request a certificate for each of their domains.
  • No restart of DirectAdmin is needed to make SNI available.

Check your server

Log in over SSH as root and look for SNI-related lines in the configuration file:

grep -i sni /usr/local/directadmin/conf/directadmin.conf

On a current installation you should not see enable_ssl_sni at all. If the line is still there, it is a leftover from an old installation and is ignored by releases that no longer know the option; if the server really runs a DirectAdmin release older than 1.63.5, update DirectAdmin rather than editing the value, because releases that old no longer receive fixes.

The setting that still exists is mail_sni. It controls SNI certificate support in Dovecot and Exim and also maintains the /etc/virtual/snidomains file that DirectAdmin itself and Pure-FTPd use to pick a certificate per hostname. Its default is 1. If the grep output shows mail_sni=0, it was turned off on your server, turn it back on with DirectAdmin's own command for changing configuration values:

da config-set mail_sni 1
systemctl restart directadmin

With mail_sni enabled, mail clients that connect to mail.example.com are shown the certificate of example.com instead of the server's hostname certificate.

Give a domain its own certificate on a shared IP

Because SNI is always on, issuing a certificate for a domain is an ordinary user-level task:

  1. Log in to DirectAdmin as the user that owns the domain.
  2. Open the SSL Certificates page for the domain.
  3. Choose to obtain a free, automatically renewed certificate from Let's Encrypt, or paste a certificate and private key you bought elsewhere, and save.
  4. If the site still does not answer over HTTPS, check that SSL is enabled for the domain in its domain settings.

The Let's Encrypt option is available when letsencrypt=1 is set globally, which is the default. An administrator can check or restore it from the shell:

da config-set letsencrypt 1
systemctl restart directadmin

Verify that the right certificate is served

From any machine with OpenSSL, connect to the server and send the hostname with -servername, which is the SNI value. Replace the IP address and domain with your own:

openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -dates

The subject should name example.com. Repeat the command with a second domain hosted on the same IP: you should get that domain's certificate back, which shows SNI is doing its job. You can test the mail services the same way on port 993 (IMAPS) or 465 (SMTPS) with -servername mail.example.com.

Frequently asked questions

Do I still need a dedicated IP address for an SSL certificate?

No. A dedicated IP was only necessary when clients could not tell the server which hostname they wanted before the TLS handshake. Every browser and mail client in use today sends SNI, so one shared IP can serve any number of certificates.

Which clients do not support SNI?

Only software that has been obsolete for many years, such as Internet Explorer on Windows XP or the stock browser on Android 2.x. Those clients also lack the TLS versions modern servers require, so they cannot connect regardless of SNI.

What does a visitor see when a domain on a shared IP has no certificate of its own?

The web server falls back to the server's shared certificate, which is issued for the server's hostname, so the browser shows a name-mismatch warning. Installing a certificate for the domain as described above fixes it.

I added enable_ssl_sni=1 and nothing changed. Is something broken?

No. Since DirectAdmin 1.63.5 the line has no effect in either direction. You can delete it from directadmin.conf to keep the file tidy.

Share story:

Continue reading other guides on How VPS.