Skip to main content

Python Automatic Certificate Management Environment (ACME) client

Project description

Gufo ACME

Gufo ACME is a Python asyncio client for the ACME protocol.

PyPi version Downloads Python Versions License Build Sponsors Ruff

Documentation: https://docs.gufolabs.com/gufo_acme/

Source Code: https://github.com/gufolabs/gufo_acme/


The Automatic Certificate Management Environment (ACME) protocol defines a method for automated certificate signing, now widely used by services such as Let's Encrypt. Gufo ACME is a Python asyncio ACME client library that simplifies the protocol complexity with a straightforward and robust API.

Gufo ACME contains various clients which can be applied to your tasks:

  • AcmeClient - base client to implement any fulfillment functionality by creating subclasses.
  • DavAcmeClient - http-01 fulfillment using WebDAV methods.
  • PowerDnsAcmeClient - dns-01 PowerDNS fulfillment.
  • WebAcmeClient - http-01 static file fulfillment.

Supported Certificate Authorities

Examples

Account Creation

Create an account and store state to the file.

client_key = AcmeClient.get_key()
async with AcmeClient(DIRECTORY, key=client_key) as client:
    await client.new_account(email)
    state = client.get_state()
with open(client_state_path, "wb") as fp:
    fp.write(state)

Private Key Generation

To generate a private key in PEM format.

private_key = AcmeClient.get_domain_private_key()

Generate CSR

To generate a certificate signing request.

csr = AcmeClient.get_domain_csr(domain, private_key)

Sign Certificate

Sign the certificate using http-01 challenge:

CHALLENGE_DIR = "/www/acme/"


class SignAcmeClient(AcmeClient):
    async def fulfill_http_01(
        self, domain: str, challenge: AcmeChallenge
    ) -> bool:
        v = self.get_key_authorization(challenge)
        with open(os.path.join(CHALLENGE_DIR, challenge.token), "wb") as fp:
            fp.write(v)
        return True

    async def clear_http_01(
        self: AcmeClient, domain: str, challenge: AcmeChallenge
    ) -> None:
        os.unlink(os.path.join(CHALLENGE_DIR, challenge.token))

    ...
async with SignAcmeClient.from_state(state) as client:
    cert = await client.sign(domain, csr)

Features

  • Pure-Python implementation.
  • Asynchronous.
  • Fully typed.
  • Clean API.
  • Built with security in mind.
  • Robust well-tested code.
  • Batteries included.
  • 99%+ test coverage.

On Gufo Stack

This product is a part of Gufo Stack - the collaborative effort led by Gufo Labs. Our goal is to create a robust and flexible set of tools to create network management software and automate routine administration tasks.

To do this, we extract the key technologies that have proven themselves in the NOC and bring them as separate packages. Then we work on API, performance tuning, documentation, and testing. The NOC uses the final result as the external dependencies.

Gufo Stack makes the NOC better, and this is our primary task. But other products can benefit from Gufo Stack too. So we believe that our effort will make the other network management products better.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gufo_acme-0.6.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gufo_acme-0.6.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file gufo_acme-0.6.0.tar.gz.

File metadata

  • Download URL: gufo_acme-0.6.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gufo_acme-0.6.0.tar.gz
Algorithm Hash digest
SHA256 19a9c6eb96682e16412b2806b074afd908a347f2f159e64747a0b8971d2ae2e4
MD5 5a4ce921a6a1f0ffed8eb5bb85392445
BLAKE2b-256 36f11141d243d04b9d567772e64129188f7b990fd2952414ae5514aa19461790

See more details on using hashes here.

Provenance

The following attestation bundles were made for gufo_acme-0.6.0.tar.gz:

Publisher: package.yml on gufolabs/gufo_acme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gufo_acme-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: gufo_acme-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gufo_acme-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 367403f1486ba4dbfce7e618f868d551ffd192eb8c43dd3c0c0c3132e25b1df3
MD5 964e752c79a8f0079cdc15a911a79b8d
BLAKE2b-256 34971872bf1b8781975b733b12b5f4d4c9fe42cdea2cb48dc3d0961e273addd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for gufo_acme-0.6.0-py3-none-any.whl:

Publisher: package.yml on gufolabs/gufo_acme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page