Jump to content
Froxlor Forum
  • 0

PowerDNS - MySQL - Shared Nameserver


AltruHost

Question

as far as I can tell froxlor only supports creation of bind named.conf files and doesn't store dns info in the database is that correct?

 

I am needing to store the dns in database as I need other applications to be able to share the dns server and not have entries from the other apps be destroyed or overwritten as changes in froxlor occur (or my below approach would work great with a delete from statement added to it)... I also want to use mysql replication to to keep secondary nameservers synced...

 

what I have done is create a simple bash script that utilizes the zone2sql command and pushes the data into the db and then set this as the bind reload command in froxlor... the table is smart enough not to allow duplicate entries however I would have to handle manual removal of entries.... is there a better way to handle this? perhaps a sql trigger since they are on the same server in different dbs? is anybody else doing anything like this that has some insight?

 

#!/bin/bash

cd /etc/bind 
ZONESQL="USE dns;"$(zone2sql -gmysql) 
echo $ZONESQL | mysql -u userwithwriteaccess -ppasswordhere

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

how far along is the next ver? is it built on 0.9 or is it a rewrite?

if its like Alpha status perhaps I should run that and submit bug fixes...

 

if its still a far from that... is the transition from .9.x to 1.0 going to be painfree?

 

I guess in the meantime I will just write some insert and delete triggers to keep the dns data uptodate

Link to comment
Share on other sites

ok so here is a working delete trigger if anyone is interested

so that bash script for named files along with this should work ok...

i'll probably take the time and write an insert trigger too but this will do fine for now...

 


delimiter $$
CREATE TRIGGER Domain_Delete AFTER delete ON panel_domains
 FOR EACH ROW BEGIN
   set @domain_id = (select id from dns.domains where name = old.domain);
   delete from dns.domains where id = @domain_id;
   delete from dns.records where domain_id = @domain_id;
 END$$

Link to comment
Share on other sites

this may be better and handle sub domains...

 

delimiter $$
CREATE TRIGGER Domain_Delete AFTER delete ON panel_domains
 FOR EACH ROW BEGIN
IF old.parentdomainid = 0 THEN
     set @domain_id = (select id from dns.domains where name = old.domain);
     delete from dns.domains where id = @domain_id;
     delete from dns.records where domain_id = @domain_id;
   ELSE
     delete from dns.records where name = old.domain;
   END IF;
 END$$

Link to comment
Share on other sites

maybe something like this for an insert domain trigger

 

i'm sure these triggers could be improved upon but it should work ok without changing existing code base

 

