certwrangler.models module

Contents

certwrangler.models module#

This module contains all the models used in certwrangler’s config and state. Note that the name field is automatically populated on loading of the config based on the key of the object.

pydantic model certwrangler.models.NamedModel[source]#

Bases: BaseModel

Base class for models that have a name.

The _name attribute is set by the Config class as part of Config.__post_populate() based on the key that the model was defined under.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.NamedModel" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="1"><b>NamedModel</b></td></tr></table>>, tooltip="certwrangler.models.NamedModel&#xA;&#xA;Base class for models that have a name.&#xA;&#xA;The :attr:`_name` attribute is set by the :\ class:`Config` class as part of&#xA;:meth:`Config.__post_populate` based on the key that the model was defined&#xA;under.&#xA;"]; }

Show JSON schema
{
   "title": "NamedModel",
   "description": "Base class for models that have a name.\n\nThe :attr:`_name` attribute is set by the :class:`Config` class as part of\n:meth:`Config.__post_populate` based on the key that the model was defined\nunder.",
   "type": "object",
   "properties": {}
}

_name: str#
property name: str#
pydantic model certwrangler.models.StateModel[source]#

Bases: BaseModel

Base class for models representing state.

The _migrated attribute is set if the model schema was migrated.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.StateModel" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="1"><b>StateModel</b></td></tr></table>>, tooltip="certwrangler.models.StateModel&#xA;&#xA;Base class for models representing state.&#xA;&#xA;The :attr:`_migrated` attribute is set \ if the model schema was migrated.&#xA;"]; }

Show JSON schema
{
   "title": "StateModel",
   "description": "Base class for models representing state.\n\nThe :attr:`_migrated` attribute is set if the model schema was migrated.",
   "type": "object",
   "properties": {}
}

Validators:
schema_migrations: ClassVar[List[Callable[[Dict[str, Any]], Dict[str, Any]]]]#
_migrated: bool#
property _schema_version: int#

The version of the schema, which is based on how many schema migrations are defined on the model.

validator _handle_schema_migrations  »  all fields[source]#

Iterate through the defined schema_migrations callables to perform any needed migrations. This checks the incoming data for the current schema version to determine which migrations it should apply. This also instantiates the class and sets the _migrated variable to True if any of the migration callables were applied.

The callables should mutate the data dict as needed to migrate the schema then return it.

pydantic model certwrangler.models.Solver[source]#

Bases: NamedModel

Base class for ACME challenge solver drivers.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.Solver" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Solver</b></td></tr><tr><td>driver</td><td port="driver">str</td></tr><tr><td>zones</td><td port="zones">list[str]</td></tr></table>>, tooltip="certwrangler.models.Solver&#xA;&#xA;Base class for ACME challenge solver drivers.&#xA;"]; }

Show JSON schema
{
   "title": "Solver",
   "description": "Base class for ACME challenge solver drivers.",
   "type": "object",
   "properties": {
      "driver": {
         "description": "The name of the driver to use.",
         "title": "Driver",
         "type": "string"
      },
      "zones": {
         "description": "A list of DNS zones this solver should be used for.",
         "items": {
            "pattern": "^(?:(\\*\\.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$",
            "type": "string"
         },
         "title": "Zones",
         "type": "array"
      }
   },
   "required": [
      "driver",
      "zones"
   ]
}

Fields:
Validators:
field driver: str [Required]#

The name of the driver to use.

field zones: List[Domain] [Required]#

A list of DNS zones this solver should be used for.

Validated by:
abstractmethod create(name: str, domain: str, content: str) None[source]#

This should handle the logic of creating a TXT record.

abstractmethod delete(name: str, domain: str, content: str) None[source]#

This should handle the logic of deleting a TXT record.

initialize() None[source]#

Any driver specific initialization steps (creating resources, setting up clients, etc) should be placed here.

validator __validate_zones  »  zones#

Validate that the configured zones have valid SOA records.

Returns:

A list of valid zones.

Raises:

ValueError – Raised if a configured zone doesn’t have an SOA record.

class certwrangler.models.Encryptor(fernets: Iterable[Fernet])[source]#

Bases: MultiFernet

This just adds the ability to generate a fingerprint of a fernet key.

property fingerprint: str#

Returns the fingerprint of the active encryption key.

Returns:

A string representing the fingerprint of the active key.

pydantic model certwrangler.models.StateManager[source]#

Bases: BaseModel

Base class for state manager drivers.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.StateManager" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>StateManager</b></td></tr><tr><td>driver</td><td port="driver">str</td></tr><tr><td>encryption_keys</td><td port="encryption_keys">list[Fernet]</td></tr></table>>, tooltip="certwrangler.models.StateManager&#xA;&#xA;Base class for state manager drivers.&#xA;"]; }

Show JSON schema
{
   "title": "StateManager",
   "description": "Base class for state manager drivers.",
   "type": "object",
   "properties": {
      "driver": {
         "description": "The name of the driver to use.",
         "title": "Driver",
         "type": "string"
      },
      "encryption_keys": {
         "description": "An optional list of encryption keys to use to encrypt the state. Only the top-most key will be used for encryption operations, the additional keys are only used to decrypt the state in the case that a new key was added. New keys can be generated using the ``certwrangler state generate-key`` command.",
         "items": {
            "type": "string"
         },
         "title": "Encryption Keys",
         "type": "array"
      }
   },
   "required": [
      "driver"
   ]
}

Fields:
field driver: str [Required]#

The name of the driver to use.

field encryption_keys: List[FernetKey] [Optional]#

An optional list of encryption keys to use to encrypt the state. Only the top-most key will be used for encryption operations, the additional keys are only used to decrypt the state in the case that a new key was added. New keys can be generated using the certwrangler state generate-key command.

_config: Config#
_encryptor: Encryptor | None#
property encryptor: Encryptor | None#

This sets up and returns an Encryptor if encryption_keys are defined.

Returns:

The initialized Encryptor if encryption_keys are defined, otherwise returns None.

initialize() None[source]#

