ACMELEAF(1)                 General Commands Manual                ACMELEAF(1)

NAME
     acmeleaf - request and renew certificates from an ACME server

SYNOPSIS
     acmeleaf -c config-file [-q] [-v] [-j]

DESCRIPTION
     The acmeleaf utility processes certificate definitions from the
     configuration file named by -c and obtains or renews certificates using
     the ACME protocol and "dns-persist-01" challenges.  ACME servers whose
     directory does not advertise accountHashPrefix are assumed to implement
     draft-ietf-acme-dns-persist-01; all others are expected to implement
     draft-ietf-acme-dns-persist-03.

     If an existing certificate is present, remains valid with more than three
     days before expiry, has exactly the same SANs as configured, matches the
     private key in current/key.pem, is internally consistent with
     current/chain.pem and current/leaf-chain.pem, and either ACME renewal
     information is unavailable or the suggested ARI renewal window has not
     yet started, acmeleaf skips its renewal.

     Otherwise, it creates a new ACME order, triggers "dns-persist-01"
     authorizations as needed, polls the ACME server until the order is ready,
     finalizes the order with a newly-generated private key and CSR, downloads
     the resulting certificate chain, and archives it under the certificate
     directory.

     Each certificate block names the path to that certificate's directory.
     The acmeleaf utility creates that directory if it does not already exist.
     The acmeleaf utility creates archive/ subdirectories beneath it as needed
     and updates current to point at the newest archived version.

OPTIONS
     -c config-file  Path to the configuration file.

     -q              Quiet; log only errors.  By default, acmeleaf logs at the
                     informational level.

     -v              Verbose; also emit debug logging.

     -j              Emit logs as JSON instead of text.

CONFIGURATION
     The configuration format is in scfg: https://git.sr.ht/~emersion/scfg
     syntax.  It must contain exactly one account block and may contain any
     number of certificate blocks.

   Account
     The account block contains:
     directory  The ACME directory URL.
     kid        The registered account URL, used as the ACME key identifier.
     privkey encoded-key
                The base64-encoded PKCS#8 private key string for the ES256
                account key.
     privkey_cmd command args ...
                Command to run to obtain the base64-encoded PKCS#8 private key
                string for the ES256 account key.  The command is executed
                directly, without an intermediate shell.

     Exactly one of privkey and privkey_cmd must be provided.

     A typical account block produced by acmeleaf-mkaccount(1) looks like:

           account {
                   directory https://ca.example/directory
                   kid https://ca.example/acct/123
                   privkey MIGHAgEAABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
                   # Or, to keep the account key outside the config file:
                   # privkey_cmd age --decrypt account-key.age
           }

   Certificates
     Each certificate path block defines one certificate whose material is
     stored in the directory at the non-empty path path.  A relative path is
     resolved against the current working directory.  The directory is created
     when needed.

     Certificate blocks contain:
     domains domain ...
              The set of domains to request.  The first is used as the CSR
              common name.  This list must not be empty.

     For example:

           certificate /var/lib/lindenii/acmeleaf/example.org {
                   domains example.org *.example.org
           }

     Upon successful issuance, the following pathnames are managed in the
     certificate directory:
     current                                  A symlink to the active
                                              directory beneath archive/.
     archive/<unix-timestamp>/leaf.pem        The leaf certificate.
     archive/<unix-timestamp>/chain.pem       The issuer chain.
     archive/<unix-timestamp>/leaf-chain.pem  The leaf certificate followed by
                                              the issuer chain.
     archive/<unix-timestamp>/key.pem         The private key corresponding to
                                              the CSR.

FILE MODES
     The acmeleaf utility does not change ownership or permissions itself.  It
     creates directories with mode 0755, private keys with mode 0440, and
     other *.pem files with mode 0444, each further restricted by the process
     umask.

     To let another service group read issued material, place the certificate
     directories under a common parent and set the group and setgid bit on
     that parent once:

           chgrp tlskeys /var/lib/lindenii/acmeleaf
           chmod g+s /var/lib/lindenii/acmeleaf

     The group and setgid bit propagate to the certificate directories created
     beneath it, their archive/ subdirectories, and the files within, so the
     group is inherited without further intervention.

     For that group to retain read access, run acmeleaf with a umask that
     preserves the group bits, such as 027.  By contrast, the output of
     acmeleaf-mkaccount(1) is typically redirected into the configuration file
     under umask 077, so that the file holding the account key is not group-
     readable.

FILES
     archive/  Per-certificate archive directory created beneath each
               configured certificate directory.

EXIT STATUS
     The acmeleaf utility exits 0 on success, and >0 if an error occurs.

EXAMPLES
     A complete configuration file with one account and two certificates.
     Each certificate is preceded by the "dns-persist-01" records to
     provision.

           account {
                   directory https://ca.example/directory
                   kid https://ca.example/acct/123
                   privkey_cmd age --decrypt account-key.age
                   # Or, to embed the key directly in the config file:
                   # privkey MIGHAgEAABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
           }

           # _validation-persist.example.org. IN TXT
           # "authority.example; accounturi=https://ca.example/account-hash/sha-256/NpDnSwUthQK8zCgFdefYxAdAVPnygMLbs9US6oO-5ug; policy=wildcard"
           certificate /var/lib/lindenii/acmeleaf/example.org {
                   domains example.org *.example.org
           }

           # _validation-persist.mail.example.net. IN TXT
           # "authority.example; accounturi=https://ca.example/account-hash/sha-256/NpDnSwUthQK8zCgFdefYxAdAVPnygMLbs9US6oO-5ug"
           # _validation-persist.smtp.example.net. IN TXT
           # "authority.example; accounturi=https://ca.example/account-hash/sha-256/NpDnSwUthQK8zCgFdefYxAdAVPnygMLbs9US6oO-5ug"
           # _validation-persist.imap.example.net. IN TXT
           # "authority.example; accounturi=https://ca.example/account-hash/sha-256/NpDnSwUthQK8zCgFdefYxAdAVPnygMLbs9US6oO-5ug"
           certificate /var/lib/lindenii/acmeleaf/mail.example.net {
                   domains mail.example.net smtp.example.net imap.example.net
           }

SEE ALSO
     acmeleaf-mkaccount(1)

STANDARDS
     R. Barnes, J. Hoffman-Andrews, D. McCarney, and J. Kasten, Automatic
     Certificate Management Environment (ACME), RFC 8555,
     https://www.rfc-editor.org/info/rfc8555, March 2019.

     A. Gable, ACME Renewal Information (ARI) Extension, RFC 9773,
     https://www.rfc-editor.org/info/rfc9773, June 2025.

     S. Heurich, H. Birge-Lee, and M. Slaughter, Automated Certificate
     Management Environment (ACME) Challenge for Persistent DNS TXT Record
     Validation, Internet-Draft draft-ietf-acme-dns-persist-03,
     https://datatracker.ietf.org/doc/html/draft-ietf-acme-dns-persist-03,
     November 2026.

AUTHORS
     Runxi Yu <runxiyu@umich.edu>

Lindenii Project               November 23, 2026              Lindenii Project
