/** * Constructor * * @param string $host * @param string $port * @param array $authinfo * @param string $rndc_path * @param string $namedconf_path * @param string $nameddb_path * @param string $zonetemplate */ function __construct($host, $port, $authinfo, $rndc_path, $namedconf_path, $nameddb_path, $zonetemplate, $inittransport = true) { // Call Bind class construct parent::__construct($namedconf_path, $nameddb_path, $zonetemplate, $rndc_path, false); $this->Logger = Logger::getLogger('RemoteBIND'); $this->Host = $host; $this->Port = $port; $this->Authinfo = $authinfo; $this->Transport = self::DEFAULT_TRANSPORT; if ($inittransport) { if (!$this->InitTransport()) { throw new Exception("Cannot init transport"); } } $this->DoMakeBackup = false; $this->HaveNewZones = 0; }
function named() { $url = $this->cnml_host . "/guifi/cnml/" . $this->service_id . "/domains"; $cnml = ''; $h = fopen($url, "r") or die(date("YmdHi") . " xUnable to fetch CNML.\n"); while (!feof($h)) { $cnml .= fgets($h) or die(date("YmdHi") . " xUnable to read CNML.\n"); } fclose($h); $check = check_cnml($cnml); if ($check) { $xml = new SimpleXMLElement($cnml); $dns = new BIND($this->master_dir, $this->slave_dir, $this->chroot); $dns->named(); foreach ($xml->domains as $domains) { foreach ($domains->internal as $zones) { $op = "\tmatch-clients { 127.0.0.1; 192.168.0.0/16; 10.0.0.0/8; 172.16.0.0/12; };\n\trecursion yes;\n\tinclude \"" . $this->master_dir . "/named.conf.int.private\";"; $this->view("", $op, $zones, $dns); } foreach ($domains->external as $zones) { $op = "\tmatch-clients { any; };\n\trecursion no;\n\tinclude \"" . $this->master_dir . "/named.conf.ext.private\";"; $this->view("internet", $op, $zones, $dns); } } } else { echo date("YmdHi") . " Invalid CNML! cannot update! check master cnml server url on /etc/dnservices/config.php\nor check your Internent/Guifi.net connection.\n named.conf not changed! \n"; exit; } }
/** * Constructor * * @param string $host * @param string $port * @param array $authinfo * @param string $rndc_path * @param string $namedconf_path * @param string $nameddb_path * @param string $zonetemplate */ function __construct($host, $port, $authinfo, $rndc_path, $namedconf_path, $nameddb_path, $zonetemplate, $inittransport= true) { // Call Bind class construct parent::__construct($namedconf_path, $nameddb_path, $zonetemplate, $rndc_path, false); $this->Host = $host; $this->Port = $port; $this->Authinfo = $authinfo; $this->Transport = self::DEFAULT_TRANSPORT; if ($inittransport) if (!$this->InitTransport()) Core::RaiseError("Cannot init transport"); $this->DoMakeBackup = false; $this->HaveNewZones = 0; }