Any driver specific initialization steps (creating resources, setting up clients, etc) should be placed here.

abstractmethod list() Dict[str, Dict[str, Any]][source]#

Lists all the saved states for the given entity_class including encryption fingerprint.

abstractmethod save(entity: Account | Cert, encrypt: bool = True) None[source]#

Saves the state of the given entity.

abstractmethod load(entity: Account | Cert) None[source]#

Loads the state of the given entity to memory.

abstractmethod delete(entity_class: Literal['account', 'cert'], entity_name: str) None[source]#

Deletes the given entity_name from state.

pydantic model certwrangler.models.Store[source]#

Bases: NamedModel

Base class for store drivers.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.Store" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Store</b></td></tr><tr><td>driver</td><td port="driver">str</td></tr></table>>, tooltip="certwrangler.models.Store&#xA;&#xA;Base class for store drivers.&#xA;"]; }

Show JSON schema
{
   "title": "Store",
   "description": "Base class for store drivers.",
   "type": "object",
   "properties": {
      "driver": {
         "description": "The name of the driver to use.",
         "title": "Driver",
         "type": "string"
      }
   },
   "required": [
      "driver"
   ]
}

Fields:
field driver: str [Required]#

The name of the driver to use.

abstractmethod publish(cert: Cert) None[source]#

This should handle the logic of publishing the cert to the store.

initialize() None[source]#

Any driver specific initialization steps (creating resources, setting up clients, etc) should be placed here.

static _join_certs(*certs: str) str[source]#

Joins multiple certs together into a bundle.

class certwrangler.models.AccountStatus(*values)[source]#

Bases: str, Enum

new#
active#
pydantic model certwrangler.models.AccountState[source]#

Bases: StateModel

Managed ACME account state.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.AccountState" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>AccountState</b></td></tr><tr><td>registration</td><td port="registration">Optional[RegistrationResource]</td></tr><tr><td>key</td><td port="key">Optional[JWK]</td></tr><tr><td>key_size</td><td port="key_size">Optional[int]</td></tr><tr><td>status</td><td port="status">AccountStatus</td></tr></table>>, tooltip="certwrangler.models.AccountState&#xA;&#xA;Managed ACME account state.&#xA;"]; }

Show JSON schema
{
   "title": "AccountState",
   "description": "Managed ACME account state.",
   "type": "object",
   "properties": {
      "registration": {
         "anyOf": [
            {
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The ACME registration record.",
         "title": "Registration"
      },
      "key": {
         "anyOf": [
            {
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The current RSA key.",
         "title": "Key"
      },
      "key_size": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The size of the current RSA key in bits.",
         "title": "Key Size"
      },
      "status": {
         "$ref": "#/$defs/AccountStatus",
         "default": "new"
      }
   },
   "$defs": {
      "AccountStatus": {
         "enum": [
            "new",
            "active"
         ],
         "title": "AccountStatus",
         "type": "string"
      }
   }
}

Fields:
Validators:

schema_migrations: ClassVar[List[Callable[[Dict[str, Any]], Dict[str, Any]]]]#
field registration: Registration | None = None#

The ACME registration record.

Validated by:
field key: JWKRSAKey | None = None#

The current RSA key.

Validated by:
field key_size: int | None = None#

The size of the current RSA key in bits.

Validated by:
field status: AccountStatus = AccountStatus.new#
Validated by:
pydantic model certwrangler.models.Account[source]#

Bases: NamedModel

Managed ACME account definition.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.Account" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Account</b></td></tr><tr><td>emails</td><td port="emails">list[EmailStr]</td></tr><tr><td>server</td><td port="server">HttpUrl</td></tr><tr><td>key_size</td><td port="key_size">int</td></tr></table>>, tooltip="certwrangler.models.Account&#xA;&#xA;Managed ACME account definition.&#xA;"]; }

Show JSON schema
{
   "title": "Account",
   "description": "Managed ACME account definition.",
   "type": "object",
   "properties": {
      "emails": {
         "description": "A list of email addresses for the account.",
         "items": {
            "format": "email",
            "type": "string"
         },
         "title": "Emails",
         "type": "array"
      },
      "server": {
         "default": "https://acme-v02.api.letsencrypt.org/directory",
         "description": "The URL of the ACME server.",
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Server",
         "type": "string"
      },
      "key_size": {
         "default": 2048,
         "description": "The desired size of the RSA key in bits",
         "title": "Key Size",
         "type": "integer"
      }
   },
   "required": [
      "emails"
   ]
}

Fields:
Validators:
field emails: List[EmailStr] [Required]#

A list of email addresses for the account.

Validated by:
field server: HttpUrl = HttpUrl('https://acme-v02.api.letsencrypt.org/directory')#

The URL of the ACME server.

field key_size: int = 2048#

The desired size of the RSA key in bits

_state: AccountState#
property state: AccountState#
validator __validate_unique_emails  »  emails#

Validates that all the configured emails are unique.

pydantic model certwrangler.models.Subject[source]#

Bases: NamedModel

Cert subject.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.Subject" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Subject</b></td></tr><tr><td>country</td><td port="country">Optional[NameAttribute]</td></tr><tr><td>state_or_province</td><td port="state_or_province">Optional[NameAttribute]</td></tr><tr><td>locality</td><td port="locality">Optional[NameAttribute]</td></tr><tr><td>organization</td><td port="organization">Optional[NameAttribute]</td></tr><tr><td>organizational_unit</td><td port="organizational_unit">Optional[NameAttribute]</td></tr></table>>, tooltip="certwrangler.models.Subject&#xA;&#xA;Cert subject.&#xA;"]; }

Show JSON schema
{
   "title": "Subject",
   "description": "Cert subject.",
   "type": "object",
   "properties": {
      "country": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The country name OID.",
         "title": "Country"
      },
      "state_or_province": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The state or province OID.",
         "title": "State Or Province"
      },
      "locality": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The locality OID.",
         "title": "Locality"
      },
      "organization": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The organization OID.",
         "title": "Organization"
      },
      "organizational_unit": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The organizational unit OID.",
         "title": "Organizational Unit"
      }
   }
}

