Wiki

Add Slave zones with PowerDNS and pgSQL

With this script you can add Slave DNS zones at ClouDNS with PowerDNS Master server and pgSQL database. You can download it from here.

Configuration

AUTH_ID should be your API user ID AUTH_PASS should be the password of your API user.

MASTER_IP is the IP address of your PowerDNS Master serer.

MASTER_IP2 is the second IP address of your PowerDNS server (optional).

PDNS_PGSQL_HOST is the IP address of your pgSQL server.

PDNS_PGSQL_USER is your pgSQL database username.

PDNS_PGSQL_PASS is your pgSQL database password.

PDNS_PGSQL_DB is your database name in pgSQL.

PDNS_PGSQL_PORT is the listening port of your pgSQL server port.

TMPFILE is the temp file which will contain a list of zones which are already added or checked with the HTTP API.

// Auth ID and Password

define("AUTH_ID", 0);
define("AUTH_PASS", "xxx");

// IP address of the master server (primary server)
define("MASTER_IP", "xxx.xxx.xxx.xxx");

// Second IP address for master server (it may be IPv6 or IPv4 address)
//define("MASTER_IP2", "xxx.xxx.xxx.xxx");

// PowerDNS pgsql configuration
define("PDNS_PGSQL_HOST", "xxx.xxx.xxx.xxx");
define("PDNS_PGSQL_USER", "xxx");
define("PDNS_PGSQL_PASS", "xxx");
define("PDNS_PGSQL_DB", "xxx");
define("PDNS_PGSQL_PORT", "5432");

// this file will contain a list of zones, which are already added or checked with the HTTP API
define("TMPFILE", "/tmp/cloudns_checked_zones.txt");

Usage

When you are ready with your configuration, you can run the script with the following command:

php powerdns-pgsql-slave-zones-add.php

Output

The script will output a list with Slave DNS zones craeted at ClouDNS.

Possible problems

If your API user ID or Password are incorrect, you will get an error message.

If the pgSQL details and credentials are incorrect, you will get an error message.

Cron job

You can add this script to be executed each first day from the month. Example:

0 0 1 * * /usr/bin/php /path/to/php powerdns-pgsql-slave-zones-add.php

    

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more