certdeploy.server package

Subpackages

Submodules

certdeploy.server.renew module

Functions for renewing certs with certbot.

certdeploy.server.renew.renew_certs(config: ServerConfig)[source]

Run the command to renew certificates.

Parameters:

config – The CertDeploy server config.

Raises:

CertDeployError – If the renewal command returns non-zero and config.fail_fast is True

certdeploy.server.server module

CertDeploy Server daemon and SFTP parts.

class certdeploy.server.server.PushWorker(server: Server, client: ClientConnection, config: ServerConfig)[source]

Bases: Thread

A worker thread to push lineages to a single client.

property client_hash: str

The hash of the associated client.

property has_error: bool

Return True if there has been an exception in the thread.

join(timeout: float | None = None)[source]

Join the worker thread and raise an exception.

Parameters:

timeout – The number of seconds to wait for the thread to end before raising a TimeoutError. Defaults to None.

Raises:

An exception if one was encountered and fail_fast is enabled.

run()[source]

Run the main loop.

Note

This is called automatically by self.start.

class certdeploy.server.server.Queue(server: ServerConfig, mode: str = 'r')[source]

Bases: object

A queue of push jobs.

append(client_hash: str, lineage: str)[source]

Append a job (lineage) to the queue for a given client.

Parameters:
  • client_hash – The value of ClientConnection.hash for the client that needs the update.

  • lineage – The lineage path that needs syncing to the client.

property clients: list[str]

The client hashes in the queue.

count(client_hash: str) int[source]

Return the number of lineages left to push for the given client.

get(client_hash: str, default: Any = None) list[str][source]

Get a list of lineages that need to be pushed to a client.

Parameters:
  • client_hash – The value of ClientConnection.hash for the client being requested.

  • default – This will be returned when no client matching client_hash is found. Defaults to None.

Returns:

A list of lineages that need to be pushed for the given client.

load()[source]

Load the queue from the path configured with queue_dir.

This won’t load a file that is open for writing.

lock: Semaphore = <threading.Semaphore at 0x75d11c219710: value=1>

A lock for writing to the queue file.

next(client_hash: str) str[source]

Return the next lineage to push for the given client.

class certdeploy.server.server.Server(config: ServerConfig)[source]

Bases: object

Accept new sync requests and push new certs to clients.

serve_forever(one_shot: bool = False)[source]

Push queued lineages to clients.

Parameters:

one_shot – Push lineages in the queue and exit when the queue has been fully processed. Defaults to False.

sync(lineage: PathLike, domains: list[str])[source]

Synchronize clients that need updates based on domains.

Parameters:
  • lineage – The full path of a lineage.

  • domains – A list of domain names to use to find clients to push to.

Module contents