SSL Let's Encrypt Hooks

This script is called after the nightly Let's Encrypt renewal checks.

Environment variables

  • renewed (0|1): 1 means something was renewed and Apache needs to be reloaded


These custom scripts are used for before/after calls to

Environment variables

  • acme-challenge-dir: location of the acme-challenge directory for domain validation
  • username: owner of domain
  • domain: target domain
  • action (request|renew|revoke): Let's Encrypt action
  • keysize : key size passed to

The hook also has:

  • exit_code : exit code of


These hooks are called before/after an SSL is saved.

Environment variables

  • username: user
  • domain:
  • type(server|create|paste): type of data saved possible values
    • server: domain uses server certificate
    • paste: paste certificate data. This also includes:
      • certificate: private key and certificate separated by a line
    • create: create self-signed certificate or certificate request or Let's Encrypt certificate. This also includes
      • keysize: key size used
      • encryption: which encryption algorithm is used
      • request(yes|no|letsencrypt): make certificate request(yes), or Let's Encrypt request(letsencrypt) or create self-signed certificate(no)
        • for self-singed or certificate request, certificate data is provided:
          • country
          • province
          • city
          • company
          • division
          • name
          • email
        • for Let's Encrypt certificate:
          • wildcard(yes|no): create wildcard Let's Encrypt certificate
          • le_select[X]: Domain names to include into Certificate. le_wc_select[X] format used when Let's Encrypt wildcard is selected


reloading Apache via if restart_apache_after_tally=0 is set

Note that the tally will already restart after the nightly tally, so this action isn't needed UNLESS you specifically set:


in which case, you'd need something, like:

if [ "$renewed" = "1" ]; then
	echo "action=httpd&value=reload&affect_php_fpm=no" >> /usr/local/directadmin/data/task.queue
exit 0;

saved via /usr/local/directadmin/scripts/custom/ Correct the permissions and ownership:

chmod 700 /usr/local/directadmin/scripts/custom/
chown diradmin. /usr/local/directadmin/scripts/custom/

However, not restarting after a tally means that any suspended Users might not have their configs set correctly... so we cannot really recommend restart_apache_after_tally=0 unless you have other checks, that trigger restarts of everything that needs a restart, via other means.

Last Updated: