io7m | single-page | multi-page | epub | Certusine User Manual

Certusine User Manual

CREATOR Mark Raynsford
DATE 2022-07-01T12:36:21+00:00
DESCRIPTION Documentation for the Certusine ACME client.
IDENTIFIER 26192579-ab8b-4f62-b825-c98d0bb81d6b
LANGUAGE en
RIGHTS Public Domain
TITLE Certusine User Manual
The certusine client is an ACME client with a focus on minimalism, a small footprint, and reliability. The client has the following notable features:

1.2. Features

  • Uses acme4j internally for strong RFC compliance.
  • Exclusively uses the DNS-01 ACME challenge type for ease of integration with infrastructure without having to set up insecure web servers.
  • A small, easily auditable codebase with a heavy use of modularity for correctness.
  • Exposes a service provider API for integrating with new DNS APIs.
  • Exposes a service provider API for implementing new types of certificate outputs.
  • Supports Vultr DNS.
  • Supports Gandi LiveDNS.
  • Supports writing certificates to looseleaf servers.
  • An extensive automated test suite with high coverage.
  • A small footprint; the client is designed to run in tiny 16-32mb JVM heap configurations.
  • Platform independence. No platform-dependent code is included in any form, and installations can largely be carried between platforms without changes.
  • OSGi-ready
  • JPMS-ready
  • ISC license
The certusine package is available from the following sources:
Regardless of the distribution method, the certusine package will contain a command named certusine that acts as the main entrypoint to all the package's functionality. The certusine command expects an environment variable named CERTUSINE_HOME to be defined that points to the installation directory. See the documentation for the installation methods below for details.
A distribution package can be found at Maven Central.
The certusine command requires that a Java 17+ compatible JVM be accessible via /usr/bin/env java.
Verify the integrity of the distribution zip file:

2.2.4. Verify

$ gpg --verify com.io7m.certusine.cmdline-0.0.10-distribution.zip.asc
gpg: assuming signed data in 'com.io7m.certusine.cmdline-0.0.10-distribution.zip.asc'
gpg: Signature made Tue 28 Jun 2022 15:01:56 GMT
gpg:                using RSA key 3CCE59428B30462D10459909C5607DA146E128B8
gpg:                issuer "contact@io7m.com"
gpg: using pgp trust model
gpg: Good signature from "io7m.com (2022 maven-rsa-key) <contact@io7m.com>" [unknown]
Unzip the zip file, and set CERTUSINE_HOME appropriately:

2.2.6. Extract

$ unzip com.io7m.certusine.cmdline-0.0.10-distribution.zip
$ export CERTUSINE_HOME=$(realpath certusine)
$ ./certusine/bin/certusine
info: Usage: certusine [options] [command] [command options]
...
The certusine client accepts a XML configuration file with a very strictly-defined schema. The configuration file is an XML element with the following properties:
The certusine package exclusively uses ISO 8601 syntax when specifying durations of time. For example, the string PT1M specifies a one-minute duration. The string PT1H specifies a one-hour duration.
The xmlns attribute must be present and set to the value "urn:com.io7m.certusine:configuration:1".
The Options element specifies global options for the client.
The DNSWaitTime attribute specifies the amount of time that the client will wait between creating DNS records, and then notifying the ACME servers that the records have been created. This wait time is necessary because DNS records sometimes take time to propagate, and if the client instructs the ACME server to check the records before they have had time to propagate, then the certificate authorization check will fail.
The CertificateStore attribute specifies the file that the client will use for its internal database of certificates. Relative paths are resolved relative to the configuration file.
The CertificateExpirationThreshold attribute specifies the maximum amount of time before expiration that the client will allow before it attempts to renew a certificate. For example, a value of PT72H means that the client will start attempting to renew a certificate when the certificate becomes due to expire in less than 72 hours.

3.4.5. Example Options

<Options DNSWaitTime="PT5M"
         CertificateStore="store.db"
         CertificateExpirationThreshold="PT72H"/>
The Accounts element specifies a set of ACME accounts. Most installations will only use a single account.
The Name attribute for a given account specifies the name of that account. Names can be anything, but must be unique with respect to other accounts. The names are purely used for organizational purposes internally.
The PublicKeyPath attribute for a given account specifies the location of the account's public key. Relative paths are resolved relative to the configuration file.
The PrivateKeyPath attribute for a given account specifies the location of the account's private key. Relative paths are resolved relative to the configuration file.
The AcmeURI attribute for a given account specifies the base URI that will be used for ACME operations.

3.5.6. ACME URIs

URI Description
https://acme-staging-v02.api.letsencrypt.org/directory Let's Encrypt staging server
https://acme-v02.api.letsencrypt.org/directory Let's Encrypt production server

3.5.7. Example Accounts

<Accounts>
  <Account Name="main"
           PublicKeyPath="example.pub"
           PrivateKeyPath="example.pri"
           AcmeURI="https://acme-staging-v02.api.letsencrypt.org/directory"/>
</Accounts>
The Outputs element specifies a series of outputs to which issued certificates will be written. Each output has a name, a type, and a set of parameters. Names must be unique with respect to other outputs, and the type must be one of the supported types.

3.6.2. Example Outputs

<Outputs>
  <Output Type="directory"
          Name="main-output">
    <Parameters>
      <Parameter Name="path" Value="/tmp"/>
    </Parameters>
  </Output>
</Outputs>
The DNSConfigurators element specifies a series of external DNS systems in which the certusine client will create records in order to satisfy the DNS challenges posed by the ACME server. Each configurator has a name, a type, and a set of parameters. Names must be unique with respect to other configurators, and the type must be one of the supported types.

3.7.2. Example DNSConfigurators

<DNSConfigurators>
  <DNSConfigurator Type="vultr" Name="vultr-dns">
    <Parameters>
      <Parameter Name="api-key" Value="25DDk6MT+2JI5KBABMysYLPFEOge+MZE3/GiBgrR+CU="/>
      <Parameter Name="domain" Value="example.com"/>
    </Parameters>
  </DNSConfigurator>
</DNSConfigurators>
The Domains element specifies the certificates within domains that the certusine client will attempt to issue and/or renew. A domain has exactly one account, a set of certificate outputs, and exactly one dns configurator. A domain can have any number of certificates.
The Name attribute for a given certificate specifies the name of that certificate. Names can be anything, but must be unique with respect to other certificates. The names are used for organizational purposes internally, and may be used as file names in outputs.
The PublicKeyPath attribute for a given certificate specifies the location of the certificate's public key. Relative paths are resolved relative to the configuration file.
The PrivateKeyPath attribute for a given certificate specifies the location of the certificate's private key. Relative paths are resolved relative to the configuration file.
The Hosts element for a given certificate specifies the hosts within the domain to which the certificate applies. Note that these are not fully-qualified names. Hosts may include wildcards, so for example a certificate may declare a host such as *. To issue a certificate without an explicit hostname (so, for example, to issue a certificate for example.com), simply specify an empty hostname.
The OutputReferences element for a domain specifies the names of the outputs to which certificates will be written. It is an error to specify the name of an undeclared output.
The DNSConfigurator element for a domain specifies the name of the DNS configurator that will be used to complete DNS challenges by the ACME server. It is an error to specify the name of an undeclared DNS configurator.

3.8.8. Example Domains

<Domain Name="example.com"
        Account="main"
        DNSConfigurator="vultr-dns">
  <Certificates>
    <Certificate Name="www"
                 PublicKeyPath="fake.pub"
                 PrivateKeyPath="fake.pri">
      <Hosts>
        <Host Name="www0"/>
        <Host Name="www1"/>
        <Host Name="www2"/>
      </Hosts>
    </Certificate>
    <Certificate Name="mail"
                 PublicKeyPath="fake.pub"
                 PrivateKeyPath="fake.pri">
      <Hosts>
        <Host Name="mail0"/>
        <Host Name="mail1"/>
      </Hosts>
    </Certificate>
    <Certificate Name="wildcard"
                 PublicKeyPath="fake.pub"
                 PrivateKeyPath="fake.pri">
      <Hosts>
        <Host Name="*"/>
      </Hosts>
    </Certificate>
  </Certificates>
  <OutputReferences>
    <OutputReference Name="main-output"/>
  </OutputReferences>
</Domain>
A full configuration file example is as follows:

3.9.2. Example

<?xml version="1.0" encoding="UTF-8" ?>

<Configuration xmlns="urn:com.io7m.certusine:configuration:1">

  <Options CertificateStore="store.db"
           DNSWaitTime="PT5M"
           CertificateExpirationThreshold="PT72H"/>

  <Accounts>
    <Account Name="main"
             PublicKeyPath="fake.pub"
             PrivateKeyPath="fake.pri"
             AcmeURI="https://acme-staging-v02.api.letsencrypt.org/directory"/>
  </Accounts>

  <Outputs>
    <Output Type="directory"
            Name="main-output">
      <Parameters>
        <Parameter Name="path"
                   Value="/tmp"/>
      </Parameters>
    </Output>
  </Outputs>

  <DNSConfigurators>
    <DNSConfigurator Type="vultr"
                     Name="vultr-dns">
      <Parameters>
        <Parameter Name="api-key"
                   Value="NOTANAPIKEY"/>
        <Parameter Name="domain"
                   Value="example.com"/>
      </Parameters>
    </DNSConfigurator>
  </DNSConfigurators>

  <Domains>
    <Domain Name="example.com"
            Account="main"
            DNSConfigurator="vultr-dns">
      <Certificates>
        <Certificate Name="www"
                     PublicKeyPath="fake.pub"
                     PrivateKeyPath="fake.pri">
          <Hosts>
            <Host Name="www0"/>
            <Host Name="www1"/>
            <Host Name="www2"/>
          </Hosts>
        </Certificate>
        <Certificate Name="mail"
                     PublicKeyPath="fake.pub"
                     PrivateKeyPath="fake.pri">
          <Hosts>
            <Host Name="mail0"/>
            <Host Name="mail1"/>
          </Hosts>
        </Certificate>
        <Certificate Name="wildcard"
                     PublicKeyPath="fake.pub"
                     PrivateKeyPath="fake.pri">
          <Hosts>
            <Host Name="*"/>
          </Hosts>
        </Certificate>
      </Certificates>
      <OutputReferences>
        <OutputReference Name="main-output"/>
      </OutputReferences>
    </Domain>
  </Domains>

</Configuration>
The XML schema that defines the configuration file format is as follows:

3.10.2. Schema

