certbot_dns_cloudflare.dns_cloudflare

DNS Authenticator for Cloudflare.

class certbot_dns_cloudflare.dns_cloudflare.Authenticator(*args, **kwargs)[source]

Bases: certbot.plugins.dns_common.DNSAuthenticator

DNS Authenticator for Cloudflare

This Authenticator uses the Cloudflare API to fulfill a dns-01 challenge.

class certbot_dns_cloudflare.dns_cloudflare._CloudflareClient(email, api_key)[source]

Bases: builtins.object

Encapsulates all communication with the Cloudflare API.

add_txt_record(domain, record_name, record_content, record_ttl)[source]

Add a TXT record using the supplied information.

Parameters:
  • domain (str) – The domain to use to look up the Cloudflare zone.
  • record_name (str) – The record name (typically beginning with ‘_acme-challenge.’).
  • record_content (str) – The record content (typically the challenge validation).
  • record_ttl (int) – The record TTL (number of seconds that the record may be cached).
Raises certbot.errors.PluginError:
 

if an error occurs communicating with the Cloudflare API

del_txt_record(domain, record_name, record_content)[source]

Delete a TXT record using the supplied information.

Note that both the record’s name and content are used to ensure that similar records created concurrently (e.g., due to concurrent invocations of this plugin) are not deleted.

Failures are logged, but not raised.

Parameters:
  • domain (str) – The domain to use to look up the Cloudflare zone.
  • record_name (str) – The record name (typically beginning with ‘_acme-challenge.’).
  • record_content (str) – The record content (typically the challenge validation).
_find_zone_id(domain)[source]

Find the zone_id for a given domain.

Parameters:domain (str) – The domain for which to find the zone_id.
Returns:The zone_id, if found.
Return type:str
Raises certbot.errors.PluginError:
 if no zone_id is found.
_find_txt_record_id(zone_id, record_name, record_content)[source]

Find the record_id for a TXT record with the given name and content.

Parameters:
  • zone_id (str) – The zone_id which contains the record.
  • record_name (str) – The record name (typically beginning with ‘_acme-challenge.’).
  • record_content (str) – The record content (typically the challenge validation).
Returns:

The record_id, if found.

Return type:

str