Fields:
field country: CountryNameOID | None = None#

The country name OID.

field state_or_province: StateOrProvinceOID | None = None#

The state or province OID.

field locality: LocalityOID | None = None#

The locality OID.

field organization: OrganizationOID | None = None#

The organization OID.

field organizational_unit: OrganizationalUnitOID | None = None#

The organizational unit OID.

class certwrangler.models.CertStatus(*values)[source]#

Bases: str, Enum

new#
active#
renewing#
pydantic model certwrangler.models.CertState[source]#

Bases: StateModel

Managed cert state.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.CertState" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>CertState</b></td></tr><tr><td>url</td><td port="url">Optional[str]</td></tr><tr><td>key</td><td port="key">Optional[Union[Ed25519PrivateKey, Ed448PrivateKey, RSAPrivateKey, DSAPrivateKey, EllipticCurvePrivateKey]]</td></tr><tr><td>key_size</td><td port="key_size">Optional[int]</td></tr><tr><td>cert</td><td port="cert">Optional[Certificate]</td></tr><tr><td>chain</td><td port="chain">Optional[list[Certificate]]</td></tr><tr><td>csr</td><td port="csr">Optional[CertificateSigningRequest]</td></tr><tr><td>order</td><td port="order">Optional[OrderResource]</td></tr><tr><td>status</td><td port="status">CertStatus</td></tr></table>>, tooltip="certwrangler.models.CertState&#xA;&#xA;Managed cert state.&#xA;"]; }

Show JSON schema
{
   "title": "CertState",
   "description": "Managed cert state.",
   "type": "object",
   "properties": {
      "url": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The URL of the cert retrieved from the ACME server.",
         "title": "Url"
      },
      "key": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The cert's RSA key.",
         "title": "Key"
      },
      "key_size": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The size of the RSA key in bits.",
         "title": "Key Size"
      },
      "cert": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The cert returned by the ACME server.",
         "title": "Cert"
      },
      "chain": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The chain of trust returned by the ACME server.",
         "title": "Chain"
      },
      "csr": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The CSR generated to request the cert.",
         "title": "Csr"
      },
      "order": {
         "anyOf": [
            {
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The order if an order is currently active.",
         "title": "Order"
      },
      "status": {
         "$ref": "#/$defs/CertStatus",
         "default": "new"
      }
   },
   "$defs": {
      "CertStatus": {
         "enum": [
            "new",
            "active",
            "renewing"
         ],
         "title": "CertStatus",
         "type": "string"
      }
   }
}

Fields:
Validators:

schema_migrations: ClassVar[List[Callable[[Dict[str, Any]], Dict[str, Any]]]]#
field url: str | None = None#

The URL of the cert retrieved from the ACME server.

Validated by:
field key: RSAKey | None = None#

The cert’s RSA key.

Validated by:
field key_size: int | None = None#

The size of the RSA key in bits.

Validated by:
field cert: X509Certificate | None = None#

The cert returned by the ACME server.

Validated by:
field chain: List[X509Certificate] | None = None#

The chain of trust returned by the ACME server.

Validated by:
field csr: X509CSR | None = None#

The CSR generated to request the cert.

Validated by:
field order: Order | None = None#

The order if an order is currently active.

Validated by:
field status: CertStatus = CertStatus.new#
Validated by:
property fullchain: WithJsonSchema(json_schema={'type': 'string'}, mode=None)]] | None#

The full chain of trust including the leaf cert.

pydantic model certwrangler.models.Cert[source]#

Bases: NamedModel

Managed cert definition.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.Cert" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Cert</b></td></tr><tr><td>common_name</td><td port="common_name">str</td></tr><tr><td>account_name</td><td port="account_name">str</td></tr><tr><td>store_names</td><td port="store_names">list[str]</td></tr><tr><td>store_key</td><td port="store_key">Optional[str]</td></tr><tr><td>subject_name</td><td port="subject_name">str</td></tr><tr><td>alt_names</td><td port="alt_names">list[str]</td></tr><tr><td>wait_timeout</td><td port="wait_timeout">timedelta</td></tr><tr><td>key_size</td><td port="key_size">int</td></tr><tr><td>follow_cnames</td><td port="follow_cnames">bool</td></tr><tr><td>renewal_threshold</td><td port="renewal_threshold">timedelta</td></tr></table>>, tooltip="certwrangler.models.Cert&#xA;&#xA;Managed cert definition.&#xA;"]; }

Show JSON schema
{
   "title": "Cert",
   "description": "Managed cert definition.",
   "type": "object",
   "properties": {
      "common_name": {
         "description": "The common name for the cert.",
         "pattern": "^(?:(\\*\\.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$",
         "title": "Common Name",
         "type": "string"
      },
      "account_name": {
         "description": "The name of the configured ACME account the cert should be created under.",
         "title": "Account Name",
         "type": "string"
      },
      "store_names": {
         "description": "A list of the configured stores the cert should be published to.",
         "items": {
            "type": "string"
         },
         "title": "Store Names",
         "type": "array"
      },
      "store_key": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional sub-key the cert should be published to in the store. Currently only supported by the vault store driver.",
         "title": "Store Key"
      },
      "subject_name": {
         "default": "default",
         "description": "The name of the configured subject the cert should be created with.",
         "title": "Subject Name",
         "type": "string"
      },
      "alt_names": {
         "description": "A list of alternative names for the cert.",
         "items": {
            "pattern": "^(?:(\\*\\.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$",
            "type": "string"
         },
         "title": "Alt Names",
         "type": "array"
      },
      "wait_timeout": {
         "default": "PT5M",
         "description": "Wait timeout for DNS operations.",
         "format": "duration",
         "title": "Wait Timeout",
         "type": "string"
      },
      "key_size": {
         "default": 2048,
         "description": "The desired size of the RSA key in bits.",
         "title": "Key Size",
         "type": "integer"
      },
      "follow_cnames": {
         "default": true,
         "description": "Whether to follow CNAMEs for DNS operations.",
         "title": "Follow Cnames",
         "type": "boolean"
      },
      "renewal_threshold": {
         "default": "P30D",
         "description": "How many days before a cert expires should it be renewed.",
         "format": "duration",
         "title": "Renewal Threshold",
         "type": "string"
      }
   },
   "required": [
      "common_name",
      "account_name",
      "store_names"
   ]
}