<?xml version="1.0" encoding="UTF-8" ?>

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:c="urn:com.io7m.certusine:configuration:1"
        targetNamespace="urn:com.io7m.certusine:configuration:1">

  <element name="Options">
    <complexType>
      <attribute name="DNSWaitTime"
                 type="duration"
                 use="optional">
        <annotation>
          <documentation>
            Specifies the amount of time that the client will wait between creating DNS records, and then notifying the
            ACME servers that the records have been created. This wait time is necessary because DNS records sometimes
            take time to propagate, and if the client instructs the ACME server to check the records before they have
            had time to propagate, then the certificate authorization check will fail.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="CertificateStore"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            Specifies the file that the client will use for its internal database of certificates. Relative paths are
            resolved relative to the configuration file.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="CertificateExpirationThreshold"
                 type="duration"
                 use="optional">
        <annotation>
          <documentation>
            specifies the maximum amount of time before expiration that the client will allow before it attempts to
            renew a certificate. For example, a value of PT72H means that the client will start attempting to renew a
            certificate when the certificate becomes due to expire in less than 72 hours.
          </documentation>
        </annotation>
      </attribute>
    </complexType>
  </element>

  <element name="Account">
    <complexType>
      <attribute name="Name"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            Specifies the name of that account. Names can be anything, but must be unique with respect to other
            accounts. The names are purely used for organizational purposes internally.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="PublicKeyPath"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            Specifies the location of the account's public key. Relative paths are resolved relative to the
            configuration file.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="PrivateKeyPath"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            Specifies the location of the account's private key. Relative paths are resolved relative to the
            configuration file.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="AcmeURI"
                 type="anyURI"
                 use="required">
        <annotation>
          <documentation>
            Specifies the base URI that will be used for ACME operations.
          </documentation>
        </annotation>
      </attribute>
    </complexType>
  </element>

  <element name="Accounts">
    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:Account"/>
      </sequence>
    </complexType>

    <key name="AccountKey">
      <selector xpath="c:Account"/>
      <field xpath="@Name"/>
    </key>
  </element>

  <element name="Parameter">
    <complexType>
      <attribute name="Name"
                 use="required"
                 type="string"/>
      <attribute name="Value"
                 use="required"
                 type="string"/>
    </complexType>
  </element>

  <element name="Parameters">
    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:Parameter"/>
      </sequence>
    </complexType>

    <key name="ParameterKey">
      <selector xpath="c:Parameter"/>
      <field xpath="@Name"/>
    </key>
  </element>

  <element name="Output">
    <annotation>
      <documentation>
        An output destination for signed certificates.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="1"
                maxOccurs="1">
        <element ref="c:Parameters"/>
      </sequence>
      <attribute name="Type"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            The type of the output. Must be one of the supported output types.
          </documentation>
        </annotation>
      </attribute>
      <attribute name="Name"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            The (unique) name of the output.
          </documentation>
        </annotation>
      </attribute>
    </complexType>
  </element>

  <element name="Outputs">
    <annotation>
      <documentation>
        A set of output destinations for signed certificates.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:Output"/>
      </sequence>
    </complexType>

    <key name="OutputKey">
      <selector xpath="c:Output"/>
      <field xpath="@Name"/>
    </key>
  </element>

  <element name="DNSConfigurator">
    <annotation>
      <documentation>
        A DNS configurator used to create and delete DNS records in response to ACME challenges.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="1"
                maxOccurs="1">
        <element ref="c:Parameters"/>
      </sequence>
      <attribute name="Type"
                 type="string"
                 use="required"/>
      <attribute name="Name"
                 type="string"
                 use="required"/>
    </complexType>
  </element>

  <element name="DNSConfigurators">
    <annotation>
      <documentation>
        A set of DNS configurators.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:DNSConfigurator"/>
      </sequence>
    </complexType>

    <key name="DNSConfiguratorKey">
      <selector xpath="c:DNSConfigurator"/>
      <field xpath="@Name"/>
    </key>
  </element>

  <element name="Host">
    <annotation>
      <documentation>
        A hostname. Note that this is not a fully-qualified domain name.
      </documentation>
    </annotation>

    <complexType>
      <attribute name="Name"
                 use="required"
                 type="string"/>
    </complexType>
  </element>

  <element name="Hosts">
    <annotation>
      <documentation>
        A set of hostnames.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:Host"/>
      </sequence>
    </complexType>

    <unique name="HostsUnique">
      <selector xpath="c:Host"/>
      <field xpath="@Name"/>
    </unique>
  </element>

  <element name="Certificate">
    <annotation>
      <documentation>
        A set of definitions that describe a certificate that will be created and signed.
      </documentation>
    </annotation>

    <complexType>
      <sequence>
        <element ref="c:Hosts"/>
      </sequence>

      <attribute name="Name"
                 use="required"
                 type="string">
        <annotation>
          <documentation>
            The certificate name.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="PublicKeyPath"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            Specifies the location of the certificate's public key. Relative paths are resolved relative to the
            configuration file.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="PrivateKeyPath"
                 type="string"
                 use="required">
        <annotation>
          <documentation>
            Specifies the location of the certificate's private key. Relative paths are resolved relative to the
            configuration file.
          </documentation>
        </annotation>
      </attribute>
    </complexType>
  </element>

  <element name="Certificates">
    <annotation>
      <documentation>
        A set of certificate definitions.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:Certificate"/>
      </sequence>
    </complexType>

    <key name="CertificateKey">
      <selector xpath="c:Certificate"/>
      <field xpath="@Name"/>
    </key>
  </element>

  <element name="OutputReference">
    <annotation>
      <documentation>
        A reference to an output definition.
      </documentation>
    </annotation>

    <complexType>
      <attribute name="Name"
                 use="required"
                 type="string"/>
    </complexType>
  </element>

  <element name="OutputReferences">
    <annotation>
      <documentation>
        A set of references to output definitions.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="1"
                maxOccurs="unbounded">
        <element ref="c:OutputReference"/>
      </sequence>
    </complexType>

    <unique name="OutputReferencesUnique">
      <selector xpath="c:OutputReference"/>
      <field xpath="@Name"/>
    </unique>
  </element>

  <element name="Domain">
    <annotation>
      <documentation>
        A set of definitions that define a domain.
      </documentation>
    </annotation>

    <complexType>
      <sequence>
        <element ref="c:Certificates"/>
        <element ref="c:OutputReferences"/>
      </sequence>

      <attribute name="Name"
                 use="required"
                 type="string">
        <annotation>
          <documentation>
            The fully qualified domain name.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="Account"
                 use="required"
                 type="string">
        <annotation>
          <documentation>
            The account to which this domain belongs.
          </documentation>
        </annotation>
      </attribute>

      <attribute name="DNSConfigurator"
                 use="required"
                 type="string">
        <annotation>
          <documentation>
            The DNS configurator that will be used for this domain.
          </documentation>
        </annotation>
      </attribute>
    </complexType>
  </element>

  <element name="Domains">
    <annotation>
      <documentation>
        A set of domain definitions.
      </documentation>
    </annotation>

    <complexType>
      <sequence minOccurs="0"
                maxOccurs="unbounded">
        <element ref="c:Domain"/>
      </sequence>
    </complexType>

    <key name="DomainKey">
      <selector xpath="c:Domain"/>
      <field xpath="@Name"/>
    </key>
  </element>

  <element name="Configuration">
    <annotation>
      <documentation>
        The configuration information for the certusine client.
      </documentation>
    </annotation>

    <complexType>
      <sequence>
        <element ref="c:Options"/>
        <element ref="c:Accounts"/>
        <element ref="c:Outputs"/>
        <element ref="c:DNSConfigurators"/>
        <element ref="c:Domains"/>
      </sequence>
    </complexType>

    <keyref name="DomainAccountsExist"
            refer="c:AccountKey">
      <selector xpath="c:Domains/c:Domain"/>
      <field xpath="@Account"/>
    </keyref>

    <keyref name="DomainDNSConfiguratorsExist"
            refer="c:DNSConfiguratorKey">
      <selector xpath="c:Domains/c:Domain"/>
      <field xpath="@DNSConfigurator"/>
    </keyref>
  </element>

