Virtualmin Cloudflare DNS API

I'm thinking of integrating cloudflare into virtualmin.

Using cloudflare instead of bind have some benefits : - Saves memory - Increases performance -Increases security

The main part is writing the DNS module then a little bit modifications to apache configuration.



Sure, that could be done .. however, you would need to write a Virtualmin plugin that is used instead of the regular DNS feature for your domains. Check out the PowerDNS plugin for an example of how this might be done.

Mostafa's picture
Submitted by Mostafa on Wed, 11/14/2012 - 13:15

In fact this is a feature request ! Unfortunately I'm not a programmer.

tpnsolutions's picture
Submitted by tpnsolutions on Wed, 11/14/2012 - 20:38


Our company is a CloudFlare Certified Partner, and the way we do things is we use an in-house scripting system which creates the hosting, dns, and CloudFlare settings through a scheduled task on the backend of our cluster.

Basically here's what we do...

  1. Through a web form, we enter details about the hosting account, including user/pass, domain, and features we're offering to the client.

  2. Our scheduled system then detects a pending task then does the following:

  • Our DNS cluster create secondary DNS zones.

  • Our Hosting cluster creates the hosting account and master DNS zone.

  • Our mySQL cluster creates mySQL account (if selected)

  • CloudFlare API is triggered creating records on their network.

All these tasks take an average of 1 - 2 minutes to complete, and is fast and efficient for our needs.

Our whole design is highly efficient, based on Virtualmin and firewalled to ensure our master dns servers can only communicate with our secondaries (which handle the resolution for our domains). We're also able to quickly transition domains between servers, and later will offer automatic replication between nodes for greater redundancy.


if this is going to be implemented, it should probably based on the PowerDNS module, i.e. generalized - there are tons of different DNS services available, many of them free/mutual - so it would be a good idea to come up with a generic framework for different DNS services, end-users could then contribute implementations for individual services, such as buddyDNS for example.


Would be great to see a Cloudflare plugin so that the hosts are automatically enabled on Cloudflare.

I would suggest not to implement one particular back-end (unless you are offering to sponsor this in some way), but instead focus on extending the infrastructure accordingly, to make it better extensible:

In the apache/nginx discussion it was emphasized that there's a generic interface utilized that each server needs to implement - i.e. a common subset of features would be found in the top-level interface module ("class"), while custom/specific functionality would be added to the back-end (e.g. apache or nginx) - but shared/common functionality is added in a generic fashion so that other tools can more easily work with an abstracted concept of a "webserver", no matter its concrete manifestation.

I think this idea would be worth exploring here due to the high number of different DNS web services - basically, virtualmin would only need to provide the equivalent of an "abstract base class" (in coding terms, i.e. an abstract module that exposes services), while back-ends would need to implement this particular base class and make the API work with different services.

Given that there are many Unix services that have common/overlapping functionality (mail, web, db, dns etc), it would seem like a good idea to provide a generic abstraction layer that can deal with the more common tasks, without necessarily having to know if the server is apache/nginx or if DNS is hosted locally or implemented via an webservice API like cloudflare/buddyDNS etc