Fields:
Validators:
field common_name: Domain [Required]#

The common name for the cert.

Constraints:
  • pattern = ^(?:(*.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$

field account_name: str [Required]#

The name of the configured ACME account the cert should be created under.

field store_names: List[str] [Required]#

A list of the configured stores the cert should be published to.

Validated by:
field store_key: str | None = None#

Optional sub-key the cert should be published to in the store. Currently only supported by the vault store driver.

field subject_name: str = 'default'#

The name of the configured subject the cert should be created with.

field alt_names: List[Domain] [Optional]#

A list of alternative names for the cert.

field wait_timeout: timedelta = datetime.timedelta(seconds=300)#

Wait timeout for DNS operations.

field key_size: int = 2048#

The desired size of the RSA key in bits.

field follow_cnames: bool = True#

Whether to follow CNAMEs for DNS operations.

field renewal_threshold: Days = datetime.timedelta(days=30)#

How many days before a cert expires should it be renewed.

Constraints:
  • func = <function <lambda> at 0x7f21c39359e0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = always

_state: CertState#
_config: Config#
property state: CertState#
property account: Account#

Returns the account object configured for the cert.

Raises:

ValueError – Raised if the account can’t be found in the config.

property stores: List[Store]#

Returns a list of the configured store objects.

Raises:

ValueError – Raised if a store can’t be found in the config.

property solvers: Dict[str, Solver]#

Returns the available solvers.

property subject: Subject#

Returns the subject object configured for the cert.

Raises:

ValueError – Raised if a subject can’t be found in the config.

get_solver_for_zone(zone: str) Solver[source]#

Finds a solver for a given zone name.

Raises:

ValueError – Raised if a solver for the zone can’t be found in the config.

validator __validate_unique_stores  »  store_names#

Validates that all the configured stores are unique.

Raises:

ValueError – Raised if there are duplicate stores.

property time_left: timedelta#

Returns the cert expiry as a datetime.timedelta. If no cert is in the state it returns an empty datetime.timedelta.

Returns:

A datetime.timedelta representing the cert’s expiry.

property needs_renewal: bool#

Check if a cert needs to be renewed by checking its expiry time is less than renewal_threshold, or if it’s common_name or alternative_names changed.

We specifically don’t check for the subject since apparently LE strips that out.

Returns:

A bool representing if the cert should be renewed.

pydantic model certwrangler.models.ReconcilerConfig[source]#

Bases: BaseModel

Config for the reconciler loop subsystem.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.ReconcilerConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>ReconcilerConfig</b></td></tr><tr><td>interval</td><td port="interval">int</td></tr></table>>, tooltip="certwrangler.models.ReconcilerConfig&#xA;&#xA;Config for the reconciler loop subsystem.&#xA;"]; }

Show JSON schema
{
   "title": "ReconcilerConfig",
   "description": "Config for the reconciler loop subsystem.",
   "type": "object",
   "properties": {
      "interval": {
         "default": 60,
         "description": "Reconciler interval in seconds.",
         "title": "Interval",
         "type": "integer"
      }
   }
}

Fields:
field interval: int = 60#

Reconciler interval in seconds.

pydantic model certwrangler.models.MetricsConfig[source]#

Bases: BaseModel

Config for the metrics subsystem.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.MetricsConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>MetricsConfig</b></td></tr><tr><td>mount</td><td port="mount">str</td></tr></table>>, tooltip="certwrangler.models.MetricsConfig&#xA;&#xA;Config for the metrics subsystem.&#xA;"]; }

Show JSON schema
{
   "title": "MetricsConfig",
   "description": "Config for the metrics subsystem.",
   "type": "object",
   "properties": {
      "mount": {
         "default": "/metrics",
         "description": "The mount-point for metrics.",
         "title": "Mount",
         "type": "string"
      }
   }
}

Fields:
field mount: str = '/metrics'#

The mount-point for metrics.

pydantic model certwrangler.models.HttpConfig[source]#

Bases: BaseModel

Config for the HTTP subsystem.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.HttpConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>HttpConfig</b></td></tr><tr><td>host</td><td port="host">IPvAnyAddress</td></tr><tr><td>port</td><td port="port">int</td></tr><tr><td>server_name</td><td port="server_name">str</td></tr><tr><td>ssl_key_file</td><td port="ssl_key_file">Optional[Path]</td></tr><tr><td>ssl_key_password</td><td port="ssl_key_password">Optional[str]</td></tr><tr><td>ssl_cert_file</td><td port="ssl_cert_file">Optional[Path]</td></tr><tr><td>ssl_ca_certs_file</td><td port="ssl_ca_certs_file">Optional[Path]</td></tr></table>>, tooltip="certwrangler.models.HttpConfig&#xA;&#xA;Config for the HTTP subsystem.&#xA;"]; }

Show JSON schema
{
   "title": "HttpConfig",
   "description": "Config for the HTTP subsystem.",
   "type": "object",
   "properties": {
      "host": {
         "default": "127.0.0.1",
         "description": "Address the HTTP server should bind to.",
         "format": "ipvanyaddress",
         "title": "Host",
         "type": "string"
      },
      "port": {
         "default": 6377,
         "description": "Port the HTTP server should listen on.",
         "title": "Port",
         "type": "integer"
      },
      "server_name": {
         "default": "certwrangler",
         "description": "Name of the HTTP server.",
         "title": "Server Name",
         "type": "string"
      },
      "ssl_key_file": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional SSL key.",
         "title": "Ssl Key File"
      },
      "ssl_key_password": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional SSL key password.",
         "title": "Ssl Key Password"
      },
      "ssl_cert_file": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional SSL cert.",
         "title": "Ssl Cert File"
      },
      "ssl_ca_certs_file": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional SSL CA cert.",
         "title": "Ssl Ca Certs File"
      }
   }
}

