Listener::Named::Slave::Provisioning - Zonetransfer to Secondary Nameserver + Howto

  • Listener::Named::Slave::Provisioning


    This listener file will create a php script /var/www/imscp/gui/public/provisioning/slave_provisioning.php that echoes all zones available on your i-MSCP server for zone provisioning on the secondary nameserver. Optionally a HTTP authentication file will be created /var/www/imscp/gui/public/provisioning/.htpasswd. Read the configuration options in the listener file for further details.


    Author / Maintainer


    Compatibility
    i-MSCP >= 1.2.12


    Howto install

    1. Copy the 10_named_slave_provisioning.pl listener file into the /etc/imscp/listeners.d directory. This listener is available in the contrib/Listeners/Named directory of the i-MSCP archive.
    2. Run perl imscp-autoinstall -dasr named from your i-MSCP version archive and add the slave DNS servers


    How-To install the slave DNS servers (w/o i-MSCP)


    For this case study, we have three i-MSCP servers with the following hostnames and IP addresses:

    Code
    1. imscpserver1.domain.tld 1.1.1.1
    2. imscpserver2.domain.tld 1.1.1.2
    3. imscpserver3.domain.tld 1.1.1.3

    We want to add two slave nameservers with the following hostnames and IP addresses:

    Code
    1. ns2.domain.tld 2.2.2.1
    2. ns3.domain.tld 2.2.2.2

    For each slave nameserver we want to create, we install a fresh Debian Jessie or Ubuntu distribution (base/minimal install), and run the following commands:

    Shell-Script
    1. apt-get update && apt-get install bind9 bsdutils dnsutils cron
    2. mkdir /var/log/named
    3. touch /var/log/named/bind9.log /var/log/named/security.log
    4. chown -R bind /var/log/named

    Once done, in the /etc/bind/named.conf file, we need add the following configuration stanzas:

    Code
    1. include "/etc/bind/named.conf.imscpserver1.domain.tld";
    2. include "/etc/bind/named.conf.imscpserver2.domain.tld";
    3. include "/etc/bind/named.conf.imscpserver3.domain.tld";

    then, we need edit the /etc/bind/named.conf.local configuration file as follows:

    then, we need edit the /etc/bind/named.conf.options as follow:

    then, create the /root/syncdns.sh script as follow:

    Code
    1. touch /root/syncdns.sh
    2. chmod +x /root/syncdns.sh

    with the following content:

    And finally add a cron task by running the following command:

    Code
    1. echo '30 * * * * root bash /root/syncdns.sh' > /etc/cron.d/syncdns
  • Thank you for this tutorial.


    But I stack at the begining:


    Quote


    Howto install

    • Download here the listener file into the /etc/imscp/listeners.d directory.
    • Run the imscp-setup script perl /var/www/imscp/engine/setup/imscp-setup -dr named and add the slave DNS servers

    I made these steps, but the http://<panel.domain.tld>:8080/provisioning/slave_provisioning.php file dosn't exsist.
    In the listeren file there are no any instructions, what need I do with it, to generate the php file.

    i-MSCP 1.5.3
    Plugins (latest version): ClamAV, CronJobs, DomainAutoApproval, LetsEncrypt, OpenDKIM, PanelRedirect, PhpSwitcher, PolicydSPF, Postgrey, RecaptchaPMA, RoundcubePlugins, SpamAssasin, WHMCS

  • @Dylan


    Which i-MSCP version are you using? The listener is only compatible with i-MSCP version >= 1.2.12

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @Nuxwin


    I use i-MSCP 1.2.16 on Debian Jessie
    It a new Debian Jessie install, with i-MSCP 1.2.15 and yesterday I updated it to 1.2.16

    i-MSCP 1.5.3
    Plugins (latest version): ClamAV, CronJobs, DomainAutoApproval, LetsEncrypt, OpenDKIM, PanelRedirect, PhpSwitcher, PolicydSPF, Postgrey, RecaptchaPMA, RoundcubePlugins, SpamAssasin, WHMCS

  • @Dylan


    Found your problem.


    You must run the following commands:


    Code
    1. # cd <your_imscp_1.2.16_archive_dir># perl imscp-autoinstall -dasr named


    instead of


    Code
    1. # perl /var/www/imscp/engine/setup/imscp-setup -dr named


    Why? Because the listener listen on the afterInstall event which is only triggered in installation context. I'll review this soon.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @Nuxwin
    Thank you, it was the problem.
    Now slave DNS is working. :)

    i-MSCP 1.5.3
    Plugins (latest version): ClamAV, CronJobs, DomainAutoApproval, LetsEncrypt, OpenDKIM, PanelRedirect, PhpSwitcher, PolicydSPF, Postgrey, RecaptchaPMA, RoundcubePlugins, SpamAssasin, WHMCS

  • Problem fixed. Provisioning script is now created even when running imscp-setup script. See https://github.com/i-MSCP/imsc…14843a7c54...5e8a554d1332

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Sorry, I have a new problem about this.


    It's seems, cron script not run.
    When I run it manualy (/root/syncdns.sh), it's ok, but if I add a new domain to master, slave not sync it automatically after period.


    So I think, maybe this command wrong:

    Code
    1. echo '30 * * * * root bash /root/syncdns.sh' > /etc/cron.d/syncdns

    The /root/syncdns.sh chmod is: 0755
    Chown: root


    On /etc/cron.d there are syncdns it contains:


    Code
    1. 5 * * * * root bash /root/syncdns.sh


    Any idea?
    Thank you!

    i-MSCP 1.5.3
    Plugins (latest version): ClamAV, CronJobs, DomainAutoApproval, LetsEncrypt, OpenDKIM, PanelRedirect, PhpSwitcher, PolicydSPF, Postgrey, RecaptchaPMA, RoundcubePlugins, SpamAssasin, WHMCS

  • Please, change it to


    Code
    1. * * * * * root bash /root/syncdns.sh


    for testing and do a tail on /var/log/syslog as follow


    Shell-Script
    1. # tail -fn0 /var/log/syslog | grep CRON


    then add a domain (or subdomain through your control panel), wait for the next two minutes and post us the output.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Hmm intresting. Now worked...
    Output was:


    Code
    1. Apr 18 16:12:01 ns2 CRON[5289]: (root) CMD (bash /root/syncdns.sh)
    2. Apr 18 16:13:01 ns2 CRON[6237]: (root) CMD (bash /root/syncdns.sh)
    3. Apr 18 16:14:01 ns2 CRON[7163]: (root) CMD (bash /root/syncdns.sh)
    4. Apr 18 16:15:01 ns2 CRON[8130]: (root) CMD (bash /root/syncdns.sh)

    i-MSCP 1.5.3
    Plugins (latest version): ClamAV, CronJobs, DomainAutoApproval, LetsEncrypt, OpenDKIM, PanelRedirect, PhpSwitcher, PolicydSPF, Postgrey, RecaptchaPMA, RoundcubePlugins, SpamAssasin, WHMCS