powerdnsapi 0.3

powerdnsapi is an XMLRPC server for communicating with a database backend for PowerDNS.

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
GPL (GNU General Public License) 
USER RATING:
2.6/5 16
DEVELOPED BY:
Lasse Karstensen
HOMEPAGE:
powerdnsapi.sourceforge.net
CATEGORY:
ROOT \ Internet \ DNS
powerdnsapi is an XMLRPC server for communicating with a database backend for PowerDNS.

powerdnsapi is written in Python and uses xmlrpclib. It is run as CGI. powerdnsapi is not affiliated or in any way a part of PowerDNS. It is written by Lasse Karstensen.

How to install

These are very rough at the moment.

* untar the tar.gz file. (problably done this already)
* copy powerdnsapi.conf.sample into powerdnsapi.conf, and edit it
to your tastes.
* add the comment field on your records table. ALTER TABLE records ADD comment text;
* make sure your web server is able to run the server. "Addhandler .py cgi-script" in .htaccess
may work. A symlink from powerdnsapi.py to powerdnsapi.cgi may work. (tbd)

Verify installation

Probably easiest with a python shell. Start it with 'python'.

import xmlrpclib
url = "http://your-server-url/powerdnsapi.cgi"
rpc = xmlrpclib.ServerProxy(url)
print rpc.system.listMethods()

This should print something like: (reformatted here)
['domain_get_records',
'domain_list',
'domain_raise_serial',
'get_domain_from_id',
'get_id_from_domain',
'record_add',
'record_delete',
'record_update',
'system.listMethods',
'system.methodHelp',
'system.methodSignature']

rpc.domain_list() is also rather safe, it prints all available zones.

Example:

Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib, pprint
>>> url = 'http://your-webserver/'
>>> rpc = xmlrpclib.ServerProxy(url)
>>> pprint.pprint(rpc.system.listMethods())
['domain_get_records',
'domain_list',
'domain_raise_serial',
'get_domain_from_id',
'get_id_from_domain',
'record_add',
'record_delete',
'record_update',
'system.listMethods',
'system.methodHelp',
'system.methodSignature']
>>>

>>> pprint.pprint( rpc.domain_list().items()[0] )
('1.2.3.in-addr.arpa',
{'domainid': 202, 'notified_serial': '2007022101', 'serial': '2007022101'})
>>>

>>> print len( rpc.domain_get_records(202))
247

>>> pprint.pprint( rpc.domain_get_records(202)[3])
{'comment': '',
'content': 'some-webserver.hostname.com',
'domain': 'hostname.com',
'domain_id': '202',
'id': '25001',
'name': 'www',
'prio': '0',
'ttl': '86400',
'type': 'CNAME'}
>>>
>>> rec = {'content': 'some-webserver.hostname.com', 'name': 'www-dev', 'type': 'CNAME', 'ttl': 3600, 'domain_id': 202 }
>>> rpc.add_record(rec)
>>> print len( rpc.domain_get_records(202))
248

What's New in This Release:

generate_list(), _update, _delete, _add. Expands a GENERATE record (from dtext/other) into n records in the database.
add and remove (master) domains.

Last updated on February 27th, 2008

#XMLRPC server #database backend #PowerDNS API #XMLRPC #server #database #backend

Add your review!

SUBMIT