Fields:
Validators:
field host: IPvAnyAddress = IPv4Address('127.0.0.1')#

Address the HTTP server should bind to.

Validated by:
field port: int = 6377#

Port the HTTP server should listen on.

Validated by:
field server_name: str = 'certwrangler'#

Name of the HTTP server.

Validated by:
field ssl_key_file: Path | None = None#

Optional SSL key.

Validated by:
field ssl_key_password: str | None = None#

Optional SSL key password.

Validated by:
field ssl_cert_file: Path | None = None#

Optional SSL cert.

Validated by:
field ssl_ca_certs_file: Path | None = None#

Optional SSL CA cert.

Validated by:
validator __validate_ssl_files_exist  »  ssl_key_file, ssl_cert_file, ssl_ca_certs_file#

Validates that the specified file exists.

Raises:

ValueError – Raised if the file does not exist.

validator __validate_ssl_options  »  all fields#

Validate that we have both ssl_key_file and ssl_cert_file populated if either are set.

Raises:

ValueError – Raised if either ssl_key_file or ssl_cert_file is not set when the other is set.

pydantic model certwrangler.models.DaemonConfig[source]#

Bases: BaseModel

Config for the daemon.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.DaemonConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>DaemonConfig</b></td></tr><tr><td>reconciler</td><td port="reconciler">ReconcilerConfig</td></tr><tr><td>metrics</td><td port="metrics">MetricsConfig</td></tr><tr><td>http</td><td port="http">HttpConfig</td></tr><tr><td>watchdog_interval</td><td port="watchdog_interval">int</td></tr></table>>, tooltip="certwrangler.models.DaemonConfig&#xA;&#xA;Config for the daemon.&#xA;"]; "certwrangler.models.HttpConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>HttpConfig</b></td></tr><tr><td>host</td><td port="host">IPvAnyAddress</td></tr><tr><td>port</td><td port="port">int</td></tr><tr><td>server_name</td><td port="server_name">str</td></tr><tr><td>ssl_key_file</td><td port="ssl_key_file">Optional[Path]</td></tr><tr><td>ssl_key_password</td><td port="ssl_key_password">Optional[str]</td></tr><tr><td>ssl_cert_file</td><td port="ssl_cert_file">Optional[Path]</td></tr><tr><td>ssl_ca_certs_file</td><td port="ssl_ca_certs_file">Optional[Path]</td></tr></table>>, tooltip="certwrangler.models.HttpConfig&#xA;&#xA;Config for the HTTP subsystem.&#xA;"]; "certwrangler.models.DaemonConfig":http:e -> "certwrangler.models.HttpConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; "certwrangler.models.MetricsConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>MetricsConfig</b></td></tr><tr><td>mount</td><td port="mount">str</td></tr></table>>, tooltip="certwrangler.models.MetricsConfig&#xA;&#xA;Config for the metrics subsystem.&#xA;"]; "certwrangler.models.DaemonConfig":metrics:e -> "certwrangler.models.MetricsConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; "certwrangler.models.ReconcilerConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>ReconcilerConfig</b></td></tr><tr><td>interval</td><td port="interval">int</td></tr></table>>, tooltip="certwrangler.models.ReconcilerConfig&#xA;&#xA;Config for the reconciler loop subsystem.&#xA;"]; "certwrangler.models.DaemonConfig":reconciler:e -> "certwrangler.models.ReconcilerConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; }

Show JSON schema
{
   "title": "DaemonConfig",
   "description": "Config for the daemon.",
   "type": "object",
   "properties": {
      "reconciler": {
         "$ref": "#/$defs/ReconcilerConfig",
         "description": "Config for the reconciler."
      },
      "metrics": {
         "$ref": "#/$defs/MetricsConfig",
         "description": "Config for metrics."
      },
      "http": {
         "$ref": "#/$defs/HttpConfig",
         "description": "Config for the http server."
      },
      "watchdog_interval": {
         "default": 30,
         "description": "Watchdog interval in seconds. The watchdog periodically checks to see if any of the daemon threads have died.",
         "title": "Watchdog Interval",
         "type": "integer"
      }
   },
   "$defs": {
      "HttpConfig": {
         "description": "Config for the HTTP subsystem.",
         "properties": {
            "host": {
               "default": "127.0.0.1",
               "description": "Address the HTTP server should bind to.",
               "format": "ipvanyaddress",
               "title": "Host",
               "type": "string"
            },
            "port": {
               "default": 6377,
               "description": "Port the HTTP server should listen on.",
               "title": "Port",
               "type": "integer"
            },
            "server_name": {
               "default": "certwrangler",
               "description": "Name of the HTTP server.",
               "title": "Server Name",
               "type": "string"
            },
            "ssl_key_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL key.",
               "title": "Ssl Key File"
            },
            "ssl_key_password": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL key password.",
               "title": "Ssl Key Password"
            },
            "ssl_cert_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL cert.",
               "title": "Ssl Cert File"
            },
            "ssl_ca_certs_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL CA cert.",
               "title": "Ssl Ca Certs File"
            }
         },
         "title": "HttpConfig",
         "type": "object"
      },
      "MetricsConfig": {
         "description": "Config for the metrics subsystem.",
         "properties": {
            "mount": {
               "default": "/metrics",
               "description": "The mount-point for metrics.",
               "title": "Mount",
               "type": "string"
            }
         },
         "title": "MetricsConfig",
         "type": "object"
      },
      "ReconcilerConfig": {
         "description": "Config for the reconciler loop subsystem.",
         "properties": {
            "interval": {
               "default": 60,
               "description": "Reconciler interval in seconds.",
               "title": "Interval",
               "type": "integer"
            }
         },
         "title": "ReconcilerConfig",
         "type": "object"
      }
   }
}

Fields:
field reconciler: ReconcilerConfig [Optional]#

Config for the reconciler.

field metrics: MetricsConfig [Optional]#

Config for metrics.

