Skip to main content

auto-acme

Automatically generate and renew HTTPS certificates using the ACME protocol (Let's Encrypt).

auto-acme is a Python package that simplifies the process of obtaining and renewing HTTPS certificates for your web applications using the ACME protocol. It integrates seamlessly with popular web frameworks like Flask, Django, and FastAPI, and can be used with any Python web server that supports SSL contexts.

Features

  • Automatic Certificate Management: Obtain and renew certificates automatically.
  • Let's Encrypt Support: Works with Let's Encrypt and other ACME-compatible CAs.
  • Framework Agnostic: Use with Flask, Django, FastAPI, or any WSGI/ASGI server.
  • Simple Configuration: Minimal setup required.
  • Certificate Storage: Certificates are stored locally and reused until renewal is needed.

Installation

Install auto-acme using pip:

pip install auto-acme

Or from source:

git clone https://github.com/yourusername/auto-acme.git
cd auto-acme
pip install .

Usage

Basic Example with Flask

from flask import Flask
import auto_acme

app = Flask(__name__)

@app.route('/')
def home():
    return "Automatic HTTPS-Certificate with auto-acme."

if __name__ == '__main__':
    acme_context = auto_acme.AcmeContext(
        certificate_path="~/.acme_certs",
        acme_url="https://acme-v02.api.letsencrypt.org/directory",
        hostname="example.com",
        agree_tos=True,
    )
    app.run(host="0.0.0.0", port=443, ssl_context=acme_context)

With Django

from django.core.servers.basehttp import WSGIServer
import auto_acme

def run_django_with_acme():
    acme_context = auto_acme.AcmeContext(
        certificate_path="~/.acme_certs",
        acme_url="https://acme-v02.api.letsencrypt.org/directory",
        hostname="example.com",
        agree_tos=True,
    )
    server = WSGIServer(("0.0.0.0", 443), WSGIHandler(), ssl_context=acme_context)
    server.serve_forever()

if __name__ == "__main__":
    run_django_with_acme()

Configuration

Required Parameters

Parameter Description
certificate_path Directory where certificates and private keys will be stored.
acme_url ACME server URL (e.g., Let's Encrypt staging or production).
hostname Domain name for which the certificate will be issued.

Optional Parameters

Parameter Description Default Value
contact List of emails for ACME account registration. None
agree_tos Automatically agree to the ACME server's terms of service. False

How It Works

Initialization: When AcmeContext is created, it checks for existing certificates. Certificate Request: If no valid certificate is found, it registers with the ACME server and requests a new certificate. Challenge Handling: Automatically responds to ACME challenges (TLS-ALPN-01). Certificate Storage: Stores the certificate and private key in the specified directory. Renewal: Automatically renews certificates before they expire.

Contributing

Contributions are welcome! Please follow these steps:

  • Fork the repository.
  • Create a new branch for your feature or bugfix.
  • Write tests for your changes.
  • Submit a pull request.

License

auto-acme is licensed under the MIT License. See LICENSE for details.

Support

For questions, issues, or feature requests, please open an issue on the GitHub repository.

Metadata

Release files for auto-acme 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auto-acme 1.1.0
File Size Uploaded Provenance Actions
auto_acme-1.1.0.tar.gz 8.2 kB Without provenance Details for auto_acme-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for auto-acme 1.1.0
File Interpreter ABI Platform Actions
auto_acme-1.1.0-py3-none-any.whl Python 3 none any Details for auto_acme-1.1.0-py3-none-any.whl

Total release size: 16.5 kB

Release files / auto_acme-1.1.0.tar.gz

Download URL auto_acme-1.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2270fea029717dc3bd88f8cbea636b848cc8cc793e6666335342e257e8c47830
BLAKE2b-256 checksum
How to use checksums
d0583aa0dd9b500d4936fddb3ec366c5bf7d608ff69523b66c2d8ffa633e8859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / auto_acme-1.1.0-py3-none-any.whl

Download URL auto_acme-1.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
806be65aac286f72ef84d8b25d20167828b2d2d63b7679f6f34491829a25bf3a
BLAKE2b-256 checksum
How to use checksums
8a840465e84c7428b820e7263504b0a67333381204dbbf95f73b7c479b2f48f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for auto-acme 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page