Current time: 12-25-2024, 11:32 PM Hello There, Guest! (LoginRegister)


Post Reply 
[HowTo] powerdns and isp-control
Author Message
uwe Offline
Junior Member
*

Posts: 68
Joined: Feb 2008
Reputation: 0
Post: #1
[HowTo] powerdns and isp-control
Hello,

I've been trying to get ispcp and powerdns to work togather, here is what i do to get it, its not really generic and im using it in testing environment.

Install pdns-server and pdns-backend-mysql (im using debian)

create tables domains, records and supermasters in ispcp database following this doc http://doc.powerdns.com/generic-mypgsql-backends.html

configure pdns to use mysql-backend and set the username and password and database name ..etc, i also used bind backend to serve old domains i didnt have imported into pdns database, this can be also achieved by using bind2mysql script but i chose not to since im using domain ID from ispcp and not relaying on pdns to set the domain ID.

then i modify ispcp-dmn-mngr (/var/www/ispcp/engine)

in sub dmn_add_named_cfg_data
around the store_file function and before the return add:
PHP Code:
doSQL("INSERT INTO domains values (@$dmn_data[0],'$dmn_name',NULL,NULL,'MASTER',NULL,NULL)"); 

in sub dmn_del_named_cfg_data , around where we save a working copy
PHP Code:
doSQL("DELETE FROM domains where id = @$dmn_data[0]"); 
in sub dmn_add_named_db_data, around where we store generated data,(store_file) before the returns
PHP Code:
    doSQL("INSERT INTO records values (NULL,@$dmn_data[0],'$dmn_name','SOA','ns1.$dmn_name. postmaster.$dmn_name$time2 4800 3600 432000 21600',21600,0,1206429418)");
    
doSQL("INSERT INTO records values ('NULL','@$dmn_data[0]','', 'NS','ns1.$dmn_name',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$dmn_data[0]','', 'NS','ns2.$dmn_name',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$dmn_data[0]','', 'MX','mail.$dmn_name',21600,10,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$dmn_data[0]','"$dmn_name "', 'A','" $dmn_ip "',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$dmn_data[0]','www', 'A','" $dmn_ip "',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$dmn_data[0]','$dmn_name.', 'TXT','\"v=spf1 a mx ip4:$dmn_ip ~all\"',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'localhost', 'A','127.0.0.1',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'mail', 'A','$base_svr_ip',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'ns1', 'A','$base_svr_ip',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'ns2', 'A','$sec_dns_ip',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'imap', 'CNAME','mail',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'pop', 'CNAME','mail',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'pop3', 'CNAME','mail',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'smtp', 'CNAME','mail',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL',@$dmn_data[0],'ftp', 'CNAME','www',21600,0,1206426697 )") ; 

and in dmn_del_named_db_data, before the returns, near del_file do:

PHP Code:
doSQL("DELETE FROM records where domain_id = @$dmn_data[0]"); 

and now we modify dmn-sub-mngr, here we modify two functions:

sub sub_add_named_cfg_data, near the store_file call, and before the return:

PHP Code:
doSQL("INSERT INTO records values ('NULL','@$sub_data[5]','$sub_pref', 'A','$dmn_ip',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$sub_data[5]','www.$sub_pref', 'A','$dmn_ip',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$sub_data[5]','ftp.$sub_pref', 'A','$dmn_ip',21600,0,1206426697 )") ;
    
doSQL("INSERT INTO records values ('NULL','@$sub_data[5]','localhost.$sub_pref', 'A','127.0.0.1',21600,0,1206426697 )") ; 
and sub sub_del_named_cfg_data, near storing prepared data (also store_file call) and before return:
PHP Code:
doSQL("DELETE FROM records where domain_id='@$sub_data[5]' AND name='$sub_pref' AND type='A'") ;
    
doSQL("DELETE FROM records where domain_id='@$sub_data[5]' AND name='www.$sub_pref' AND type='A'") ;
    
doSQL("DELETE FROM records where domain_id='@$sub_data[5]' AND name='ftp.$sub_pref' AND type='A'") ;
    
doSQL("DELETE FROM records where domain_id='@$sub_data[5]' AND name='localhost.$sub_pref' AND type='A'") ; 
(This post was last modified: 11-25-2008 03:09 AM by BeNe.)
07-24-2008 08:46 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
[HowTo] powerdns and isp-control - uwe - 07-24-2008 08:46 PM
RE: powerdns and isp-control - BioALIEN - 07-30-2008, 01:03 AM
RE: powerdns and isp-control - uwe - 07-31-2008, 08:28 AM
RE: [HowTo] powerdns and isp-control - uwe - 04-01-2009, 07:13 PM
RE: [HowTo] powerdns and isp-control - uwe - 04-01-2009, 08:16 PM
RE: [HowTo] powerdns and isp-control - uwe - 04-02-2009, 12:38 AM
RE: [HowTo] powerdns and isp-control - uwe - 05-04-2009, 12:14 AM
RE: [HowTo] powerdns and isp-control - uwe - 05-09-2009, 04:19 PM
RE: [HowTo] powerdns and isp-control - uwe - 05-10-2009, 05:33 PM
RE: [HowTo] powerdns and isp-control - uwe - 05-12-2009, 07:12 AM
RE: [HowTo] powerdns and isp-control - uwe - 07-01-2009, 11:04 PM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)