field http: HttpConfig [Optional]#

Config for the http server.

field watchdog_interval: int = 30#

Watchdog interval in seconds. The watchdog periodically checks to see if any of the daemon threads have died.

pydantic model certwrangler.models.Config[source]#

Bases: BaseModel

The root config object for the application.

This class is the root of the entire config tree of the application and is responsible for loading any of the plugins specified by sub-members in their configuration as well as triggering any initialization hooks that may be specified by the various plugins.

Show Entity Relationship Diagram

digraph "Entity Relationship Diagram created by erdantic" { graph [fontcolor=gray66, fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=9, nodesep=0.5, rankdir=LR, ranksep=1.5 ]; node [fontname="Times New Roman,Times,Liberation Serif,serif", fontsize=14, label="\N", shape=plain ]; edge [dir=both]; "certwrangler.models.Account" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Account</b></td></tr><tr><td>emails</td><td port="emails">list[EmailStr]</td></tr><tr><td>server</td><td port="server">HttpUrl</td></tr><tr><td>key_size</td><td port="key_size">int</td></tr></table>>, tooltip="certwrangler.models.Account&#xA;&#xA;Managed ACME account definition.&#xA;"]; "certwrangler.models.Cert" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Cert</b></td></tr><tr><td>common_name</td><td port="common_name">str</td></tr><tr><td>account_name</td><td port="account_name">str</td></tr><tr><td>store_names</td><td port="store_names">list[str]</td></tr><tr><td>store_key</td><td port="store_key">Optional[str]</td></tr><tr><td>subject_name</td><td port="subject_name">str</td></tr><tr><td>alt_names</td><td port="alt_names">list[str]</td></tr><tr><td>wait_timeout</td><td port="wait_timeout">timedelta</td></tr><tr><td>key_size</td><td port="key_size">int</td></tr><tr><td>follow_cnames</td><td port="follow_cnames">bool</td></tr><tr><td>renewal_threshold</td><td port="renewal_threshold">timedelta</td></tr></table>>, tooltip="certwrangler.models.Cert&#xA;&#xA;Managed cert definition.&#xA;"]; "certwrangler.models.Config" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Config</b></td></tr><tr><td>daemon</td><td port="daemon">DaemonConfig</td></tr><tr><td>state_manager</td><td port="state_manager">StateManager</td></tr><tr><td>accounts</td><td port="accounts">dict[str, Account]</td></tr><tr><td>certs</td><td port="certs">dict[str, Cert]</td></tr><tr><td>solvers</td><td port="solvers">dict[str, Solver]</td></tr><tr><td>stores</td><td port="stores">dict[str, Store]</td></tr><tr><td>subjects</td><td port="subjects">dict[str, Subject]</td></tr></table>>, tooltip="certwrangler.models.Config&#xA;&#xA;The root config object for the application.&#xA;&#xA;This class is the root of the entire config \ tree of the application and is&#xA;responsible for loading any of the plugins specified by sub-members in&#xA;their configuration \ as well as triggering any initialization hooks that&#xA;may be specified by the various plugins.&#xA;"]; "certwrangler.models.Config":accounts:e -> "certwrangler.models.Account":_root:w [arrowhead=crownone, arrowtail=nonenone]; "certwrangler.models.Config":certs:e -> "certwrangler.models.Cert":_root:w [arrowhead=crownone, arrowtail=nonenone]; "certwrangler.models.DaemonConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>DaemonConfig</b></td></tr><tr><td>reconciler</td><td port="reconciler">ReconcilerConfig</td></tr><tr><td>metrics</td><td port="metrics">MetricsConfig</td></tr><tr><td>http</td><td port="http">HttpConfig</td></tr><tr><td>watchdog_interval</td><td port="watchdog_interval">int</td></tr></table>>, tooltip="certwrangler.models.DaemonConfig&#xA;&#xA;Config for the daemon.&#xA;"]; "certwrangler.models.Config":daemon:e -> "certwrangler.models.DaemonConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; "certwrangler.models.Solver" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Solver</b></td></tr><tr><td>driver</td><td port="driver">str</td></tr><tr><td>zones</td><td port="zones">list[str]</td></tr></table>>, tooltip="certwrangler.models.Solver&#xA;&#xA;Base class for ACME challenge solver drivers.&#xA;"]; "certwrangler.models.Config":solvers:e -> "certwrangler.models.Solver":_root:w [arrowhead=crownone, arrowtail=nonenone]; "certwrangler.models.StateManager" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>StateManager</b></td></tr><tr><td>driver</td><td port="driver">str</td></tr><tr><td>encryption_keys</td><td port="encryption_keys">list[Fernet]</td></tr></table>>, tooltip="certwrangler.models.StateManager&#xA;&#xA;Base class for state manager drivers.&#xA;"]; "certwrangler.models.Config":state_manager:e -> "certwrangler.models.StateManager":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; "certwrangler.models.Store" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Store</b></td></tr><tr><td>driver</td><td port="driver">str</td></tr></table>>, tooltip="certwrangler.models.Store&#xA;&#xA;Base class for store drivers.&#xA;"]; "certwrangler.models.Config":stores:e -> "certwrangler.models.Store":_root:w [arrowhead=crownone, arrowtail=nonenone]; "certwrangler.models.Subject" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>Subject</b></td></tr><tr><td>country</td><td port="country">Optional[NameAttribute]</td></tr><tr><td>state_or_province</td><td port="state_or_province">Optional[NameAttribute]</td></tr><tr><td>locality</td><td port="locality">Optional[NameAttribute]</td></tr><tr><td>organization</td><td port="organization">Optional[NameAttribute]</td></tr><tr><td>organizational_unit</td><td port="organizational_unit">Optional[NameAttribute]</td></tr></table>>, tooltip="certwrangler.models.Subject&#xA;&#xA;Cert subject.&#xA;"]; "certwrangler.models.Config":subjects:e -> "certwrangler.models.Subject":_root:w [arrowhead=crownone, arrowtail=nonenone]; "certwrangler.models.HttpConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>HttpConfig</b></td></tr><tr><td>host</td><td port="host">IPvAnyAddress</td></tr><tr><td>port</td><td port="port">int</td></tr><tr><td>server_name</td><td port="server_name">str</td></tr><tr><td>ssl_key_file</td><td port="ssl_key_file">Optional[Path]</td></tr><tr><td>ssl_key_password</td><td port="ssl_key_password">Optional[str]</td></tr><tr><td>ssl_cert_file</td><td port="ssl_cert_file">Optional[Path]</td></tr><tr><td>ssl_ca_certs_file</td><td port="ssl_ca_certs_file">Optional[Path]</td></tr></table>>, tooltip="certwrangler.models.HttpConfig&#xA;&#xA;Config for the HTTP subsystem.&#xA;"]; "certwrangler.models.DaemonConfig":http:e -> "certwrangler.models.HttpConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; "certwrangler.models.MetricsConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>MetricsConfig</b></td></tr><tr><td>mount</td><td port="mount">str</td></tr></table>>, tooltip="certwrangler.models.MetricsConfig&#xA;&#xA;Config for the metrics subsystem.&#xA;"]; "certwrangler.models.DaemonConfig":metrics:e -> "certwrangler.models.MetricsConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; "certwrangler.models.ReconcilerConfig" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>ReconcilerConfig</b></td></tr><tr><td>interval</td><td port="interval">int</td></tr></table>>, tooltip="certwrangler.models.ReconcilerConfig&#xA;&#xA;Config for the reconciler loop subsystem.&#xA;"]; "certwrangler.models.DaemonConfig":reconciler:e -> "certwrangler.models.ReconcilerConfig":_root:w [arrowhead=noneteetee, arrowtail=nonenone]; }

