OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

Adding remote host or CNAME - DNS import

sysbot

22-08-2009 12:48:51

I'm currently working at the University campus and resources are offend share but responsibilities are not. One of the example was the need for this:

ncmir.ucsd.edu. 3600 IN MX 5 bigiron.ncmir.ucsd.edu.
ncmir.ucsd.edu. 3600 IN MX 10 bigiron.ucsd.edu.
ncmir.ucsd.edu. 3600 IN MX 50 inbound.ucsd.edu.
ncmir.ucsd.edu. 3600 IN MX 666 spaminator.ucsd.edu.

Since i'm responsible for ncmir.ucsd.edu and not ucsd.edu. Where you see the bigiron.ucsd.edu is out of our DNS control and I don't want to add it as an host in ONA database, as I'm not responsible for it. However, when using ONA, I'm unable to add an external MX/CNAME or A ( ncmir.ucsd.edu in MX bigiron.ucsd.edu ) record unless it "exist" which it will never be. What's the work around for this? Is there anyway to force ONA to add the record anyways?

Also included here is my latest version of code for import from DNS to ONA. Basically it perform a AXFR from a certain domain and import it to ONA. It's available as-in, not responsible if you break your things with it, please read the code and comments before running it.

You can run it like this, need two passes to complete the import (host_add and dns_record_add), by default it only display what it will do, you will need to pass this to actually import "--dryrun=0":

example:
$ perl dns2ona.pl --zone=example.com --ns=ns1.example --module=host_add
$ perl dns2ona.pl --zone=example.com --ns=ns1.example --module=dns_record_add

Matt

24-08-2009 17:30:57

First off, thanks for posting the dns2ona.pl script! I was just about to post it from one of the old emails you sent me but this is much better. :) I'm sure many will benefit from this script.

Secondly the issue of DNS records that point to or refer in some way to things outside of your control. The bottom line is that there is (and probably will never be) a work around for this. The table design requires a table reference to other existing A records for several record types (NS, MX, PTR etc). There is no real way to change this requirement without some serious table changes.

As it stands, you will need to add an A record for each of these hosts to ONA. While I understand that you don't control the contents of the uscd.edu domain itself it is still useful information to store in your ONA instance. Since you will not be building DNS configuration for the uscd.edu domain it will not hurt or effect anything in that domain. Once adding the A record (and IP address with subnet etc) you will be able to build your dns configuration as needed.

For more conversation about this there was a similar bug report opened here: http://opennetadmin.com/bugs/index.php?do=details&task_id=34&project=3


There is one workaround however that I can offer. The reference version of the build_bind tool does not yet support this but the concept of a footer file is something I've done in the past. Basically you keep a named-domain.com-footer file that contains a manually edited set of records that simply get appended to the named-domain.com zone file that is built from ONA. I've not had time to get this functionality into the build process but its not all that hard to implement. That way for any records not yet supported by ONA (or ones you dont want to manage in the database) can still be merged to the resulting zone file that is extracted from the database.

Hope that helps.

yshollander

25-08-2009 11:29:55

I've done exactly that (using a footer, actually a here doc. Something like:

${ONABIN}/build_bind_domain domain=mydomain.com > ${CFGDIR}/db.mydomain.com
cat >> ${CFGDIR}/db.selerityfinancial.com <<EOF
# put any non-ONA-controlled DNS record here...
foo IN MX 90 mail-relay.mydomain.com
bar.mydomain.com. IN CNAME server1
...
EOF