Install SSL certificates for all domains in DirectAdmin

DirectAdmin has a nice script that will install free Let’s Encrypt SSL certificates for all the domains on the server that do not have a valid one. The commands to download, set the needed permission and execute the script are:

# wget -O autoletsencrypt.sh http://files.directadmin.com/services/all/letsencrypt/autoletsencrypt.sh
# chmod 755 autoletsencrypt.sh
# ./autoletsencrypt.sh

Exemple output for our test server is:

[root@web21 ~]# wget -O autoletsencrypt.sh http://files.directadmin.com/services/all/letsencrypt/autoletsencrypt.sh
--2021-01-05 00:23:24--  http://files.directadmin.com/services/all/letsencrypt/autoletsencrypt.sh
Resolving files.directadmin.com (files.directadmin.com)... 69.162.69.58, 104.128.54.74, 185.42.221.168
Connecting to files.directadmin.com (files.directadmin.com)|69.162.69.58|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3451 (3.4K) [text/plain]
Saving to: ‘autoletsencrypt.sh’

100%[==============================================================================================================================>] 3,451       --.-K/s   in 0s

2021-01-05 00:23:24 (477 MB/s) - ‘autoletsencrypt.sh’ saved [3451/3451]

[root@web21 ~]# chmod 755 autoletsencrypt.sh
[root@web21 ~]# ./autoletsencrypt.sh
2021/01/05 00:23:40 [INFO] [dokuwikitest.xyz, www.dokuwikitest.xyz] acme: Obtaining SAN certificate
2021/01/05 00:23:41 [INFO] [dokuwikitest.xyz] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/9833496858
2021/01/05 00:23:41 [INFO] [www.dokuwikitest.xyz] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/9833496859
2021/01/05 00:23:41 [INFO] [dokuwikitest.xyz] acme: Could not find solver for: tls-alpn-01
2021/01/05 00:23:41 [INFO] [dokuwikitest.xyz] acme: use http-01 solver
2021/01/05 00:23:41 [INFO] [www.dokuwikitest.xyz] acme: Could not find solver for: tls-alpn-01
2021/01/05 00:23:41 [INFO] [www.dokuwikitest.xyz] acme: use http-01 solver
2021/01/05 00:23:41 [INFO] [dokuwikitest.xyz] acme: Trying to solve HTTP-01
2021/01/05 00:23:46 [INFO] [dokuwikitest.xyz] The server validated our request
2021/01/05 00:23:46 [INFO] [www.dokuwikitest.xyz] acme: Trying to solve HTTP-01
2021/01/05 00:23:52 [INFO] [www.dokuwikitest.xyz] The server validated our request
2021/01/05 00:23:52 [INFO] [dokuwikitest.xyz, www.dokuwikitest.xyz] acme: Validations succeeded; requesting certificates
2021/01/05 00:23:53 [INFO] [dokuwikitest.xyz] Server responded with a certificate.
Certificate for dokuwikitest.xyz,www.dokuwikitest.xyz has been created successfully!
2021/01/05 00:23:55 [INFO] [demo.plothost.com] acme: Obtaining SAN certificate
2021/01/05 00:23:55 [INFO] [demo.plothost.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/9833500165
2021/01/05 00:23:55 [INFO] [demo.plothost.com] acme: Could not find solver for: tls-alpn-01
2021/01/05 00:23:55 [INFO] [demo.plothost.com] acme: use http-01 solver
2021/01/05 00:23:55 [INFO] [demo.plothost.com] acme: Trying to solve HTTP-01
2021/01/05 00:24:01 [INFO] [demo.plothost.com] The server validated our request
2021/01/05 00:24:01 [INFO] [demo.plothost.com] acme: Validations succeeded; requesting certificates
2021/01/05 00:24:03 [INFO] [demo.plothost.com] Server responded with a certificate.
Certificate for demo.plothost.com has been created successfully!
[root@web21 ~]#

Please notice that the script will take some time to run if you have many domains on your server that require new certificates.

Notice that you can install individual Let’s Encrypt SSL certificates via the DirectAdmin GUI. Check our article on How to install Let’s Encrypt SSL certificate in DirectAdmin.

References:
DirectAdmin SSL docs

Leave a Reply