</schema>
This section of the documentation describes all of the supported certificate output types.
directory - Write certificates to a local directory
The directory output writes certificates to a local directory. For a directory at /path, for a given domain name d and certificate name c, certificates are written to the following files:

4.2.2.2. Output Keys

Key Name Description
/path/d/c/public_key The certificate public key.
/path/d/c/private_key The certificate private key.
/path/d/c/certificate The PEM-encoded certificate.
/path/d/c/certificate_full_chain The PEM-encoded full certificate chain.
Note that d is percent-encoded to ensure that names are filesystem-safe.
The output accepts the following parameters:

4.2.2.5. Parameters

Parameter Type Required Description
path Path true The path to the output directory.

4.2.3.1. Example Configuration

<Output Type="directory" Name="an-example-output">
  <Parameters>
    <Parameter Name="path" Value="/tmp"/>
  </Parameters>
</Output>
etcd - Write certificates to an etcd server
The etcd output writes certificates to an external etcd server. For a given domain name d and certificate name c, certificates are written to the following database keys:

4.3.2.2. Output Keys

Key Name Description
/certificates/d/c/public_key The certificate public key.
/certificates/d/c/private_key The certificate private key.
/certificates/d/c/certificate The PEM-encoded certificate.
/certificates/d/c/certificate_full_chain The PEM-encoded full certificate chain.
The output accepts the following parameters:

4.3.2.4. Parameters

Parameter Type Required Description
password Password false The password used to authenticate with the etcd server, if required.
username User name false The username used to authenticate with the etcd server, if required.
endpoint URI true The base address/URI of the etcd server.

4.3.3.1. Example Configuration

<Output Type="etcd" Name="an-example-etcd-output">
  <Parameters>
    <Parameter Name="endpoint" Value="http://etcd.example.com:2379/"/>
    <Parameter Name="username" Value="grouch"/>
    <Parameter Name="password" Value="12345678"/>
  </Parameters>
</Output>
looseleaf - Write certificates to a looseleaf server
The looseleaf output writes certificates to an external looseleaf server. For a given domain name d and certificate name c, certificates are written to the following database keys:

4.4.2.2. Output Keys

Key Name Description
/certificates/d/c/public_key The certificate public key.
/certificates/d/c/private_key The certificate private key.
/certificates/d/c/certificate The PEM-encoded certificate.
/certificates/d/c/certificate_full_chain The PEM-encoded full certificate chain.
The output accepts the following parameters:

4.4.2.4. Parameters

Parameter Type Required Description
password Password false The password used to authenticate with the looseleaf server.
username User name false The username used to authenticate with the looseleaf server.
endpoint URI true The base address/URI of the looseleaf server.

4.4.3.1. Example Configuration

<Output Type="looseleaf" Name="an-example-looseleaf-output">
  <Parameters>
    <Parameter Name="endpoint" Value="http://looseleaf.example.com:20000/"/>
    <Parameter Name="username" Value="grouch"/>
    <Parameter Name="password" Value="12345678"/>
  </Parameters>