Show JSON schema
{
   "title": "Config",
   "description": "The root config object for the application.\n\nThis class is the root of the entire config tree of the application and is\nresponsible for loading any of the plugins specified by sub-members in\ntheir configuration as well as triggering any initialization hooks that\nmay be specified by the various plugins.",
   "type": "object",
   "properties": {
      "daemon": {
         "$ref": "#/$defs/DaemonConfig"
      },
      "state": {
         "$ref": "#/$defs/StateManager",
         "description": "Config for the state manager."
      },
      "accounts": {
         "additionalProperties": {
            "$ref": "#/$defs/Account"
         },
         "description": "Config for the accounts.",
         "title": "Accounts",
         "type": "object"
      },
      "certs": {
         "additionalProperties": {
            "$ref": "#/$defs/Cert"
         },
         "description": "Config for the certs.",
         "title": "Certs",
         "type": "object"
      },
      "solvers": {
         "additionalProperties": {
            "$ref": "#/$defs/Solver"
         },
         "description": "Config for the solvers.",
         "title": "Solvers",
         "type": "object"
      },
      "stores": {
         "additionalProperties": {
            "$ref": "#/$defs/Store"
         },
         "description": "Config for the stores.",
         "title": "Stores",
         "type": "object"
      },
      "subjects": {
         "additionalProperties": {
            "$ref": "#/$defs/Subject"
         },
         "description": "Config for the subjects.",
         "title": "Subjects",
         "type": "object"
      }
   },
   "$defs": {
      "Account": {
         "description": "Managed ACME account definition.",
         "properties": {
            "emails": {
               "description": "A list of email addresses for the account.",
               "items": {
                  "format": "email",
                  "type": "string"
               },
               "title": "Emails",
               "type": "array"
            },
            "server": {
               "default": "https://acme-v02.api.letsencrypt.org/directory",
               "description": "The URL of the ACME server.",
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "title": "Server",
               "type": "string"
            },
            "key_size": {
               "default": 2048,
               "description": "The desired size of the RSA key in bits",
               "title": "Key Size",
               "type": "integer"
            }
         },
         "required": [
            "emails"
         ],
         "title": "Account",
         "type": "object"
      },
      "Cert": {
         "description": "Managed cert definition.",
         "properties": {
            "common_name": {
               "description": "The common name for the cert.",
               "pattern": "^(?:(\\*\\.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$",
               "title": "Common Name",
               "type": "string"
            },
            "account_name": {
               "description": "The name of the configured ACME account the cert should be created under.",
               "title": "Account Name",
               "type": "string"
            },
            "store_names": {
               "description": "A list of the configured stores the cert should be published to.",
               "items": {
                  "type": "string"
               },
               "title": "Store Names",
               "type": "array"
            },
            "store_key": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional sub-key the cert should be published to in the store. Currently only supported by the vault store driver.",
               "title": "Store Key"
            },
            "subject_name": {
               "default": "default",
               "description": "The name of the configured subject the cert should be created with.",
               "title": "Subject Name",
               "type": "string"
            },
            "alt_names": {
               "description": "A list of alternative names for the cert.",
               "items": {
                  "pattern": "^(?:(\\*\\.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$",
                  "type": "string"
               },
               "title": "Alt Names",
               "type": "array"
            },
            "wait_timeout": {
               "default": "PT5M",
               "description": "Wait timeout for DNS operations.",
               "format": "duration",
               "title": "Wait Timeout",
               "type": "string"
            },
            "key_size": {
               "default": 2048,
               "description": "The desired size of the RSA key in bits.",
               "title": "Key Size",
               "type": "integer"
            },
            "follow_cnames": {
               "default": true,
               "description": "Whether to follow CNAMEs for DNS operations.",
               "title": "Follow Cnames",
               "type": "boolean"
            },
            "renewal_threshold": {
               "default": "P30D",
               "description": "How many days before a cert expires should it be renewed.",
               "format": "duration",
               "title": "Renewal Threshold",
               "type": "string"
            }
         },
         "required": [
            "common_name",
            "account_name",
            "store_names"
         ],
         "title": "Cert",
         "type": "object"
      },
      "DaemonConfig": {
         "description": "Config for the daemon.",
         "properties": {
            "reconciler": {
               "$ref": "#/$defs/ReconcilerConfig",
               "description": "Config for the reconciler."
            },
            "metrics": {
               "$ref": "#/$defs/MetricsConfig",
               "description": "Config for metrics."
            },
            "http": {
               "$ref": "#/$defs/HttpConfig",
               "description": "Config for the http server."
            },
            "watchdog_interval": {
               "default": 30,
               "description": "Watchdog interval in seconds. The watchdog periodically checks to see if any of the daemon threads have died.",
               "title": "Watchdog Interval",
               "type": "integer"
            }
         },
         "title": "DaemonConfig",
         "type": "object"
      },
      "HttpConfig": {
         "description": "Config for the HTTP subsystem.",
         "properties": {
            "host": {
               "default": "127.0.0.1",
               "description": "Address the HTTP server should bind to.",
               "format": "ipvanyaddress",
               "title": "Host",
               "type": "string"
            },
            "port": {
               "default": 6377,
               "description": "Port the HTTP server should listen on.",
               "title": "Port",
               "type": "integer"
            },
            "server_name": {
               "default": "certwrangler",
               "description": "Name of the HTTP server.",
               "title": "Server Name",
               "type": "string"
            },
            "ssl_key_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL key.",
               "title": "Ssl Key File"
            },
            "ssl_key_password": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL key password.",
               "title": "Ssl Key Password"
            },
            "ssl_cert_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL cert.",
               "title": "Ssl Cert File"
            },
            "ssl_ca_certs_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional SSL CA cert.",
               "title": "Ssl Ca Certs File"
            }
         },
         "title": "HttpConfig",
         "type": "object"
      },
      "MetricsConfig": {
         "description": "Config for the metrics subsystem.",
         "properties": {
            "mount": {
               "default": "/metrics",
               "description": "The mount-point for metrics.",
               "title": "Mount",
               "type": "string"
            }
         },
         "title": "MetricsConfig",
         "type": "object"
      },
      "ReconcilerConfig": {
         "description": "Config for the reconciler loop subsystem.",
         "properties": {
            "interval": {
               "default": 60,
               "description": "Reconciler interval in seconds.",
               "title": "Interval",
               "type": "integer"
            }
         },
         "title": "ReconcilerConfig",
         "type": "object"
      },
      "Solver": {
         "description": "Base class for ACME challenge solver drivers.",
         "properties": {
            "driver": {
               "description": "The name of the driver to use.",
               "title": "Driver",
               "type": "string"
            },
            "zones": {
               "description": "A list of DNS zones this solver should be used for.",
               "items": {
                  "pattern": "^(?:(\\*\\.|[a-zA-Z0-9])(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z0-9][A-Za-z0-9-_]{0,61}[A-Za-z]$",
                  "type": "string"
               },
               "title": "Zones",
               "type": "array"
            }
         },
         "required": [
            "driver",
            "zones"
         ],
         "title": "Solver",
         "type": "object"
      },
      "StateManager": {
         "description": "Base class for state manager drivers.",
         "properties": {
            "driver": {
               "description": "The name of the driver to use.",
               "title": "Driver",
               "type": "string"
            },
            "encryption_keys": {
               "description": "An optional list of encryption keys to use to encrypt the state. Only the top-most key will be used for encryption operations, the additional keys are only used to decrypt the state in the case that a new key was added. New keys can be generated using the ``certwrangler state generate-key`` command.",
               "items": {
                  "type": "string"
               },
               "title": "Encryption Keys",
               "type": "array"
            }
         },
         "required": [
            "driver"
         ],
         "title": "StateManager",
         "type": "object"
      },
      "Store": {
         "description": "Base class for store drivers.",
         "properties": {
            "driver": {
               "description": "The name of the driver to use.",
               "title": "Driver",
               "type": "string"
            }
         },
         "required": [
            "driver"
         ],
         "title": "Store",
         "type": "object"
      },
      "Subject": {
         "description": "Cert subject.",
         "properties": {
            "country": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The country name OID.",
               "title": "Country"
            },
            "state_or_province": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The state or province OID.",
               "title": "State Or Province"
            },
            "locality": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The locality OID.",
               "title": "Locality"
            },
            "organization": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The organization OID.",
               "title": "Organization"
            },
            "organizational_unit": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The organizational unit OID.",
               "title": "Organizational Unit"
            }
         },
         "title": "Subject",
         "type": "object"
      }
   },
   "required": [
      "state",
      "accounts",
      "certs",
      "solvers",
      "stores",
      "subjects"
   ]
}

