$ show diafygi/acme-tiny
Acme-tiny is a compact Python script that automates the issuance and renewal of TLS certificates from Let's Encrypt using the ACME protocol. Designed to be auditable and under 200 lines, it requires only Python and OpenSSL as dependencies. The script functions as a CLI tool that takes an account key, certificate signing request (CSR), and ACME challenge directory as inputs, then performs the full ACME flow: account registration, order creation, HTTP-01 challenge completion, certificate finalization, and download. The architecture is a monolithic script with well-structured helper functions for subprocess execution, HTTP requests with JWS signing, and polling logic. Key operations include parsing account keys to extract public keys and compute JWK thumbprints, extracting domains from CSRs, interacting with ACME server endpoints, and handling challenge file validation. The project emphasizes security by limiting functionality to core ACME operations and encouraging users to review the source code given its access to sensitive account keys. The repository shows active maintenance with recent commits, comprehensive test suites (including integration tests with Pebble and Let's Encrypt staging), and CI workflows covering multiple Python versions. It has no external Python dependencies beyond the standard library, relying solely on the OpenSSL command-line tool for cryptographic operations. This minimal dependency footprint contributes to low technical drift and high environmental compatibility.
The LLM identified 2 files worth highlighting for reuse:
The _cmd function provides a robust wrapper for subprocess.Popen that captures stdout/stderr, checks return codes, and raises informative IOErrors on failure. It isolates external command execution complexity (specifically OpenSSL) with consistent error handling, making it reusable in any project needing to invoke CLI tools.
The _poll_until_not function implements a generic polling mechanism with timeout (1 hour) and exponential backoff (0s then 2s intervals). It repeatedly checks a URL until response status exits pending states, encapsulating a common pattern for waiting on asynchronous operations like ACME order validation.