$exppxecn = explode('=', $node[0]); $pxecn = $exppxecn[1]; $pxeDN = implode(',', $node); # Generic Menu Entry $expgbm = ldap_explode_dn($me['genericmenuentrydn'], 1); $gmecn = $expgbm[0]; $gmerbs = $expgbm[1]; $gmeou = $expgbm[3]; # PXE/RBS Daten $pxe = get_node_data($pxeDN, array("rbservicedn", "timerange")); $timerange = $pxe['timerange']; $rbsDN = $pxe['rbservicedn']; $exp = explode(',', $rbsDN); $exprbsau = explode('=', $exp[2]); $rbsau = $exprbsau[1]; $rbsdata = get_node_data($rbsDN, array("cn", "nfsserverip", "exportpath", "tftpserverip", "tftppath")); # Bootmenu Daten $template->assign(array("MEDN" => $meDN, "MECN" => $me['cn'], "GMECN" => $gmecn, "GMEOU" => $gmeou, "GMERBS" => $gmerbs, "LABEL" => $me['label'], "MELABEL" => $me['menulabel'], "MEDEF" => $me['menudefault'], "MEPASSWD" => $me['menupasswd'], "MEHIDE" => $me['menuhide'], "VGA" => $me['vga'], "SPLASH" => $me['splash'], "NOLDSC" => $me['noldsc'], "ELEVATOR" => $me['elevator'], "VCI" => $me['vci'], "CCV" => $me['clientconfvia'], "APIC" => $me['apic'], "COWLOOP" => $me['cowloop'], "UNIONFS" => $me['unionfs'], "DEBUG" => $me['debug'], "MENPOS" => $me['menuposition'], "LOCALBOOT" => $me['localboot'], "KERNEL" => $me['kernel'], "SUBMENULINK" => $me['submenulink'], "PXEDN" => $pxeDN, "PXECN" => $pxecn, "TIMERANGE" => $timerange, "MNR" => $mnr, "SBMNR" => $sbmnr, "MCNR" => $mcnr)); #$template->define_dynamic("Submenulink", "Webseite"); #if (count($me['submenulink']) != 0){ # foreach ($me['submenulink'] as $sbml){ # $template->assign(array("SUBMENULINK" => $sbml)); # $template->parse("SUBMENULINK_LIST", ".Submenulink"); # } #} # Alternative RB Dienste holen $altrbs = get_rbservices($auDN, array("dn", "cn")); if (count($altrbs) != 0) { for ($i = 0; $i < count($altrbs); $i++) { if ($rbsDN == $altrbs[$i]['dn']) { array_splice($altrbs, $i, 1);
include '../standard_header.inc.php'; # Dateiname und evtl. Pfad des Templates für die Webseite $webseite = "dhcpnopool.dwt"; include 'dhcp_header.inc.php'; $mnr = 3; $sbmnr = -1; ################################################################################### $mnr = $_GET['mnr']; $sbmnr = $_GET['sbmnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### $template->assign(array("POOLDN" => "", "CN" => "", "SUBNETDN" => "", "SUBNET" => "", "RANGE1" => "", "RANGE2" => "", "DESCRIPTION" => "", "STATEMENTS" => "", "PCL" => "", "ALLOW" => "", "DENY" => "", "IGNORE" => "", "DEFAULTLEASE" => "", "MAXLEASE" => "", "MNR" => $mnr)); $scope_attributes = array("dn", "cn", "dhcphlpcont", "dhcpstatements", "dhcpoptallow", "dhcpoptdeny", "dhcpoptignore", "dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptgeneric", "hlprbservice", "dhcpoptfilename", "dhcpoptnext-server", "dhcppermittedclients"); $global_data = get_node_data($DHCP_SERVICE, $scope_attributes); if ($global_data['dhcppermittedclients'] == "deny unknown-clients") { $pcldata = "<br><b>Globale Option des DHCP Dienstes</b><br>\n\t\t\tSie können spezifisch für das Pool einen anderen Wert setzen"; $pcl_select .= "<input type='radio' name='pcl' value='' checked> Im DHCP eingetragene Clients (deny unknown-clients)</option><br>"; $pcl_select .= "<input type='radio' name='pcl' value='allow unknown-clients'> Beliebige Clients (allow unknown-clients)</option>"; } else { $pcl_select .= "<input type='radio' name='pcl' value='' checked> Beliebige Clients (allow unknown-clients)</option>"; $pcl_select .= "<input type='radio' name='pcl' value='deny unknown-clients'> Im DHCP eingetragene Clients (deny unknown-clients)</option><br>"; } $template->assign(array("PCL" => $pcl_select)); /* # DHCP Pools Daten holen $attributes = array("dn","cn","dhcphlpcont","dhcprange","description","dhcpstatements","dhcpoptallow", "dhcpoptdefault-lease-time","dhcpoptdeny","dhcpoptignore","dhcpoptmax-lease-time", "dhcpoptgeneric"); $pools = get_dhcppools($auDN, $attributes);
include '../standard_header.inc.php'; # Dateiname und evtl. Pfad des Templates für die Webseite $webseite = "dhcp_cond.dwt"; include 'dhcp_header.inc.php'; ################################################################################### $mnr = $_GET['mnr']; #$sbmnr = $_GET['sbmnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### $csdn = $_GET['csdn']; # DHCP Classes Daten holen $attributes = array("dn", "cn", "dhcphlpcont", "dhcpcondtype", "dhcpboolexpression", "dhcpoptvendor-encapsulated-options", "dhcpoptgeneric", "dhcpstatements"); $cs = get_node_data($csdn, $attributes); print_r($cs); $template->assign(array("CSDN" => "", "CSCN" => "", "DHCPCONT" => "", "CSTYPE" => "", "CSBOOLEXP" => "", "CSVEO" => "", "CSSTATEMENTS" => "", "OPTIONS" => "", "SCOPE" => "", "MNR" => $mnr)); if ($cs['dhcphlpcont'] == $DHCP_SERVICE) { $scope = "<b>Global</b>"; } elseif ($cs['dhcphlpcont']) { $subnetexp = ldap_explode_dn($cs['dhcphlpcont'], 1); $scope = "Subnet<br><b>" . $subnetexp[0] . "</b>"; } else { $scope = ""; } if ($cs['dhcpstatements']) { if (count($cs['dhcpstatements']) > 1) { foreach ($cs['dhcpstatements'] as $statement) { $cs_statements .= "<br>{$statement};"; }
$fe = explode('.', $range2); if ($fs[0] == $fe[0] && $fs[1] == $fe[1] && $fs[2] == $fe[2]) { if ($fs[3] <= $fe[3]) { # DHCP Subnet DN finden $subnet = implode(".", array($fs[0], $fs[1], $fs[2], "0")); if (!($result = uniLdapSearch($ds, "ou=RIPM," . $suffix, "(&(objectclass=dhcpSubnet)(cn={$subnet}))", array("dn", "dhcphlpcont"), "", "sub", 0, 0))) { # redirect(5, "", $ldapError, FALSE); echo "no search"; die; } $result = ldapArraySauber($result); #print_r($result);echo "<br><br>"; if (count($result[0]) != 0) { $subnetdn = $result[0]['dn']; $subnetau = get_audn_of_objectdn($subnetdn); $subnet_data = get_node_data($subnetdn, array("dhcpoptdomain-name")); if ($subnet_data['dhcpoptdomain-name'] != $assocdom) { $poolopt_domain = $assocdom; echo "Pool spezifische Option <b>domain-name</b> auf <b>" . $assocdom . "</b> gesetzt<br>"; } # Range zusammenstellen $range = implode("_", array($range1, $range2)); # Freie IP Bereiche testen $ipmatch = 0; $fipb_array = get_freeipblocks_au($auDN); #echo "<br>FIPB: <br>";print_r($fipb_array);echo "<br>"; for ($i = 0; $i < count($fipb_array); $i++) { if (split_iprange($range, $fipb_array[$i]) != 0) { $ipranges = split_iprange($range, $fipb_array[$i]); array_splice($fipb_array, $i, 1, $ipranges); $ipmatch = 1;
$newpxeDN = "cn=" . $pxecn . "," . $targetDN; print_r($newpxeDN); echo "<br>"; if (dive_into_tree_cp($pxeDN, $newpxeDN)) { # Filename anpassen if ($targettype == "computers") { $macdata = get_node_data($targetDN, array("hwaddress")); $pxemac = str_replace(":", "-", $macdata['hwaddress']); $entrymod['filename'] = "01-" . $pxemac; #$entrymod ['fileuri'] = "01-".$macdata['hwaddress'].".tgz"; } if ($targettype == "groups") { $members = get_node_data($targetDN, array("member")); if (count($members) != 0) { foreach ($members['member'] as $hostDN) { $macdata = get_node_data($hostDN, array("hwaddress")); $pxemac = str_replace(":", "-", $macdata['hwaddress']); $entrymod['filename'][] = "01-" . $pxemac; #$entrymod ['fileuri'] = $target.".tgz"; } } } if (ldap_mod_replace($ds, $newpxeDN, $entrymod)) { if ($deltr == 1) { # Timeranges und FileURI im neuen Objekt löschen (todo: anpassen statt löschen) $entrydel['timerange'] = array(); $entrydel['fileuri'] = array(); if (ldap_mod_del($ds, $newpxeDN, $entrydel)) { $mesg .= "<br>PXE Boot Menü erfolgreich nach " . $target[1] . " kopiert<br>"; } else { ldap_delete($ds, $newpxeDN);
$mnr = $_GET['mnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); ################################################################################### $pxeDN = $_GET['dn']; # DN, CN des übergeordneten Nodes (Host oder Group) $pxednarray = ldap_explode_dn($pxeDN, 0); $nodeDN = implode(',', array_slice($pxednarray, 2)); #$nodeDN = $_GET['nodedn']; $nodednarray = ldap_explode_dn($nodeDN, 1); $attributes = array("dn", "cn", "rbservicedn", "filename", "timerange", "allowoptions", "console", "default", "display", "font", "implicit", "kbdmap", "menumasterpasswd", "menutitle", "noescape", "onerror", "ontimeout", "prompt", "say", "serial", "timeout", "ldapuri", "fileuri"); $pxe = get_node_data($pxeDN, $attributes); # RBS Daten $rbsDN = $pxe['rbservicedn']; $rbsdata = get_node_data($rbsDN, array("cn", "tftpserverip", "tftppath", "tftpclientconfpath")); # Timerange Komponenten $template->define_dynamic("TRanges", "Webseite"); if (count($pxe['timerange']) > 1) { foreach ($pxe['timerange'] as $tr) { $exptime = explode('_', $tr); $template->assign(array("PXEDAY" => $exptime[0], "PXEBEG" => $exptime[1], "PXEEND" => $exptime[2])); $template->parse("TRANGES_LIST", ".TRanges"); } } else { $exptime = explode('_', $pxe['timerange']); $template->assign(array("PXEDAY" => $exptime[0], "PXEBEG" => $exptime[1], "PXEEND" => $exptime[2])); $template->parse("TRANGES_LIST", ".TRanges"); } # Filenames $template->define_dynamic("Filenames", "Webseite");
echo "old dhcp:"; print_r($olddhcp); echo "<br>"; echo "new rbs:"; print_r($rbs); echo "<br>"; echo "old rbs:"; print_r($oldrbs); echo "<br>"; echo "Host DN:"; print_r($hostDN); echo "<br>"; echo "submenuNR:"; print_r($sbmnr); echo "<br><br>";*/ $seconds = 2; $url = 'rbshost.php?dn=' . $hostDN . '&sbmnr=' . $sbmnr; echo " \n<html>\n<head>\n\t<title>AU Management</title>\n\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n</head>\n<body>\n<table border='0' cellpadding='30' cellspacing='0'> \n<tr><td>"; ########################################## # RBS if ($rbs != "none" && $rbs != $oldrbs) { if ($rbs != "") { $exp = ldap_explode_dn($rbs, 1); $rbscn = $exp[0]; $rbsau = $exp[2]; $dhcpdata = get_node_data($rbs, array("tftpserverip", "initbootfile")); $entryrbs['hlprbservice'] = $rbs; $entryrbs['dhcpoptnext-server'] = $dhcpdata['tftpserverip']; $entryrbs['dhcpoptfilename'] = $dhcpdata['initbootfile']; if ($oldrbs != "") { echo "RBS replace "; print_r($oldrbs); echo " with "; print_r($entryrbs); echo "<br>"; if ($result = ldap_mod_replace($ds, $hostDN, $entryrbs)) { update_dhcpmtime(array()); rbs_adjust_host($hostDN, $rbs); $mesg = "Remote Boot Service erfolgreich zu <b>" . $rbscn . " [Abt.: " . $rbsau . "]</b> geändert<br><br>"; } else { $mesg = "Fehler beim ändern des Remote Boot Services zu <b>" . $rbscn . "</b>!<br><br>";
if ($index !== false) { array_splice($nets, $index, 1); } } if ($nets) { #print_r($nets); echo "<br>"; $ro_subnets = get_dhcpsubnets_from_nets($nets, array("dn", "cn", "dhcpoptnetmask", "dhcprange", "dhcphlpcont", "dhcppermittedclients")); #print_r($ro_subnets); echo "<br>"; $subnet_array = array_merge($admin_subnets, $ro_subnets); } else { $subnet_array = $admin_subnets; } ############## # Global DHCP Data $global_options = array("dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptdomain-name", "dhcpoptdomain-name-servers", "dhcpoptgeneric", "dhcppermittedclients"); $global_data = get_node_data($DHCP_SERVICE, $global_options); if ($global_data['dhcppermittedclients']) { $global_pcl = $global_data['dhcppermittedclients']; } else { $global_pcl = "Beliebige Clients"; } $template->assign(array("GLOBALPCL" => $global_pcl)); ############### $subnet_array = array_natsort($subnet_array, "cn", "cn"); $template->define_dynamic("Subnets", "Webseite"); $template->define_dynamic("Pools", "Webseite"); $i = 0; foreach ($subnet_array as $subnet) { $subnetcn = "<a href='dhcpsubnet.php?dn=" . $subnet['dn'] . "&mnr=" . $mnr . "' class='headerlink'><b>" . $subnet['cn'] . "<br>{$subnet['access']}</b></a>"; # Dienstzuordnung des Subnetzes $dhcpservice = " ";
function delete_childau($childDN, $childou, $delmodus) { global $ds, $suffix, $auDN, $domDN, $assocdom, $ldapError; if ($delmodus == "integrate") { # Associated DNS Domain integrieren $childdc = get_domain_data($childDN, array("dn", "associatedname")); print_r($childdc); echo "<br>"; # wenn einzige AU dann einfach in Parentdomain aufnehmen und betroffene Einträge löschen if (count($childdc[0]['associatedname']) == 1) { echo "einzige AU<br>"; # dc Childs verschieben $dcchilds = get_dc_childs($childdc[0]['dn'], array("dn", "dc")); # print_r($dcchilds); echo "<br>"; if (count($dcchilds) != 0) { foreach ($dcchilds as $dcc) { # print_r($dcc['dn']); echo " >> "; print_r("dc=".$dcc['dc'].",".$domDN); echo "<br>"; if (move_subtree($dcc['dn'], "dc=" . $dcc['dc'] . "," . $domDN)) { $newdom = $dcc['dc'] . "." . $assocdom; #print_r($newdom); echo "<br><br>"; dive_into_dctree_adapt("dc=" . $dcc['dc'] . "," . $domDN, $newdom); } } } # alten dc-Knoten löschen dive_into_tree_del($childdc[0]['dn'], ""); } # wenn noch andere AUs in der Domain, dann nur betroffene Einträge entfernen if (count($childdc[0]['associatedname']) > 1) { echo "mehrere AUs<br>"; # ChildAU-Rollen unterhalb dc-Knoten löschen (nur diese)(oder übernehmen: MA zu HA, HA zu HA) $roles = get_roles($childDN); #print_r($roles); echo "<br>"; # was ist wenn rollen nur noch ein member haben ... fehler if (count($roles['MainAdmin']) != 0) { $mainadmins = $roles['MainAdmin']; for ($i = 0; $i < count($mainadmins); $i++) { $entryRoleMain['member'][$i] = $mainadmins[$i]; } #print_r($entryRoleHost); echo "<br>"; $resultMA = ldap_mod_del($ds, "cn=MainAdmin,cn=roles," . $childdc[0]['dn'], $entryRoleMain); } if (count($roles['HostAdmin']) != 0) { $hostadmins = $roles['HostAdmin']; for ($i = 0; $i < count($hostadmins); $i++) { $entryRoleHost['member'][$i] = $hostadmins[$i]; } #print_r($entryRoleHost); echo "<br>"; $resultHA = ldap_mod_del($ds, "cn=HostAdmin,cn=roles," . $childdc[0]['dn'], $entryRoleHost); } if (count($roles['ZoneAdmin']) != 0) { $zoneadmins = $roles['ZoneAdmin']; for ($i = 0; $i < count($zoneadmins); $i++) { $entryRoleZone['member'][$i] = $zoneadmins[$i]; } $resultZA = ldap_mod_del($ds, "cn=ZoneAdmin,cn=roles," . $childdc[0]['dn'], $entryRoleZone); } $entrydel['associatedname'] = $childDN; # print_r($entrydel); echo "<br>"; ldap_mod_del($ds, $childdc[0]['dn'], $entrydel); $zentries = get_zone_entries_assocname($childdc[0]['dn'], array("dn"), $childDN); # print_r($zentries); echo "<br>"; foreach ($zentries as $ze) { # print_r($ze['dn']); echo "<br>"; ldap_delete($ds, $ze['dn']); } } # Rechner (mit IP) + dranhängende MCs, PXEs verschieben $hosts = get_hosts($childDN, array("dn", "hostname")); if (count($hosts) != 0) { foreach ($hosts as $host) { # print_r($host['dn']); echo "<br>"; # print_r($host['hostname']); echo "<br>"; # print_r("hostname=".$host['hostname']."-int-".$childou.",cn=computers,".$auDN); echo "<br><br>"; if (move_subtree($host['dn'], "hostname=" . $host['hostname'] . "-ex-" . $childou . ",cn=computers," . $auDN)) { $newhostDN = "hostname=" . $host['hostname'] . "-ex-" . $childou . ",cn=computers," . $auDN; $dhcp = get_node_data($newhostDN, array("dhcphlpcont")); # print_r($dhcp); echo "<br>"; if ($dhcp['dhcphlpcont'] != "") { $entrydel['dhcphlpcont'] = array(); $entrydel['objectclass'] = "dhcpHost"; # print_r($dhcphlpcont); ldap_mod_del($ds, $newhostDN, $entrydel); } } } } # DHCP Objekte IP Ranges löschen $subnets = get_subnets($childDN, array("dn")); # print_r($subnets); echo "<br>"; if (count($subnets) != 0) { foreach ($subnets as $subnet) { # print_r($subnet['dn']); echo "<br>"; delete_ip_dhcprange($subnet['dn'], $childDN); } } # DHCP Pools auch noch # Freie IP Bereiche zurücknehmen $fipb_array = get_freeipblocks_au($childDN); # print_r($fipb_array); echo "<br>"; # print_r(count($fipb_array)); echo "<br>"; if (count($fipb_array) == 1 && $fipb_array[0] != "") { $entry_ipblock['freeipblock'] = $fipb_array[0]; # print_r($entry_ipblock); echo "<br>"; ldap_mod_add($ds, $auDN, $entry_ipblock); } if (count($fipb_array) > 1) { foreach ($fipb_array as $fipb) { $entry_ipblock['FreeIPBlock'][] = $fipb; # print_r($entry_ipblock); echo "<br>"; ldap_mod_add($ds, $auDN, $entry_ipblock); } } merge_ipranges($auDN); # Verschieben der Childs an neue Stelle $child_childs = get_childau($childDN, array("dn", "ou")); # print_r($child_childs); echo "<br>"; if (count($child_childs) != 0) { foreach ($child_childs as $cc) { $child_childDN = $cc['dn']; $newccDN = "ou=" . $cc['ou'] . "," . $auDN; # print_r($child_childDN); echo " >> "; # print_r($newccDN); echo "<br>"; if (move_subtree($child_childDN, $newccDN)) { adjust_dn_entries($child_childDN, $newccDN); } } } # Löschen des AU Knotens dive_into_tree_del($childDN, ""); $mesg = "<br>Erfolgreich gelöscht mit Integration<br>"; return $mesg; } if ($delmodus == "complete") { # IP Bereiche zurück # DNS Teilbaum Objekte löschen # alles rekursive löschen /*if (dive_into_tree_del($dcDN,"")){ $delentry ['objectclass'] = "domainrelatedobject"; $delentry ['associateddomain'] = $domsuffix; #print_r($delentry); echo "<br>"; $delresult = ldap_mod_del($ds,$childDN,$delentry); if ($delresult){ $mesg = "Domain komplett gelöscht<br>"; }else{$mesg = "Fehler! ldap_mod_del<br>";} }else{$mesg = "Fehler! dive_into_tree_del<br>";} */ $mesg = "Komplettes löschen mometan noch nicht unterstützt.<br>\n\t\t\t\t\tNur eine Ebene mit Integration ...<br>"; return $mesg; } }
# Menuleisten erstellen createMainMenu($rollen, $mainnr); createRBSMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### $gbmDN = $_GET['dn']; $template->assign(array("TFTPROOT" => "", "TFTPKERNEL" => "", "TFTPPXE" => "", "TFTPCLIENTCONF" => "", "NFS" => "", "NFSPATH" => "", "NBD" => "")); # rbservice und pxe daten (voerst nur ein rbs) $rbs_array = get_rbservices($auDN, array("dn", "cn")); $rbsDN = $rbs_array[0]['dn']; # RBS Daten $rbs_data = get_node_data($rbsDN, array("cn", "tftpserverip", "tftproot", "tftpkernelpath", "tftpclientconfpath", "tftppxepath", "nfsserverip", "exportpath", "nbdserverip", "fileserveruri")); $template->assign(array("RBSCN" => $rbs_data['cn'], "TFTPIP" => $rbs_data['tftpserverip'], "TFTPROOT" => $rbs_data['tftproot'], "TFTPKERNEL" => $rbs_data['tftpkernelpath'], "TFTPPXE" => $rbs_data['tftppxepath'], "TFTPCLIENTCONF" => $rbs_data['tftpclientconfpath'], "NFS" => $rbs_data['nfsserverip'], "NFSPATH" => $rbs_data['exportpath'], "NBD" => $rbs_data['nbdserverip'])); $template->assign(array("GBMDN" => $gbmDN, "GBMCN" => "", "LABEL" => "", "KERNEL" => "", "INITRD" => "", "FSTYPE" => "", "ROOTFS" => "", "DEBUG" => "", "MISC" => "", "IPAPPEND" => "")); # GBM Daten $attributes = array("dn", "cn", "label", "kernel", "initrd", "rootfs", "rootfstype", "rootfspath", "debug", "appendmisc", "ipappend"); $gbm = get_node_data($gbmDN, $attributes); $selectboxmax = count($rbs_data['fileserveruri']) + 1; $fsuriselectbox = "<select name='rootfs' size='" . $selectboxmax . "' class='rootfs_form_selectbox'>\n <option value='none'>---------------------------------</option>"; if ($rbs_data['fileserveruri'] != "") { foreach ($rbs_data['fileserveruri'] as $fsuri) { $fsuriselectbox .= "<option value='" . $fsuri . "'>" . $fsuri . "</option>"; } } $fsuriselectbox .= "</select>\n\t\t\t\t\t <input type='hidden' name='oldrootfs' value='" . $gbm['rootfs'] . "'>"; if ($gbm['rootfstype'] == 'nfs') { $options = "<select name='rootfstype' size='4' class='rootfs_form_selectbox'>\n\t\t\t\t\t<option value='nfs' selected><b>nfs://" . $rbs_data['nfsserverip'] . ":/" . $rbs_data['exportpath'] . "</b></option>\n\t\t\t\t\t<option value=''>---------------------------------</option>\n\t\t\t\t\t<option value='nbd'>nbd://" . $rbs_data['nbdserverip'] . ":</option>\n\t\t\t\t\t<option value='dnbd'>dnbd://" . $rbs_data['nbdserverip'] . ":</option>\n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='hidden' name='oldrootfstype' value='" . $gbm['rootfstype'] . "'>"; } if ($gbm['rootfstype'] == 'nbd') { $options = "<select name='rootfstype' size='4' class='rootfs_form_selectbox'>\n\t\t\t\t\t<option value='nbd' selected><b>nbd://" . $rbs_data['nbdserverip'] . ":</b></option>\n\t\t\t\t\t<option value=''>---------------------------------</option>\n\t\t\t\t\t<option value='nfs'>nfs://" . $rbs_data['nfsserverip'] . ":/" . $rbs_data['exportpath'] . "</option>\n\t\t\t\t\t<option value='dnbd'>dnbd://" . $rbs_data['nbdserverip'] . ":</option>\n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='hidden' name='oldrootfstype' value='" . $gbm['rootfstype'] . "'>"; } if ($gbm['rootfstype'] == 'dnbd') {
/** * @see SugarView::display() */ public function display() { global $mod_strings; $ss = new Sugar_Smarty(); $ss->assign("MOD", $GLOBALS['mod_strings']); $ss->assign("INSTRUCTION", "<h1>{$mod_strings['LNK_BROWSER']}</h1>"); //tree header. $doctree = new Tree('doctree'); $doctree->tree_style = 'include/ytree/TreeView/css/default/tree.css'; $doctree->set_param('module', 'xeBayCategories'); $nodes = get_node_data(array('TREE' => array('depth' => 0)), true); // $nodes = get_category_nodes($href_string); // $nodes = $this->get_test_nodes($href_string); foreach ($nodes as $node) { $doctree->add_node($node); } $ss->assign("TREEHEADER", $doctree->generate_header()); $ss->assign("TREEINSTANCE", $doctree->generate_nodes_array()); $site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n"; $ss->assign("SITEURL", $site_data); $javascript = <<<EOQ EOQ; $ss->assign("JAVASCRIPT", $javascript); echo $ss->fetch("modules/xeBayCategories/tpls/browser.tpl"); }
$hostDN = $exp[0]; $hostname = $exp[1]; print_r($hostDN); echo "<br>"; print_r($hostname); echo "<br><br>"; # IP Adresse nicht verschieben (IPs werden später delegiert) $hoip = get_node_data($hostDN, array("ipaddress")); # print_r($hoip); echo "<br>"; if ($hoip['ipaddress'] != "") { delete_ip_host($hostDN, $auDN); } if (move_subtree($hostDN, "hostname=" . $hostname . ",cn=computers," . $childDN)) { # bestimmte Attribute loeschen ... $newhostDN = "hostname=" . $hostname . ",cn=computers," . $childDN; $dhcp = get_node_data($newhostDN, array("dhcphlpcont")); # print_r($dhcp); echo "<br>"; if ($dhcp['dhcphlpcont'] != "") { $entrydel['dhcphlpcont'] = array(); #$entrydel ['objectclass'] = "dhcpHost"; # print_r($dhcphlpcont); ldap_mod_del($ds, "hostname=" . $hostname . ",cn=computers," . $childDN, $entrydel); } } } } # Domain anlegen falls erforderlich /*if ($childdomain) { $entry['objectclass'] = "domainRelatedObject"; $entry['associateddomain'] = $childdomain;
foreach ($brothers as $item) { if ($leercn == strtolower($item['cn'])) { $i++; $leercn = "leerzeile" . $i; } } } } $meDN = "cn=" . $leercn . "," . $pxeDN; $entry['objectclass'][0] = "MenuEntry"; $entry['objectclass'][1] = "top"; $entry['cn'] = $leercn; $entry['menuposition'] = $menpos; $entry['kernel'] = "menu.c32"; # Submenulink auf sich selbst $pxedata = get_node_data($pxeDN, array("filename")); $entry['submenulink'] = "self"; # wieder führende Nullen weg für increment_menpos $pos = preg_replace('/0([0-9])/', '$1', $menpos); increment_menupositions($pxeDN, $pos); # andere jeweils um 1 erhöhen if (ldap_add($ds, $meDN, $entry)) { $mesg .= "Leerzeile erfolgeich an Position " . $menpos . " eingetragen"; } else { $mesg .= "Fehler beim eintragen der Leerzeile!"; } $url = "pxe_bootmenue.php?dn=" . $pxeDN . "&mnr=" . $mnr . "&sbmnr=" . $sbmnr . "&mcnr=" . $mcnr; } elseif ($typ == "submenu" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "leer") { } $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br>\t\t\t\t\n\t\t\tFalls nicht, klicken Sie hier <a href=" . $url . " style='publink'>back</a>"; redirect($seconds, $url, $mesg, $addSessionId = TRUE);
$exp_automove = explode("_", $automove); $target_audn = $exp_automove[0]; $target_zone = $exp_automove[1]; $target_ou = ldap_explode_dn($target_audn, 1); #echo "$target_audn<br>"; #echo "$target_zone<br>"; $mesg .= "<br>Clients nach AU <b>{$target_ou['0']}</b> verschieben:<br><br>"; foreach ($hostsmove as $hostname) { $selfhost = "HostName={$hostname},cn=computers,{$auDN}"; $found_hostdn = return_zone_hostdn($target_zone, $hostname); #echo "$found_hostdn<br>"; if (!$found_hostdn || $found_hostdn == $selfhost) { #echo "$selfhost<br>"; #echo "$found_hostdn<br>"; $attributes = array("hwaddress", "description", "geolocation", "geoattribut", "dhcphlpcont", "dhcpoptfixed-address", "hlprbservice", "dhcpoptnext-server", "dhcpoptfilename"); $host_data = get_node_data($selfhost, $attributes); #print_r($host_data); echo "<br><br>"; $newhost = array(); $newhost['objectclass'][] = "top"; $newhost['objectclass'][] = "Host"; $newhost['objectclass'][] = "dhcpHost"; $newhost['objectclass'][] = "dhcpOptions"; $newhost['hostname'] = $hostname; $newhost['domainname'] = $target_zone; $standard_atts = array("hwaddress", "description", "geolocation", "geoattribut"); foreach ($standard_atts as $st_att) { if ($host_data[$st_att]) { $newhost[$st_att] = $host_data[$st_att]; } } if ($host_data['dhcphlpcont']) {
$sbmnr = -1; ################################################################################### $mnr = $_GET['mnr']; #$sbmnr = $_GET['sbmnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### $template->assign(array("SUBNETDN" => "", "CN" => "", "NETMASK" => "", "DHCPADDON" => "", "DESCRIPTION" => "", "ALLOW" => "", "DENY" => "", "IGNORE" => "", "DEFAULTLEASE" => "", "MAXLEASE" => "", "BROADCAST" => "", "ROUTERS" => "", "DOMAINNAME" => "", "DOMAINNAMESERVERS" => "", "UCSELECT", "NEXTSERVER" => "", "FILENAME" => "", "OPTGENERIC" => "", "MNR" => $mnr, "SBMNR" => $sbmnr, "MCNR" => $mcnr)); # DHCP Subnet Daten $attributes = array("dn", "cn", "dhcpoptnetmask", "dhcphlpcont", "description", "dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptallow", "dhcpoptdeny", "dhcpoptignore", "hlprbservice", "dhcpoptnext-server", "dhcpoptfilename", "dhcpoptbroadcast-address", "dhcpoptdomain-name", "dhcpoptdomain-name-servers", "dhcpoptgeneric", "dhcpoptrouters", "dhcpoptget-lease-hostnames", "dhcppermittedclients"); $subnet_data = get_node_data($dhcpsubnetDN, $attributes); #print_r($subnet_data); # DHCP Data one scope up (Global) $global_options = array("dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptallow", "dhcpoptdeny", "dhcpoptignore", "hlprbservice", "dhcpoptnext-server", "dhcpoptfilename", "dhcpoptdomain-name", "dhcpoptdomain-name-servers", "dhcpoptgeneric", "dhcpoptget-lease-hostnames", "dhcppermittedclients"); $global_data = get_node_data($subnet_data['dhcphlpcont'], $global_options); # DHCP Service Eintrag if ($subnet_data['dhcphlpcont']) { $dhcpsrv_checkbox = "<input type='checkbox' name='dhcpservice' value= '" . $DHCP_SERVICE . "'checked {$form_element}>"; $dhcpsrv_radio = "<input type='radio' name='dhcpservice' value='" . $DHCP_SERVICE . "' checked> ja \n\t\t\t\t\t\t\t<input type='radio' name='dhcpservice' value=''> nein"; } else { $dhcpsrv_checkbox = "<input type='checkbox' name='dhcpservice' value= '" . $DHCP_SERVICE . "' {$form_element}>"; $dhcpsrv_radio = "<input type='radio' name='dhcpservice' value='" . $DHCP_SERVICE . "'> ja \n\t\t\t\t\t\t\t<input type='radio' name='dhcpservice' value='' checked> nein"; } # Subnet Domain Zuordnung $all_childs = get_childau_sub($auDN, array("dn", "ou", "maxipblock", "associateddomain")); $childs = get_subnet_childaus($all_childs, $subnet_data['cn']); foreach ($childs as $au) { $subnet_domains[] = $au['zone']; } $subnet_domains = array_unique($subnet_domains);
$mnr = -1; $sbmnr = -1; $mcnr = -1; ################################################################################### $mnr = $_GET['mnr']; $sbmnr = $_GET['sbmnr']; $mcnr = $_GET['mcnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); ################################################################################### $pxeDN = $_GET['dn']; $hostdn = $_GET['hostdn']; $hostdnarray = ldap_explode_dn($hostdn, 1); $attributes = array("dn", "cn", "rbservicedn", "filename", "timerange", "kbdmap", "menumasterpasswd", "menutitle"); $pxe = get_node_data($pxeDN, $attributes); #print_r($pxe); $expcn = explode('_', $pxe['cn']); $name = array_slice($expcn, 1); $pxecn = implode('_', $name); # Bootmenü Einträge $menuentries = get_menuentries($pxeDN, array("dn", "menuposition", "label", "menulabel", "menudefault", "menupasswd", "menuhide")); # print_r($menuentries); echo "<br>"; $maxpos = count($menuentries) + 1; ################################################ # Bootmenü Einträge $template->define_dynamic("Bootmenu", "Webseite"); $template->assign(array("PXECN" => $pxecn, "HOSTDN" => $hostdn, "HOST" => $hostdnarray[0], "SBMNR" => $sbmnr, "MENDN" => "", "MENULABEL" => "", "ANZEIGE" => "Kein Bootmenü Eintrag angelegt", "MEDEF" => "", "MEPWD" => "", "MEHIDE" => "", "BGCDEF" => "", "POSITION" => "")); foreach ($menuentries as $me) { $anzeige = ""; if ($me['label'] != "" && $me['menulabel'] == "") {
# DHCP Pools Daten holen $attributes = array("dn", "cn", "dhcphlpcont", "dhcprange", "description", "dhcpstatements", "dhcpoptallow", "dhcpoptdefault-lease-time", "dhcpoptdeny", "dhcpoptignore", "dhcpoptmax-lease-time", "dhcpoptgeneric", "hlprbservice", "dhcpoptfilename", "dhcpoptnext-server", "dhcppermittedclients"); $pools = get_dhcppools($auDN, $attributes); $scope_attributes = array("dn", "cn", "dhcphlpcont", "dhcpstatements", "dhcpoptallow", "dhcpoptdeny", "dhcpoptignore", "dhcpoptdefault-lease-time", "dhcpoptmax-lease-time", "dhcpoptgeneric", "hlprbservice", "dhcpoptfilename", "dhcpoptnext-server", "dhcppermittedclients"); $global_data = get_node_data($DHCP_SERVICE, $scope_attributes); #print_r($pools); if (count($pools) == 0) { redirect(0, "dhcpnopool.php?mnr=" . $mnr, "", $addSessionId = TRUE); die; } $template->assign(array("POOLDN" => "", "CN" => "", "SUBNETDN" => "", "SUBNET" => "", "IPRANGES" => "", "DESCRIPTION" => "", "STATEMENTS" => "", "ALLOW" => "", "DENY" => "", "IGNORE" => "", "RBS" => "", "RBSRV" => "", "RBSSELECT" => "", "DEFAULTLEASE" => "", "MAXLEASE" => "", "MNR" => $mnr)); $template->define_dynamic("Dhcppools", "Webseite"); $pools = array_natsort($pools, "dhcphlpcont", "dhcphlpcont"); # Für jeden Pool ... foreach ($pools as $pool) { $subnet_data = get_node_data($pool['dhcphlpcont'], $scope_attributes); # DHCP Subnet des Pools if ($pool['dhcphlpcont']) { $subnetexp = ldap_explode_dn($pool['dhcphlpcont'], 1); $subnetdnexp = ldap_explode_dn($pool['dhcphlpcont'], 0); $subnetauexp = array_slice($subnetdnexp, 3); $subnetau = implode(',', $subnetauexp); $subnet = $subnetexp[0]; } else { $subnet = "<b>Pool nicht aktiv!</b>"; } $poollink = "<a href='dhcppool_one.php?dn=" . $pool[dn] . "&mnr=" . $mnr . "&url=dhcppools.php' class='headerlink'><b>>> Pool verwalten</b></a> "; # DHCP Ranges $ipranges = ""; if (count($pool['dhcprange']) != 0) { if (count($pool['dhcprange']) > 1) {
function delete_host($hostDN) { global $ds, $suffix, $auDN, $ldapError; $hostdata = get_node_data($hostDN, array("hwaddress", "ipaddress")); # IP Adresse freigeben if ($hostdata['ipaddress'] != "") { delete_ip_host($hostDN, $auDN); } if (dive_into_tree_del($hostDN, "")) { # alle DN Objekte in denen Rechner stand ebenfalls löschen # Member in Groups $groups = get_groups_member($auDN, array("dn", "cn"), $hostDN); # echo "Rechner aus den Gruppen entfernen: <br>"; print_r($groups); echo "<br>"; if (count($groups) != 0) { $entrydel['member'] = $hostDN; foreach ($groups as $group) { echo "Entferne gelöschten Rechner aus Gruppe <b>" . $group['cn'] . "</b> <br>"; $resultG = ldap_mod_del($ds, $group['dn'], $entrydel); # Filename in Gruppen-PXEs $pxes = get_pxeconfigs($group['dn'], array("dn", "cn")); if (count($pxes) != 0 && $hostdata['hwaddress'] != "") { foreach ($pxes as $pxe) { $delfilename['filename'] = "01-" . $hostdata['hwaddress']; $resultP = ldap_mod_del($ds, $pxe['dn'], $delfilename); echo "Entferne MAC des gelöschten Rechners aus Gruppen-PXE <b>" . $pxe['cn'] . "</b> <br>"; } } } } # DHCP, DNS, RBS Server ... noch todo # ... return 1; } else { return 0; } }
$mnr = 0; $sbmnr = -1; ################################################################################### $mnr = $_GET['mnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### $template->assign(array("DHCPDN" => "", "CN" => "", "PRIMARY" => "", "SECONDARY" => "", "DESCRIPTION" => "", "STATEMENTS" => "", "FAILOVERPEER" => "", "ALLOW" => "", "DENY" => "", "IGNORE" => "", "DDNSUPDATE" => "", "DEFAULTLEASE" => "", "MAXLEASE" => "", "USEHOSTDCL" => "", "DOMAINNAME" => "", "DOMAINNAMESERVERS" => "", "MAXMESSIZE" => "", "NTPSERVERS" => "", "OPTGENERIC" => "", "OPTDEF" => "", "OPTDEFINITION" => "", "DHCPOFFERNOWDN" => "", "DHCPOFFERNOW" => "", "SUBNET" => "keine Subnetze zugewiesen", "NETMASK" => "", "SUBNETAU" => "")); # LEASE Times Select $leasetimes = array(array("600", "10 min"), array("900", "15 min"), array("1800", "30 min"), array("3600", "1 h"), array("7200", "2 h"), array("18000", "5 h"), array("36000", "10 h"), array("86400", "1 Tag"), array("172800", "2 Tage"), array("345600", "4 Tage")); # DHCP Service Daten $dhcpsv_array = get_dhcpservices($auDN, array("dn", "cn")); $dhcpserviceDN = $dhcpsv_array[0]['dn']; $attributes = array("dn", "cn", "dhcpprimarydn", "dhcpsecondarydn", "description", "dhcpofferdn", "dhcpstatements", "dhcpfailoverpeer", "dhcpoptallow", "dhcpoptddns-update-style", "dhcpoptdefault-lease-time", "dhcpoptdeny", "dhcpoptfilename", "dhcpoptignore", "dhcppermittedclients", "dhcpoptmax-lease-time", "dhcpoptnext-server", "optiondefinition", "dhcpoptuse-host-decl-names", "dhcpoptbroadcast-address", "dhcpoptdhcp-max-message-size", "dhcpoptdomain-name", "dhcpoptdomain-name-servers", "dhcpoptgeneric", "dhcpoptntp-servers", "dhcpoptroot-path", "dhcpoptrouters"); $dhcpsv_data = get_node_data($dhcpserviceDN, $attributes); #print_r($dhcpsv_data); # DHCP Service Anbieten # momentanes Offer # todo: falls dhcpofferDN leer dann standardwert AU teilbaum $offerexp = ldap_explode_dn($dhcpsv_data['dhcpofferdn'], 1); $dhcpoffernow = $offerexp[0]; # alternative Offers $expdn = ldap_explode_dn($auDN, 0); # Mit Merkmalen $expdn = array_slice($expdn, 1); $expou = ldap_explode_dn($auDN, 1); # nur Werte $expou = array_slice($expou, 1, -3); #print_r($expou); echo "<br>"; #print_r($expdn); echo "<br>";
$pxemac = str_replace(":", "-", $macdata['hwaddress']); $filenames[] = "01-" . $pxemac; } } if (count($members) == 1) { $macdata = get_node_data($members['member'], array("hwaddress")); $pxemac = str_replace(":", "-", $macdata['hwaddress']); $filenames[] = "01-" . $pxemac; } } echo "filenames: "; print_r($filenames); echo "<br>"; #$ldapuri = LDAP_HOST."/dn=cn=computers,".$auDN; # rbsDN bestimmen $rbs = get_node_data($targetDN, array("hlprbservice")); $rbsDN = $rbs['hlprbservice']; print_r($rbsDN); if (add_pxe($pxeDN, $pxecn, $rbsDN, $pxetimerange, $pxeattribs, $filenames, $conffile)) { $mesg .= "<br>Neues PXE Boot Menü erfolgreich angelegt<br>"; if ($targettype == "computers") { $mnr = 1; } if ($targettype == "groups") { $mnr = 2; } $url = "pxe.php?dn=" . $pxeDN . "&mnr=" . $mnr; } else { $mesg .= "<br>Fehler beim anlegen des PXE Boot Menüs!<br>"; } }
# Dateiname und evtl. Pfad des Templates für die Webseite $webseite = "rbshost.dwt"; include 'computers_header.inc.php'; $mnr = 0; $sbmnr = -1; $mcnr = -1; ################################################################################### $sbmnr = $_GET['sbmnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); ################################################################################### $hostDN = "HostName=" . $_GET['host'] . ",cn=computers," . $auDN; # Rechner Daten $attributes = array("hostname", "domainname", "ipaddress", "hwaddress", "description", "hlprbservice", "dhcphlpcont", "dhcpoptfixed-address", "dhcpopthardware", "dhcpoptfilename", "dhcpoptnext-server", "hw-mouse", "hw-graphic", "hw-monitor"); $host = get_node_data($hostDN, $attributes); $rbsDN = $host['hlprbservice']; if ($rbsDN) { $exprbs = ldap_explode_dn($rbsDN, 1); # Rechnerspezifische PXEs $hostpxeconfigs = get_pxeconfigs2($hostDN, array("dn", "cn", "description", "timerange")); $pxehost = "<tr>\n\t\t\t\t\t\t<td colspan='3' width='50%' class='tab_h'>\n\t\t\t\t\t\t<b>Client <code class='font_object'> " . $host['hostname'] . " \n\t\t\t\t\t\t</code> - spezifische PXE Konfigurationen (Bootmenüs)</b></td>\n\t\t\t\t\t</tr>"; if (count($hostpxeconfigs) != 0) { for ($i = 0; $i < count($hostpxeconfigs); $i++) { $pxelink = "<a href='pxe.php?dn=" . $hostpxeconfigs[$i]['dn'] . "&mnr=1&sbmnr=" . $sbmnr . "&mcnr=" . $i . "&nodedn=" . $hostDN . "' class='headerlink'>" . $hostpxeconfigs[$i]['cn'] . "</a>"; $trange = ""; if (count($hostpxeconfigs[$i]['timerange']) > 1) { foreach ($hostpxeconfigs[$i]['timerange'] as $tr) { $exptime = array_merge(explode('_', $tr), array($hostpxeconfigs[$i]['cn'])); $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht
$webseite = "rbservice.dwt"; include 'rbs_header.inc.php'; ################################################################################### $mnr = 0; $sbmnr = -1; $mnr = $_GET['mnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createRBSMenu($rollen, $mnr, $auDN, $sbmnr); ################################################################################### $rbsDN = $_GET['rbsdn']; // print $auDN; $template->assign(array("RBSDN" => "", "CN" => "", "RBSDESC" => "", "RBSMODE" => "", "TFTP" => "", "TFTPIP" => "", "TFTPROOT" => "", "INITBOOTFILE" => "", "RBSOFFERNOWDN" => "", "RBSOFFERNOW" => "")); # RBS Daten $attributes = array("dn", "cn", "rbsofferdn", "initbootfile", "tftpserverip", "tftproot", "tftpkernelpath", "tftpclientconfpath", "tftppxepath", "description", "rbsmode"); $rbs_data = get_node_data($rbsDN, $attributes); $expcn = explode('_', $rbs_data['cn']); $name = array_slice($expcn, 1); $rbscn = implode('_', $name); # RBS Nutzer # momentanes Offer $offerexp = ldap_explode_dn($rbs_data['rbsofferdn'], 1); $rbsoffernow = $offerexp[0]; # alternative Offers $expdn = ldap_explode_dn($auDN, 0); # Mit Merkmalen $expdn = array_slice($expdn, 1); $expou = ldap_explode_dn($auDN, 1); # nur Werte $expou = array_slice($expou, 1, -3); #print_r($expou); echo "<br>";