How to add domains into DNSmanager manually (if domains are already specified in the named configuration file)

From ISPWiki
Jump to: navigation, search

This article goes you through the steps you need to perform for adding domains that are already specified in named, into DNSmanager.

1. As domains in DNSmanager are assigned to a user and his name space, you will first need to create the user.

2. The panel considers all the zones be included into view (view = user's name space). Be sure to include zones into view.


view "" {
allow-transfer {; };
       match-destinations {; };
zone "" {
               type master;
               file "/etc/bind/hoster.mary/";

3. DNSmanager stores all the information in the sqlite database. Add the domain into the database.

Database file - /path/to/manager/etc/dnsmgr.db (by default DNSmanager is installed into /usr/local/mgr5/)

For example, the name of the newly created user - named, name space -

Get the user's id from the base.

sqlite> select * from user where name='named';
15|named||$1$uRNrHK8j$wMBkoPr8FvtbC74DoiW3M.|16|on|off|13||0||100|||mail mail|ftp www mail|

15 - id of the named user.

Get the name space's id from the base.

sqlite> select * from namespace where name='';

13 - id of the name space.

Add the domain into the domain table and assign it to the user and name space.

sqlite> insert into domain ([id],[name],[namespace_id],[user],[dtype]) values ('56','','13','15','master');

Restart DNSmanager to apply the changes.

/usr/local/mgr5/sbin/mgrctl -m dnsmgr exit


You may ask - what should I do if I have two domains? The following is a script that can be used for automating this process.

A list of domains is supposed to be specified in the file /root/domain.txt. For the count variable set the value larger than the last id in the domain table.

for i in `cat /root/domain.txt`; do
       echo "insert into domain ([id],[name],[namespace_id],[user],[dtype]) values ('$count','$i','13','15','master');" | sqlite3 /usr/local/mgr5/etc/dnsmgr.db