Skip to content

TLS certificate hooks ​

check_letsencrypt_expiries_post.sh ​

This hook is executed after the periodic ACME system checks for TLS certificates have finished. The periodic task issues certificates for new domains and subdomains or renews existing certificates.

Hook environment variables:

NameDescriptionExample
${renewed}Number of new TLS certificates successfully issued.15
${failed}Number of failed TLS certificate issue operations.0

domain_tls_cert_save_post.sh ​

This hook is executed when a new certificate for a user-owned domain is installed or renewed. A single domain can have multiple certificates (for domain pointers, domain aliases, subdomains, etc.). This hook will be executed once for every updated certificate file.

This hook can be useful for syncing user-owned certificates with some external services.

The example below shows the certificate for alias.net, a domain alias of example.com.

Hook environment variables:

NameDescriptionExample
${username}Account UNIX username.john
${domain}Domain name this certificate belongs to.example.com
${cert_id}Internal certificate identifier, used in API requests to act on a specific certificate.alias.net
${dns_names}Space-separated list of DNS names this certificate covers.alias.net *.alias.net
${key_file_path}Full path to the private key file./usr/local/directadmin/data/users/john/domains/alias.net.key
${cert_file_path}Full path to the certificate file./usr/local/directadmin/data/users/john/domains/alias.net.cert
${chain_file_path}Full path to the certificate chain file./usr/local/directadmin/data/users/john/domains/alias.net.cacert

letsencrypt_(pre|post).sh ​

These custom scripts are used for before/after calls to letsencrypt.sh.

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 letsencrypt.sh

The hook letsencrypt_post.sh also has:

  • exit_code : exit code of letsencrypt.sh

ssl_save_(pre|post).sh ​

DEPRECATED: DirectAdmin 1.712 introduces a successor hook domain_tls_cert_save_post.sh instead.

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

Environment variables ​

  • username: user
  • domain: domain.com
  • 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