</Output>
This section of the documentation describes all the supported DNS configurator types.
gandi-v5 - Support for the Gandi LiveDNS API
The gandi-v5 DNS configurator supports creating and deleting DNS records using the Gandi DNS API.
The output accepts the following parameters:

5.2.2.3. Parameters

Parameter Type Required Description
domain Domain name true The domain name.
api-key API Key true The Gandi API key.
api-base URI false The Gandi API base address.
To use the production Gandi API, use the base URI https://api.gandi.net.
vultr - Support for the Vultr DNS API
The vultr DNS configurator supports creating and deleting DNS records using the Vultr DNS API.
The output accepts the following parameters:

5.3.2.3. Parameters

Parameter Type Required Description
domain Domain name true The domain name.
api-key API Key true The Vultr API key.
api-base URI false The Vultr API base address.
The certusine package provides a command-line interface for performing tasks such as starting the server, checking configuration files, hashing passwords, and etc. The base certusine command is broken into a number of subcommands which are documented over the following sections.

6.1.2. Command-Line Overview

info: Usage: certusine [options] [command] [command options]

  Options:
    --verbose
      Set the minimum logging verbosity level.
      Default: info
      Possible Values: [trace, debug, info, warn, error]

  Use the "help" command to examine specific commands:

    $ certusine help help.

  Command-line arguments can be placed one per line into a file, and the file
  can be referenced using the @ symbol:

    $ echo help > file.txt
    $ echo help >> file.txt
    $ certusine @file.txt

  Commands:
    check-configuration          Check configuration file.
    generate-keypair             Generate keypairs.
    help                         Show detailed help messages for commands.
    renew                        Renew certificates.
    show-certificate-outputs     Show supported certificate outputs.
    show-dns-configurators       Show supported DNS configurators.
    version                      Show the package version.

  Documentation:
    https://www.io7m.com/software/certusine/documentation/
All subcommands accept a --verbose parameter that may be set to one of trace, debug, info, warn, or error. This parameter sets the lower bound for the severity of messages that will be logged. For example, at debug verbosity, only messages of severity debug and above will be logged. Setting the verbosity to trace level effectively causes everything to be logged, and will produce large volumes of debugging output.
The certusine command-line tool uses jcommander to parse command-line arguments, and therefore supports placing command-line arguments into a file, one argument per line, and then referencing that file with @. For example:

6.1.5. @ Syntax

$ certusine check-configuration --file config.json

$ (cat <<EOF
check-configuration
--file
config.json
EOF
) > args.txt

$ certusine @args.txt
All subcommands, unless otherwise specified, yield an exit code of 0 on success, and a non-zero exit code on failure.
check-configuration - Validate configuration files
The check-configuration command validates configuration files.

6.2.2.2. Parameters

Parameter Type Required Description
--verbose CLPLogLevel false Set the minimum logging verbosity level.
--file Path true The configuration file
The check-configuration command will validate the configuration file specified with --file.
If the command encounters no errors or warnings, it will not print anything.

6.2.3.1. Example

$ certusine check-configuration --file main.json
error: main.json:0:0: Multiple DNS configurators defined with the name "vultr-dns"
generate-keypair - Generate keypairs
The generate-keypair command generates keypairs.

6.3.2.2. Parameters

Parameter Type Required Description
--verbose CLPLogLevel false Set the minimum logging verbosity level.
--public-key Path true The public key
--private-key Path true The private key
--overwrite boolean false Overwrite keys if already present.
The generate-keypair command will generate a keypair and write the private key to the file specified with --private-key, and write the public key to the file specified with --public-key. If the key files already exist, they will not be overwritten unless the --overwrite parameter is specified.
If the command encounters no errors or warnings, it will not print anything.

6.3.3.1. Example

$ certusine generate-keypair --private-key key.pri --public-key key.pub

$ certusine generate-keypair --private-key key.pri --public-key key.pub
error: java.nio.file.FileAlreadyExistsException: key.pub

$ certusine generate-keypair --private-key key.pri --public-key key.pub --overwrite true
renew - Issue and renew certificates
The renew command encapsulates the main functionality of the certusine package: It issues and/or renews certificates in a perpetual loop, and sends those certificates to a set of configured outputs.

6.4.2.2. Parameters

