The looseleaf server is an HTTP-accessible key/value store with a focus on minimalism, a
small footprint, and reliability. The server has the following notable features:
The certusine package is available from several sources:
Regardless of the distribution method, the certusine package
will contain a command named certusine that acts as the main
entrypoint to all of 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.
The
certusine package can be installed from
Docker Hub
using
docker or
podman.
The image is configured such that CERTUSINE_HOME=/certusine,
with the certusine command existing at
/certusine/bin/certusine. The image is configured with the
expectation that users will mount a volume at /certusine/etc
containing a configuration file and space for the certusine database file. The container
can
otherwise be run without any privileges, and with a read-only root filesystem.
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:
Unzip the zip file, and set CERTUSINE_HOME appropriately:
The certusine client accepts a JSON configuration file with a very strictly-defined
format. The configuration file is a JSON object 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 %schema property must be present and set to the value
"https://www.io7m.com/software/certusine/config-1.json".
The Options property specifies global options for the client.
The DNSWaitTime property 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 property 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 property 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.
The Accounts property specifies a set of ACME accounts. Most installations will
only use a single account.
The Name property 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 property for a given account specifies the location of the
account's public key. Relative paths are resolved relative to the configuration file.
The PrivateKeyPath property for a given account specifies the location of the
account's private key. Relative paths are resolved relative to the configuration file.
The AcmeURI property for a given account specifies the base URI that will be used
for ACME operations.
The
Outputs property 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.
The
DNSConfigurators property 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 configurator, and the type must be one of the
supported types.
The
Domains property specifies the certificates within domains that the
certusine client will attempt to issue and/or renew. A domains has exactly one
account, a set of
certificate outputs, and
exactly one
dns configurator. A domain
can have any number of
certificates.
The
Name property 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 property for a given certificate specifies the location of the
certificate's public key. Relative paths are resolved relative to the configuration
file.
The PrivateKeyPath property for a given certificate specifies the location of the
certificate's private key. Relative paths are resolved relative to the configuration
file.
The Hosts property for a given certificate specifies the hosts within the domain
to which the certificate applies. Hosts may include wildcards, so for example a certificate
may declare a host
such as *.example.com.
The
Outputs property 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 property 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.
A full configuration file example is as follows:
The
JSON schema that defines the configuration file
format is as follows:
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:
The output accepts the following parameters:
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:
The output accepts the following parameters:
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:
The output accepts the following parameters:
This section of the documentation describes all of the supported DNS configurator
types.
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:
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.
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:
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.
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.
generate-keypair - Generate keypairs
The generate-keypair command generates keypairs.
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.
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.
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-one 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.
show-certificate-outputs - Show supported certificate outputs
The show-certificate-outputs command displays the supported certificate outputs.
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.
show-dns-configurators - Show supported DNS configurators
The show-dns-configurators command displays the supported DNS configurators.
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.
version - Display the certusine version
The version command displays the current version of the command-line tool.