delimiter $$
CREATE TRIGGER Domain_Insert AFTER insert ON panel_domains
 FOR EACH ROW BEGIN
   set @ip = (select ip from panel_ipsandports where id = new.ipandport);
   IF new.parentdomainid = 0 THEN
  insert into dns.domains (name,type) Values(new.domain,"NATIVE");
  set @domain_id = LAST_INSERT_ID();
  insert into dns.records (domain_id, name, type, content, ttl, prio)
   Values(@domain_id, new.domain, "SOA",CONCAT("ns.",new.domain, " ", 
   new.domain, " ", DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'), " 28800 7200 604800 39600"), 86400, 0);
  insert into dns.records (domain_id, name, type, content, ttl, prio)
   Values(@domain_id, new.domain, "NS", CONCAT("ns.",new.domain), 86400, 0);
  insert into dns.records (domain_id, name, type, content, ttl, prio)
   Values(@domain_id, new.domain, "A", @ip, 86400, 0);
  insert into dns.records (domain_id, name, type, content, ttl, prio)
   Values(@domain_id, CONCAT("www.",new.domain), "A", @ip, 86400, 0);
 insert into dns.records (domain_id, name, type, content, ttl, prio)
   Values(@domain_id, CONCAT("*.",new.domain), "A", @ip, 86400, 0);
  IF new.isemaildomain = 1 THEN
       insert into dns.records (domain_id, name, type, content, ttl, prio)
     Values(@domain_id, CONCAT("mail.",new.domain), "A", @ip, 86400, 0);
    insert into dns.records (domain_id, name, type, content, ttl, prio)
     Values(@domain_id, new.domain, "MX", CONCAT("mail.",new.domain), 86400, 10); 
  END IF;
   ELSE
  set @parent_domain = (select domain from panel_domain where id = new.parentdomainid);
  set @domain_id = (select id from dns.domains where name =@parent_domain);
  insert into dns.records (domain_id, name, type, content, ttl, prio)
   Values(@domain_id, new.domain, "A", @ip, 86400, 0);
   END IF;
 END $$

Link to comment
Share on other sites

Right now I'm at a point of setting up redundant DNS servers, external to Froxlor boxes, to handle queries for different servers/domains.

 

I'm using PowerDNS with PowerAdmin. PowerAdmin has Templates, so it's pretty easy to move a domain from a server to another.

 

Froxlor multi server support looked very nice, but didn't see any news for a while about this (http://websvn.froxlor.org/browser/Froxlor/branches/multiserver has no updates for about 3 months). Moving a domain/account from a server to another is very handy sometimes ;)

 

Maybe I'll think about reading domain list from Froxlor (I'll use that for a Mail Gateway, to handle all the SPAM/Viruses from a single point and lightning the load on the servers).

 

Regards,

/Sorin

Link to comment
Share on other sites

Froxlor multi server support looked very nice, but didn't see any news for a while about this (http://websvn.froxlor.org/browser/Froxlor/branches/multiserver has no updates for about 3 months). Moving a domain/account from a server to another is very handy sometimes ;)

 

yup, sorry, we're only three active developers at this time. Trying to do our best but sadly, we can't do everything at once :P

Link to comment
Share on other sites

Why would you want to move domains? If you have multiple DNS servers I would think you would want to have all names on all... then define them at the registrar as an NS and also put all on the setup for each domain... it will then hit them in a round robin balancing the load... not to mention redundancy... unless you have an unreal amount of traffic hitting them(unless you're running dns for hundreds of thousands of sites), and even in that case you would want each domain still on two servers...

 

 

just my two cents

Link to comment
Share on other sites

yup, sorry, we're only three active developers at this time. Trying to do our best but sadly, we can't do everything at once :P

 

If you're looking for more developers I may be interested in a couple months... the hosting company I'm starting is planning on using froxlor as our primary shared hosting CP so it would be in my best interest to assist as much as possible...

Link to comment
Share on other sites

Sometimes you (the "hoster") will need to switch/move server (maybe switch from CPanel/Plesk to Froxlor :) ) for one or more domains (not all the domains on that server), and you have no access to NS control panel at registrar.

 

In this case, you won't change NS at registrar, just update your records :)

 

Seems logical to me :)

 

Regards,

/Sorin

Link to comment
Share on other sites

Sometimes you (the "hoster") will need to switch/move server (maybe switch from CPanel/Plesk to Froxlor :) ) for one or more domains (not all the domains on that server), and you have no access to NS control panel at registrar.

 

In this case, you won't change NS at registrar, just update your records :)

 

Seems logical to me :)

 

Regards,

/Sorin

 

Right so I'm still confused to why you would migrate from one nameserver to another... i would think that it would stay on the same nameservers and that all your panels would share...

Link to comment
Share on other sites

Right now I have clients on Plesk servers, and I'm trying to move to Froxlor.

I can't move them all at once, so I have to move them to new NSs.

 

Taking in consideration my previous problems I had, I'm thinking about this solution.

This will allow to move/switch/replace any server, partially or not, and allowing a mixed solutions with any control panel.

 

Regards,

/Sorin

Link to comment
Share on other sites

Yes with this you could...

 

implement this on the froxlor server...

do a sql dump or use zone2sql(if using bind) on the plesk/cpanel boxes...

import the cpanel/plesk into the powerdns server

then you can move as needed the clients and do whatever with the box

 

or you could implment this

create a user@plesk/cpanelserver on the froxlor boxes mysql

tell it to push directly there if already using the mysql back end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...