Cloudflare DNS Authenticator

Implement an Authenticator which can fulfill a dns-01 challenge using the
Cloudflare API. Applicable only for domains using Cloudflare for DNS.

Testing Done:
 * `tox -e py27`
 * `tox -e lint`
 * Manual testing:
    * Used `certbot certonly --dns-cloudflare -d`, specifying a
      credentials file as a command line argument. Verified that a
      certificate was successfully obtained without user interaction.
    * Used `certbot certonly --dns-cloudflare -d`, without specifying a
      credentials file as a command line argument. Verified that the user
      was prompted and that a certificate was successfully obtained.
    * Used `certbot certonly -d`. Verified that the user was prompted for
      a credentials file after selecting cloudflare interactively and
      that a certificate was successfully obtained.
    * Used `certbot renew --force-renewal`. Verified that certificates
      were renewed without user interaction.
 * Negative testing:
    * Path to non-existent credentials file.
    * Credentials file with unsafe permissions (644).
    * Credentials file missing e-mail address.
    * Credentials file with blank API key.
    * Credentials file with incorrect e-mail address.
    * Credentials file with malformed API key.
    * Credentials file with invalid API key.
    * Domain name not registered to Cloudflare account.
This commit is contained in:
Zach Shepherd
2017-05-10 15:26:51 -07:00
parent 6670f828ef
commit db6defe614
26 changed files with 1562 additions and 8 deletions
+12 -6
View File
@@ -28,6 +28,12 @@ plugin_commands =
plugin_install_args = -e certbot-apache -e certbot-nginx
plugin_paths = certbot-apache/certbot_apache certbot-nginx/certbot_nginx
dns_plugin_commands =
pip install -e certbot-dns-cloudflare
nosetests -v certbot_dns_cloudflare --processes=-1
dns_plugin_install_args = -e certbot-dns-cloudflare
dns_plugin_paths = certbot-dns-cloudflare/certbot_dns_cloudflare
compatibility_install_args = -e certbot-compatibility-test
compatibility_paths = certbot-compatibility-test/certbot_compatibility_test
@@ -63,12 +69,12 @@ deps =
[testenv:py27_install]
basepython = python2.7
commands =
pip install {[base]core_install_args} {[base]plugin_install_args} {[base]other_install_args}
pip install {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]other_install_args}
[testenv:cover]
basepython = python2.7
commands =
pip install {[base]core_install_args} {[base]plugin_install_args} {[base]other_install_args}
pip install {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]other_install_args}
./tox.cover.sh
[testenv:lint]
@@ -78,15 +84,15 @@ basepython = python2.7
# duplicate code checking; if one of the commands fails, others will
# continue, but tox return code will reflect previous error
commands =
pip install -q {[base]core_install_args} {[base]plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args}
pylint --reports=n --rcfile=.pylintrc {[base]core_paths} {[base]plugin_paths} {[base]compatibility_paths} {[base]other_paths}
pip install -q {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args}
pylint --reports=n --rcfile=.pylintrc {[base]core_paths} {[base]plugin_paths} {[base]dns_plugin_paths} {[base]compatibility_paths} {[base]other_paths}
[testenv:mypy]
basepython = python3.4
commands =
pip install mypy
pip install -q {[base]core_install_args} {[base]plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args}
mypy --py2 --ignore-missing-imports {[base]core_paths} {[base]plugin_paths} {[base]compatibility_paths} {[base]other_paths}
pip install -q {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args}
mypy --py2 --ignore-missing-imports {[base]core_paths} {[base]plugin_paths} {[base]dns_plugin_paths} {[base]compatibility_paths} {[base]other_paths}
[testenv:apacheconftest]
#basepython = python2.7