Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/bind/3/install.php |
<?php
/*
function __bind_requirements(){
}
function __bind_preinstall(){
}
function __bind_postinstall(){
}
*/
function __bind_install(){
global $infos, $webuzo, $error, $globals;
$distro = $globals['WU_DISTRO'];
$source = '/usr/local/webuzo/conf/webuzo/';
if($distro == 'ubuntu'){
yum('bind9');
yum('dnsutils');
if(!file_exists('/usr/sbin/named')){
$error[] = 'Oops !!! There were some errors installing Bind.';
return false;
}
vexec('ln -s /etc/bind '.BIND_APP.' 2>&1');
if(file_exists('/etc/init.d/bind9')){
vexec('ln -s /etc/init.d/bind9 /etc/init.d/named 2>&1');
}
}else{
// Install Bind
yum('bind');
yum('bind-devel --skip-broken');
yum('bind-utils');
if(!file_exists('/usr/sbin/named')){
$error[] = 'Oops !!! There were some errors installing Bind.';
return false;
}
// Move the CONF Files
copy(BIND_WAPP . '/named.rfc1912.zones', BIND_APP.'/named.rfc1912.zones');
copy(BIND_WAPP . '/named.zero', BIND_APP.'/named.zero');
copy(BIND_WAPP . '/named.ip6.local', BIND_APP.'/named.ip6.local');
copy(BIND_WAPP . '/named.local', BIND_APP.'/named.local');
copy(BIND_WAPP . '/named.ca', BIND_APP.'/named.ca');
copy(BIND_WAPP . '/named.broadcast', BIND_APP.'/named.broadcast');
copy(BIND_WAPP . '/localdomain.zone', BIND_APP.'/localdomain.zone');
copy(BIND_WAPP . '/localhost.zone', BIND_APP.'/localhost.zone');
// COPY THE FILE IF AND ONLY IF CENTOS 5
$os = vexec('cat /etc/redhat-release | grep -i "release 5"');
if(!empty($os)){
vexec('cp -f '.BIND_WAPP.'/5sample.named.conf '.$source.'sample.named.conf');
}
// RNDC CONFIG
//vexec('/usr/sbin/rndc-confgen -a 2>&1');
//vexec('chmod 600 /etc/rndc.key 2>&1');
}
// Check firewalld installed and Add bind port in firewalld
$status = trim(shell_exec('firewall-cmd --state 2>&1'));
if($status == 'running'){
vexec('firewall-cmd --zone=public --add-port=53/tcp --permanent');
vexec('firewall-cmd --zone=public --add-port=53/udp --permanent');
vexec('firewall-cmd --reload');
}
}
function __bind_after_save_install(){
global $webuzo;
// Rebuild zone files
bind_rebuild_all();
bind_reload();
}