### Initialize AcmeClient with Directory and Key Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md Initializes the AcmeClient using the ACME Directory URL and the generated client key. The 'async with' statement ensures proper client setup and teardown. ```python async with AcmeClient(DIRECTORY, key) as client: pass ``` -------------------------------- ### Example RSA Private Key Content Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md This is an example of the content of a generated RSA private key file in PEM format. ```text -----BEGIN RSA PRIVATE KEY----- MIIJKgIBAAKCAgEA260eTqE2jOhIMW0b9AQn08KbGMbJJGPKfAhxBfa0MIQ7g8Tb 50tWbnK+NTdEAHZCfvfwpieVDgrwVNlPW5sL14xPltJ3zcQRydJTOFpV/WImtd6j ... xgJwpjMz0pm+9Exoe8VwmUc/gOSatoOC9DRg+hAIG7FciNUVfEeXq8ImmcDypeSe wjBT33F36F0O22Ij4EVyW+etjp5hbboaKjjoxq/EkMTwwnET6HzpkMOj7+x/VQ== -----END RSA PRIVATE KEY----- ``` -------------------------------- ### Example Certificate Output Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This is an example of the certificate file generated by the `acme_sign.py` script. The content will vary based on the ACME server and your domain. ```text -----BEGIN CERTIFICATE----- MIIFZTCCA00CFGMFCNLNSJLkcnJn4XJUGhtHh5JXMA0GCSqGSIb3DQEBCwUAMG8x CzAJBgNVBAYTAklUMQ8wDQYDVQQIDAZNaWxhbm8xDzANBgNVBAcMBk1pbGFubzES ... +pqFSNi9tsBy/T9zdVa4giUW68Zc3ezN+t+bvD/qNvAsH+c2ajR8utK0ehv+FpGH nOfZOASlIEp2te2A6bhHqUqh7LIydzg4YV7FSnfoabO2wDbnHGESZ63/FkyYJHxH SgFIpXon3mbTvYkSMk+ToN9Fr0n795G37W2pylEfXI28IJ4KpajiheA= -----END CERTIFICATE----- ``` -------------------------------- ### Install Gufo ACME Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/installation.md Use this command to install the Gufo ACME package. Ensure you have pip installed. ```bash pip install gufo_acme ``` -------------------------------- ### Check Gufo ACME Installation Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/installation.md Import the __version__ attribute from gufo.acme to verify the installation. This requires Python. ```python from gufo.acme import __version__ ``` -------------------------------- ### CSR Content Example Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_csr.md This is an example of the content of a generated Certificate Signing Request (CSR) in PEM format. ```text -----BEGIN CERTIFICATE REQUEST----- MIIEejCCAmICAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggIiMA0GCSqGSIb3 DQEBAQUAA4ICDwAwggIKAoICAQDbrR5OoTaM6EgxbRv0BCfTwpsYxskkY8p8CHEF ... QBsW0aHYdWwW+UJ5ApzSJh9hT87C7madmOJ9LqozPf9tDDuaYv4/Ips9EKEv9pcN rKniaHZSBUGfBBqLq2a25E0cn19wly5FARPR1lIaEmz2sTV09AdM3kyEFM4bug== -----END CERTIFICATE REQUEST----- ``` -------------------------------- ### Get command line arguments Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet demonstrates how to retrieve command-line arguments when the script is executed directly. It expects paths for client state, domain name, CSR, and the output certificate. ```python client_state_path = Path(sys.argv[1]) domain_name = sys.argv[2] csr_path = Path(sys.argv[3]) cert_path = Path(sys.argv[4]) ``` -------------------------------- ### Sign Certificate with HTTP-01 Challenge Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/index.md Signs a certificate for a domain using the HTTP-01 challenge. This example defines a custom client that handles writing challenge tokens to a specified directory and clearing them afterward. ```python 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) ``` -------------------------------- ### Get Key Authorization for Challenge Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This code uses the AcmeClient's get_key_authorization method to compute the necessary authorization string for the ACME challenge. This string is required for proving domain ownership. ```python v = self.get_key_authorization(challenge) ``` -------------------------------- ### Example ACME Account State JSON Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md This JSON represents the saved state of an ACME client after account registration. It includes the directory, the client's private key components, and the account URL. ```json { "directory": "https://acme-staging-v02.api.letsencrypt.org/directory", "key": { "n": "qhd84f-9Wb...5AQQ", "e": "AQAB", "d": "Sgan5MoDNC..Fk9cw", "p": "6BPvgdy6_i..gkdM", "q": "u5_dOHJqNh..bRRs", "dp": "C9PYRPoG3..MVf9k", "dq": "LQ5U14tSS..iRIGU", "qi": "5AcvleFCl..jBFsQ" }, "account_url": "https://acme-staging-v02.api.letsencrypt.org/acme/acct/1234567" } ``` -------------------------------- ### Upgrade Gufo ACME Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/installation.md Use this command to upgrade an existing Gufo ACME installation to the latest version. Pip is required. ```bash pip install --upgrade gufo_acme ``` -------------------------------- ### ACME Account Registration Script Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md This script registers a new ACME account. It requires an email address and a path to save the client state. Ensure you have the 'gufo_acme' library installed. ```python --8<-- "examples/acme_register.py" ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Build and serve the documentation locally using MkDocs, allowing you to preview changes before deployment. ```shell $ mkdocs serve ``` -------------------------------- ### Build Package Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Run this command to build the package's source distribution and wheel. ```shell $ python -m build --sdist --wheel ``` -------------------------------- ### Define main function Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md Define the `main` function that accepts a file path for storing the private key. ```Python def main(path: str): ``` -------------------------------- ### Read client state Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet demonstrates reading the client's state from a file in binary mode. ```python with open(client_state_path, "rb") as f: client_state = f.read() ``` -------------------------------- ### Write Challenge File for Validation Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This code constructs the full path for the challenge file using the challenge token and the configured challenge directory. It then writes the authorization key to this file in binary mode. ```python with open(os.path.join(CHALLENGE_DIR, challenge.token), "wb") as f: f.write(v) ``` -------------------------------- ### Instantiate AcmeClient from state Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet illustrates instantiating an AcmeClient subclass directly from saved state, which includes loading the private key, directory, and account information. ```python client = SignAcmeClient.from_state(client_state=client_state) ``` -------------------------------- ### Run Acme Certificate Signing Script Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md Execute the `acme_sign.py` script with the necessary arguments to generate a certificate. Ensure you have the required paths and domain name. ```shell python3 examples/acme_sign.py /tmp/acme.json mydomain.com /tmp/csr.pem /tmp/cert.pem ``` -------------------------------- ### Define main function for signing Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet defines the main asynchronous function to handle certificate signing. It accepts paths for client state, domain name, CSR, and the output certificate. ```python async def main( client_state_path: Path, domain_name: str, csr_path: Path, cert_path: Path, ): """Main function to sign a certificate. :param client_state_path: Path to the client's state file. :param domain_name: The domain name for which to sign the certificate. :param csr_path: Path to the Certificate Signing Request (CSR). :param cert_path: Path to write the resulting certificate. """ ``` -------------------------------- ### Write certificate to file Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet shows how to write the obtained certificate (in bytes) to the specified output file in binary write mode. ```python with open(cert_path, "wb") as f: f.write(certificate) ``` -------------------------------- ### Execute main function with CLI argument Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md If the script is run directly, retrieve the first command-line argument as the file path and execute the `main` function. ```Python if __name__ == "__main__": main(sys.argv[1]) ``` -------------------------------- ### Generate and save private key Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md Use `AcmeClient.get_domain_private_key()` to generate a private key and write it to the specified file in binary mode. ```Python private_key = AcmeClient.get_domain_private_key() with open(path, "wb") as f: f.write(private_key) ``` -------------------------------- ### Import AcmeClient Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md Import the `AcmeClient` class from the `gufo_acme.acme_client` module. ```Python from gufo_acme.acme_client import AcmeClient ``` -------------------------------- ### Create Nginx Authentication Password File Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Create the htpasswd file for Nginx authentication, replacing and with your chosen credentials. ```shell htpasswd -b /etc/nginx/auth/acme-ci ``` -------------------------------- ### Generate RSA Private Key Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md This snippet shows the complete process of generating an RSA private key and saving it to a specified file path. It imports the necessary `AcmeClient` and handles file writing in binary mode. ```Python import sys from gufo_acme.acme_client import AcmeClient def main(path: str): private_key = AcmeClient.get_domain_private_key() with open(path, "wb") as f: f.write(private_key) if __name__ == "__main__": main(sys.argv[1]) ``` -------------------------------- ### Save Client State Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md Saves the client key and account information to a file for future use. The state is stored in binary format. ```python with open(client_state, "wb") as f: f.write(client.state) ``` -------------------------------- ### Run Test Suite Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Execute the entire test suite using pytest. ```shell $ pytest -vv ``` -------------------------------- ### Full ACME Certificate Signing Script Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This Python script demonstrates the complete process of obtaining a signed certificate using the Gufo ACME client. It includes setting up the client, defining challenge fulfillment, and running the asynchronous process. ```python import asyncio import os import sys from gufo_acme.acme_client import AcmeClient from gufo_acme.challenges import AcmeChallenge class Http01Client(AcmeClient): async def fulfill_http_01(self, domain: str, challenge: AcmeChallenge) -> bool: # ... implementation details ... return True async def clear_http_01(self, domain: str, challenge: AcmeChallenge): # ... cleanup details ... pass async def main(): # ... main logic ... pass if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Sign Certificate using HTTP-01 Challenge Source: https://github.com/gufolabs/gufo_acme/blob/master/README.md Signs a certificate for a domain using the http-01 challenge. This requires a custom client that implements `fulfill_http_01` and `clear_http_01` to serve the challenge file. ```python 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) ``` -------------------------------- ### Create Directory for ACME Challenges Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Create and set permissions for the directory where ACME challenge files will be stored. ```shell mkdir /www/acme-ci chmod 700 /www/acme-ci chown nginx /www/acme-ci ``` -------------------------------- ### Generate HTML Coverage Report Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Create an HTML report of code coverage, which can be viewed in a web browser for detailed line-by-line analysis. ```shell $ coverage html ``` -------------------------------- ### Run Python Code Lints Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Check the code for linting errors using Ruff. ```shell $ ruff examples/ src/ tests/ ``` -------------------------------- ### Check Code Formatting Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Use this command to check if the code adheres to the Black formatting standards without making changes. ```shell $ black --check examples/ src/ tests/ ``` -------------------------------- ### Implement Custom ACME Client for HTTP-01 Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This code defines a custom client by subclassing AcmeClient to handle specific ACME challenge types. It overrides methods to provide custom logic for challenge fulfillment and cleanup. ```python class Http01Client(AcmeClient): async def fulfill_http_01(self, domain: str, challenge: AcmeChallenge) -> bool: # ... implementation details ... return True async def clear_http_01(self, domain: str, challenge: AcmeChallenge): # ... cleanup details ... pass ``` -------------------------------- ### Read CSR Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet shows how to read the Certificate Signing Request (CSR) from a file in binary mode. ```python with open(csr_path, "rb") as f: csr = f.read() ``` -------------------------------- ### Set Environment Variables for PowerDnsAcmeClient Tests Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Export the required environment variables for configuring the test suite to use PowerDNS for ACME challenges. Replace placeholders with your specific details. ```shell export CI_POWERDNS_TEST_DOMAIN=csr-proxy-test. export CI_POWERDNS_TEST_API_URL=https:// export CI_POWERDNS_TEST_API_KEY= ``` -------------------------------- ### Import asyncio for Asynchronous Operations Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This line imports the asyncio module, which is necessary for running asynchronous code in Python. It's essential for launching the ACME client. ```python import asyncio ``` -------------------------------- ### Generate Coverage Report Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Generate a text-based report of the code coverage after running tests with coverage.py. ```shell $ coverage report ``` -------------------------------- ### Import os Module for Path Operations Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This line imports the 'os' module, which provides functions for interacting with the operating system, such as path manipulation. It's needed for constructing file paths. ```python import os ``` -------------------------------- ### Set Environment Variables for DavAcmeClient Tests Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Export the necessary environment variables to configure the test suite for DavAcmeClient testing. Ensure placeholders are replaced with actual values. ```shell export CI_ACME_TEST_DOMAIN=acme-ci. export CI_DAV_TEST_DOMAIN=acme-ci. export CI_DAV_TEST_USER= export CI_DAV_TEST_PASSWORD= ``` -------------------------------- ### Create ACME Account and Save State Source: https://github.com/gufolabs/gufo_acme/blob/master/README.md Generates a new ACME account and saves its state to a file. Ensure you have a valid ACME directory URL and an email address. ```python 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) ``` -------------------------------- ### Run Pytest with Coverage Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Execute the test suite and collect code coverage data using the coverage.py tool. ```shell $ coverage run -m pytest -vv ``` -------------------------------- ### Run Python Code Static Checks Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Perform static type checking on the source code using mypy. ```shell $ mypy --strict src/ ``` -------------------------------- ### Import sys module Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_private_key.md Import the `sys` module to parse command-line arguments. In real-world applications, consider using `argparse` or similar libraries. ```Python import sys ``` -------------------------------- ### Fix Code Formatting Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Apply Black formatting to the specified directories to fix any formatting errors. ```shell $ black examples/ src/ tests/ ``` -------------------------------- ### Register New ACME Account Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md Calls the new_account() method to register a new ACME account with the server. After this call, the client is considered bound to the account. ```python await client.new_account(email) ``` -------------------------------- ### Override fulfill_http_01 Method Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This method is overridden to handle the http-01 challenge. It receives the domain and challenge details, and should return True if the challenge is successfully fulfilled. ```python async def fulfill_http_01(self, domain: str, challenge: AcmeChallenge) -> bool: # ... implementation details ... return True ``` -------------------------------- ### Signal Successful Challenge Fulfillment Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md Returning True from fulfill_http_01 indicates that the challenge has been successfully prepared and the ACME server can proceed with validation. ```python return True ``` -------------------------------- ### Define Main Asynchronous Function Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md Defines the main asynchronous function that orchestrates the ACME account registration process. It accepts the account email and a path for client state storage. ```python async def main(email: str, client_state: str): pass ``` -------------------------------- ### Generate Private Key for Domain Source: https://github.com/gufolabs/gufo_acme/blob/master/README.md Generates a private key in PEM format for a domain. This key is used for signing CSRs. ```python private_key = AcmeClient.get_domain_private_key() ``` -------------------------------- ### Create PowerDNS Zone Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Create a new zone in PowerDNS for testing the csr-proxy functionality. ```shell pdnsutil create-zone csr-proxy-test.gufolabs.com ``` -------------------------------- ### Nginx Configuration for DavAcmeClient Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md This is the server block configuration for Nginx to handle ACME challenges for DavAcmeClient testing. Ensure the domain and paths are correctly set. ```nginx server { listen 80; server_name acme-ci.; access_log /var/log/nginx/acme-ci..access.log timed_upstream; error_log /var/log/nginx/acme-ci..error.log; location /.well-known/acme-challenge/ { alias /www/acme-ci/; dav_methods PUT DELETE; limit_except GET { auth_basic "Staging area"; auth_basic_user_file "/etc/nginx/auth/acme-ci"; } } } ``` -------------------------------- ### Create PowerDNS Zone Record Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Create a glue record in your PowerDNS server's zone to point to the PowerDNS server itself for testing purposes. ```shell csr-proxy-test IN IS pdns. ``` -------------------------------- ### Generate CSR Python Script Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/get_csr.md This script generates a Certificate Signing Request (CSR) for a given domain using a provided private key and saves it to a specified path. It requires the domain name, private key path, and CSR path as command-line arguments. ```Python import sys from gufo_acme.client import AcmeClient def main( domain: str, private_key_path: str, csr_path: str, ): with open(private_key_path, "rb") as f: pk = f.read() csr = AcmeClient.get_domain_csr(domain, pk) with open(csr_path, "wb") as f: f.write(csr) if __name__ == "__main__": domain = sys.argv[1] private_key_path = sys.argv[2] csr_path = sys.argv[3] main(domain, private_key_path, csr_path) ``` -------------------------------- ### Nginx Configuration for ACME Challenges Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This Nginx configuration allows ACME http-01 challenges by mapping the /.well-known/acme-challenge/ path to a local directory. Ensure the server block matches your domain. ```nginx server { listen 80; server_name ; location /.well-known/acme-challenge/ { alias /www/acme/; } } ``` -------------------------------- ### Sign certificate Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet calls the AcmeClient.sign method to obtain a signed certificate in PEM format, abstracting the underlying protocol complexities. ```python certificate = await client.sign(domain_name=domain_name, csr=csr) ``` -------------------------------- ### Generate Certificate Signing Request (CSR) Source: https://github.com/gufolabs/gufo_acme/blob/master/README.md Generates a CSR for a given domain and private key. The CSR is used to request a certificate from a CA. ```python csr = AcmeClient.get_domain_csr(domain, private_key) ``` -------------------------------- ### Remove temporary file Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This snippet shows how to remove a temporary file created during the HTTP-01 challenge. ```python os.remove(path=path) ``` -------------------------------- ### Test Nginx ACME Challenge Endpoint Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Verify the Nginx ACME challenge endpoint by attempting to PUT a file. This checks if the server is correctly configured to accept challenges. ```shell curl -X PUT -d "777" --user ":" http://acme-ci./.well-known/acme-challenge/777 ``` -------------------------------- ### Import sys Module for CLI Arguments Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md Imports the 'sys' module to access command-line arguments for email and state path. In production, consider using 'argparse' for more robust argument handling. ```python import sys if __name__ == "__main__": email = sys.argv[1] client_state = sys.argv[2] asyncio.run(main(email, client_state)) ``` -------------------------------- ### Generate Nginx Authentication Password Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Generate a random password for Nginx basic authentication. This password will be used in the htpasswd file. ```shell openssl rand 21 | base64 ``` -------------------------------- ### Reload Nginx Service Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/dev/testing.md Reload the Nginx service to apply the new configuration changes. ```shell service nginx reload ``` -------------------------------- ### Define ACME Directory URL Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This constant defines the URL for the ACME server's directory, which is essential for discovering ACME server endpoints. For production, use the official Let's Encrypt production directory. ```python DIRECTORY = "https://acme-staging-v02.api.letsencrypt.org/directory" ``` -------------------------------- ### Generate ACME Client Key Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_register.md Generates a new secret key required for signing ACME communications. This key will be associated with the ACME account. ```python key = AcmeClient.get_key() ``` -------------------------------- ### Import AcmeChallenge Type Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This line imports the AcmeChallenge type, which is used to represent ACME challenge objects. It's part of the Gufo ACME library's challenge handling mechanism. ```python from gufo_acme.challenges import AcmeChallenge ``` -------------------------------- ### Uninstall Gufo ACME Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/installation.md Use this command to remove the Gufo ACME package from your system. Pip is required. ```bash pip uninstall gufo_acme ``` -------------------------------- ### Override clear_http_01 for Cleanup Source: https://github.com/gufolabs/gufo_acme/blob/master/docs/examples/acme_sign.md This method is overridden to perform cleanup actions after the ACME validation process is complete. It allows for removing temporary files or resetting states. ```python async def clear_http_01(self, domain: str, challenge: AcmeChallenge): # ... cleanup details ... pass ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.