Parameter Type Required Description
--file Path true The configuration file
--only-once boolean false Renew certificates once and then exit.
--schedule Duration false Renew certificates repeatedly, waiting this duration between attempts.
--verbose CLPLogLevel false Set the minimum logging verbosity level.
The renew command will validate the configuration file specified with --file, and then loop forever attempting to issue and/or renew all certificates for all domains specified in the domains section of the configuration file. The command will pause for the duration specified by --schedule between attempts to renew certificates, and only certificates that have less than the amount of time specified by the CertificateExpirationThreshold parameter before expiration will be passed through the full ACME renewal process. If the --only-once option is specified, the client will execute one iteration of the renewal loop and then exit.
The renew command will aggressively write and re-write existing certificates to all the configured certificate outputs, redundantly. Thus, it is necessary that all certificate output implementations be idempotent with regards to the write operation. There are multiple reasons for this redundancy. Firstly, the certusine client cannot know the status of all the external systems to which it supplies certificates; external systems can be destroyed and recreated at any given time, and an external system should not be forced to wait until the next certificate renewal to receive certificates just because it wasn't present at the exact time the original issue/renewal occurred. Secondly, the very nature of systems being external means that the act of sending certificates to those systems can fail. Whilst the certusine client does retry I/O operations on failure, sometimes a system can be inaccessible long enough for all of the retry attempts to fail. If the certusine client did not redundantly write certificates, the external system would be stuck without any certificates until the next full renewal attempt.

6.4.4.1. Example

$ certusine renew --file config.json --schedule PT1M
info: [example.com] (attempt 1/10) checking if domain is authorized
info: [example.com] (attempt 1/10) domain is already authorized
info: [example.com] (attempt 1/10) checking if certificates require reissuing
info: [example.com] (attempt 1/10) certificates do not require reissuing
info: [example.com] (attempt 1/10) saving certificates to outputs
info: [example.com] (attempt 1/10) saving certificate to output directory:main-output
info: waiting until 2022-07-01T13:45:34Z for the next renewal attempt (PT1M)
show-certificate-outputs - Show supported certificate outputs
The show-certificate-outputs command displays the supported certificate outputs.

6.5.2.2. Parameters

Parameter Type Required Description
--verbose CLPLogLevel false Set the minimum logging verbosity level.
The show-certificate-outputs command will display a list of supported certificate outputs. The values printed are suitable for use as type parameters in output declarations.

6.5.3.1. Example

$ certusine show-certificate-outputs
looseleaf : Write certificates to a looseleaf server.
directory : Write certificates to a local directory.
show-dns-configurators - Show supported DNS configurators
The show-dns-configurators command displays the supported DNS configurators.

6.6.2.2. Parameters

Parameter Type Required Description
--verbose CLPLogLevel false Set the minimum logging verbosity level.
The show-dns-configurators command will display a list of supported DNS configurators. The values printed are suitable for use as type parameters in dns configurator declarations.

6.6.3.1. Example

$ certusine show-dns-configurators
vultr : Configure DNS records using the Vultr DNS API.
looseleaf-download - Download certificates from a looseleaf server
The looseleaf-download command downloads certificates from a looseleaf server. The command is designed to run perpetually as a service, repeatedly downloading certificates on a schedule.

6.7.2.2. Parameters

Parameter Type Required Description
--endpoint String true The target looseleaf endpoint base.
--output-directory Path true The output directory.
--domain String true The domain name.
--username String true The user name.
--password String true The password.
--certificate-name List<String> true The certificate name(s). May be specified multiple times.
--only-once boolean false Download certificates once and then exit.
--schedule Duration false Download certificates repeatedly, waiting this duration between attempts.
--verbose CLPLogLevel false Set the minimum logging verbosity level.

6.7.3.1. Example

$ certusine looseleaf-download               \
  --endpoint http://looseleaf4.example.com/  \
  --output-directory /certificates           \
  --domain example.com                       \
  --certificate-name www                     \
  --certificate-name mail                    \
  --username somebody                        \
  --password 12345678                        \
  --schedule PT1H
version - Display the certusine version
The version command displays the current version of the command-line tool.

6.8.2.2. Parameters

Parameter Type Required Description
--verbose CLPLogLevel false Set the minimum logging verbosity level.

6.8.3.1. Example

$ certusine version
1.0.0
io7m | single-page | multi-page | epub | Certusine User Manual