Skip to content
Cloudflare DNS provider for apnscp
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Api.php
LICENSE
Module.php
README.md
Record.php
Validator.php

README.md

Cloudflare DNS Provider

This is a drop-in provider for apnscp to enable DNS support for accounts that use Cloudflare. This provider is built into apnscp.

Configuring

EditDomain -c dns,provider=cloudflare -c dns,key='[key:abcdef012456789,email:foo@bar.com,proxy:false]' domain.com

Where the key is created within Cloudflare. See Where do I find my Cloudflare API key. email and key are mandatory variables.

  • proxy (true/false)- optionally set all records created to proxy through CF, i.e. be behind CF's IP address.

Setting as default

Cloudflaremay be configured as the default provider for all sites using the dns.default-provider Scope. When adding a site in Nexus or AddDomain the key will be replaced with "DEFAULT". This is substituted automatically on account creation.

cpcmd config_set dns.default-provider cloudflare
cpcmd config_set dns.default-provider-key '[key:abcdef0123456789,email:foo@bar.com,proxy:false]'

Note that it is not safe to set this value as a server-wide default in untrusted multiuser environments. A user with panel access can retrieve your key common_get_service_value dns key or even using Javascript in the panel, apnscp.cmd('common_get_service_value',['dns','key'], {async: false}).

Components

  • Module- overrides Dns_Module behavior
  • Validator- service validator, checks input with AddDomain/EditDomain helpers

Minimal module methods

All module methods can be overwritten. The following are the bare minimum that are overwritten for this DNS provider to work:

  • atomicUpdate() attempts a record modification, which must retain the original record if it fails
  • zoneAxfr() returns all DNS records
  • add_record() add a DNS record
  • remove_record() removes a DNS record
  • get_hosting_nameservers() returns nameservers for the DNS provider
  • add_zone_backend() creates DNS zone
  • remove_zone_backend() removes a DNS zone

See also: Creating a provider (hq.apnscp.com)

Contributing

Submit a PR and have fun!

You can’t perform that action at this time.