Fields:
Validators:
field daemon: DaemonConfig [Optional]#

Config for the daemon.

Validated by:
field state_manager: StateManager [Required] (alias 'state')#

Config for the state manager.

Validated by:
field accounts: Dict[str, Account] [Required]#

Config for the accounts.

Validated by:
field certs: Dict[str, Cert] [Required]#

Config for the certs.

Validated by:
field solvers: Dict[str, Solver] [Required]#

Config for the solvers.

Validated by:
field stores: Dict[str, Store] [Required]#

Config for the stores.

Validated by:
field subjects: Dict[str, Subject] [Required]#

Config for the subjects.

Validated by:
validator __load_solver_plugins  »  solvers#

Dynamically load solver plugins based on their driver key.

Raises:

ValueError – Raised if the specified plugin can’t be loaded.

validator __load_state_manager_plugin  »  state_manager#

Dynamically load state_manager plugins based on their driver key.

Raises:

ValueError – Raised if the specified plugin can’t be loaded.

validator __load_store_plugins  »  stores#

Dynamically load store plugins based on their driver key.

Raises:

ValueError – Raised if the specified plugin can’t be loaded.

validator __pre_populate  »  all fields#

Pre-populate the config data with some defaults.

validator __post_populate  »  all fields#

Loops through the certs config and populates the reference to the root config object, which is needed to resolve foreign references.

Also loops through all the objects and populates their name field based on their key.

It then tries to resolve all references to account, subject, and stores on the cert object and will raise a ValueError if any references don’t resolve.

Raises:

ValueError – Raised if any references on sub-objects don’t resolve.

initialize() None[source]#

Initialize drivers and load state on stateful objects.