From 12183ece8e4cb1bb81072a72f696572c8b3a07ee Mon Sep 17 00:00:00 2001 From: Tarik Gasmi Date: Tue, 18 Sep 2007 15:18:38 +0000 Subject: ldap-site-mngmt: actualized WebIF and DHCPConfig Generationscript git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1340 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../generation-scripts/dhcp_generate.pl | 426 ++++++++++++++------- ldap-site-mngmt/webinterface/au/au.dwt | 79 ++++ ldap-site-mngmt/webinterface/au/au_childs.dwt | 37 ++ ldap-site-mngmt/webinterface/au/au_show.dwt | 84 ++++ ldap-site-mngmt/webinterface/au/au_start.dwt | 32 ++ ldap-site-mngmt/webinterface/au/child_au.dwt | 102 +++++ ldap-site-mngmt/webinterface/au/menu.dwt | 27 ++ ldap-site-mngmt/webinterface/au/new_child.dwt | 123 ++++++ .../webinterface/computers/computers_menu.php | 33 +- .../webinterface/computers/computers_start.dwt | 4 +- .../webinterface/computers/delete_confirm.php | 2 + .../webinterface/computers/dhcphost.dwt | 15 + .../webinterface/computers/dhcphost.php | 18 +- .../webinterface/computers/dhcphost_change.php | 101 ++++- .../webinterface/computers/groupoverview.php | 3 +- ldap-site-mngmt/webinterface/computers/host.dwt | 1 + .../webinterface/computers/host_add.php | 6 +- .../webinterface/computers/host_change.php | 14 +- .../webinterface/computers/host_delete.php | 5 +- .../webinterface/computers/new_host.dwt | 9 + .../webinterface/computers/new_host.php | 11 + ldap-site-mngmt/webinterface/computers/new_pxe.php | 2 +- ldap-site-mngmt/webinterface/computers/rbshost.php | 71 ++-- .../webinterface/computers/rbshost_change.php | 6 +- ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt | 73 +--- ldap-site-mngmt/webinterface/dhcp/dhcppool.php | 125 ++++-- ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php | 88 +++-- .../webinterface/dhcp/dhcppools_change.php | 55 ++- ldap-site-mngmt/webinterface/dhcp/dhcpservice.php | 2 +- .../webinterface/dhcp/dhcpservice_change.php | 35 +- ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt | 38 +- .../webinterface/dhcp/dhcpsubnet_change.php | 2 +- .../webinterface/dhcp/dhcpsubnet_delete.php | 2 +- .../webinterface/dhcp/new_dhcpsubnet.dwt | 26 +- ldap-site-mngmt/webinterface/dns/dns.php | 2 +- ldap-site-mngmt/webinterface/dns/dns_inwork.dwt | 15 + ldap-site-mngmt/webinterface/dns/dns_menu.php | 25 +- ldap-site-mngmt/webinterface/ip/ip_deleg.php | 2 +- ldap-site-mngmt/webinterface/ip/ip_menu.php | 6 +- .../webinterface/ip/ip_rechner_change.php | 9 +- ldap-site-mngmt/webinterface/ip/ip_start.dwt | 4 +- .../webinterface/lib/au_management_functions.php | 1 + ldap-site-mngmt/webinterface/lib/config.inc.php | 2 +- .../webinterface/lib/dhcp_management_functions.php | 57 ++- .../webinterface/lib/host_management_functions.php | 24 +- .../webinterface/lib/rbs_management_functions.php | 22 +- .../webinterface/rbs/rbservice_change.php | 12 +- ldap-site-mngmt/webinterface/roles/roles_menu.php | 32 +- ldap-site-mngmt/webinterface/roles/roles_start.dwt | 4 +- .../webinterface/standard_header.inc.php | 42 +- 50 files changed, 1410 insertions(+), 506 deletions(-) create mode 100755 ldap-site-mngmt/webinterface/au/au.dwt create mode 100755 ldap-site-mngmt/webinterface/au/au_childs.dwt create mode 100755 ldap-site-mngmt/webinterface/au/au_show.dwt create mode 100755 ldap-site-mngmt/webinterface/au/au_start.dwt create mode 100755 ldap-site-mngmt/webinterface/au/child_au.dwt create mode 100755 ldap-site-mngmt/webinterface/au/menu.dwt create mode 100755 ldap-site-mngmt/webinterface/au/new_child.dwt create mode 100755 ldap-site-mngmt/webinterface/dns/dns_inwork.dwt (limited to 'ldap-site-mngmt') diff --git a/ldap-site-mngmt/generation-scripts/dhcp_generate.pl b/ldap-site-mngmt/generation-scripts/dhcp_generate.pl index f8c2cfb6..5623cc96 100644 --- a/ldap-site-mngmt/generation-scripts/dhcp_generate.pl +++ b/ldap-site-mngmt/generation-scripts/dhcp_generate.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # Generate ISC DHCP Configuration File -# +# # Reads DHCP Config Data form LDAP Directory and generates an # include file "dhcp.master.inc" included in dhcpd.conf with: # - Definitions of User-defined DHCP Options @@ -14,26 +14,47 @@ use strict; use warnings; #use diagnostics; +#use LSM::dhcpgen; use Net::LDAP; use Net::LDAP::LDIF; +use Getopt::Std; + +#$Getopt::Std::STANDARD_HELP_VERSION; +our $VERSION = "1.10"; + # Configuration Variables for Perl-Script -our ( $ldaphost, $basedn, $userdn, $passwd, $dhcpdn, $dhcpdconfpath, $dhcpdconffile ); +our ( $ldaphost, $basedn, $userdn, $passwd, $dhcpdn, $dhcpdconfpath, $dhcpdconffile, $opt_a, $opt_h, $opt_v ); # Read Configuration Variables ... require "dhcpgen.conf.pl"; -#use dhcpgenconfig; -my ( $ldap, $mesg, $mesg2 ); +my ( $ldap, $mesg, $failoverpeer, @searchbases ); + +#use LSM::dhcpgen; +my $acteptime = time(); +my $acttime = localtime(); +getopts('ahv'); + + +if ($opt_h){ print "HILFE Text\n"; exit (1); } +if ($opt_a){ print "Generate all Include Files:\n\n";} + # Bind with LDAP Server -$ldap = Net::LDAP->new( $ldaphost ) or die "$@"; +$ldap = Net::LDAP->new( $ldaphost, debug => 0 ) or die "$@"; $mesg = $ldap->bind( $userdn, password => $passwd ); $mesg->code && die $mesg->error; +my @dhcpunits = get_dhcpunits(); +@searchbases = searchbases($acteptime); +#print @searchbases; mkdir "$dhcpdconfpath/includes"; -open DATEI, "> $dhcpdconfpath/includes/dhcp.master.inc"; + +################################################# +# DHCP MASTER INCLUDE FILE +my $writemaster; my @dhcpdnarray = split /,/,$dhcpdn; my $aurdn = $dhcpdnarray[2]; my @auarray = split /=/,$aurdn; @@ -42,141 +63,103 @@ my $srvrdn = $dhcpdnarray[0]; my @srvarray = split /=/,$srvrdn; my $srv = $srvarray[1]; -# File Header (general Informations) -printf DATEI "##################### DHCP SERVICE CONFIG ############################################ \n#\n"; -printf DATEI "# DHCP Service: \t\t %s \n", $srv; -printf DATEI "# Administrative Unit: \t\t %s \n#\n", $au; -printf DATEI "# [ %s ]\n#\n", $dhcpdn; -printf DATEI "######################################################################################## \n\n\n"; +# File Header +$writemaster .= "# DHCP Config Master Include File \"dhcp.master.inc\"\n# DHCP Service: $srv\n# AU: $au\n# (DN: $dhcpdn)\n# generated: $acttime\n# Unix: $acteptime\n\n"; +# LDAP Search: DHCP Service Object +my $dhcpsrventry = get_dhcpservice_object($ldap,$dhcpdn); -# Ldapsearch on DHCP Service Object -$mesg = $ldap->search(base => $dhcpdn, - scope => 'base', - filter => '(objectclass=dhcpService)'); -#Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); -$mesg->code && die $mesg->error; -my $dhcpservice = $mesg->count or die "DHCP Service Object does not exist in the System"; -my $dhcpsrventry = $mesg->entry(0); - -printf DATEI "######################\n# Option Definitions\n######################\n\n"; -# write Definitions of user/self-defined DHCP Options -if ($dhcpsrventry->exists( 'OptionDefinition' )) { - my @optdefinitions = $dhcpsrventry->get_value( 'OptionDefinition' ); - foreach my $optdef ( @optdefinitions) { - printf DATEI "%s\n", $optdef; +# Definitions for user/self-defined DHCP Options +$writemaster .= "\n######################\n# Option Definitions\n######################\n\n"; +if ($dhcpsrventry->exists('OptionDefinition')) { + my @optdefinitions = $dhcpsrventry->get_value('OptionDefinition'); + foreach my $optdef (@optdefinitions) { + $writemaster .= "$optdef\n"; } } -# Failover Information of DHCP Service -my $failoverpeer; + +# Failover Information of DHCP Service, needed for DHCP Pool Declarations later +#my $failoverpeer; if ($dhcpsrventry->exists( 'dhcpFailoverPeer' )) { $failoverpeer = $dhcpsrventry->get_value( 'dhcpFailoverPeer' ); } - +# Global DHCP Options (global Scope) +$writemaster .= "\n\n######################\n# Global Options\n######################\n\n"; my $indent = ""; -printf DATEI "\n\n######################\n# Global Options\n######################\n\n"; -# write DHCP Options in global Scope -dhcpoptions( $dhcpsrventry, $indent ); -printf DATEI "\n"; - +$writemaster .= dhcpoptions( $dhcpsrventry, $indent ); +# Include Directives (one for each DHCP Unit in LDAP Database) +$writemaster .= "\n\n######################\n# Includes\n######################\n\n"; +foreach my $dhcpunit ( @dhcpunits ){ + $writemaster .= "include \"$dhcpdconfpath/includes/dhcp.".lc $dhcpunit->get_value('ou').".inc\";\n"; + #$writemaster .= "include \"includes/dhcp.".lc $dhcpunit->get_value('ou').".inc\";\n"; +} -#################################### -# DHCP SUBNETS - -# ldapsearch on Subnet Objects referencing to DHCP Service Object -$mesg = $ldap->search(base=>$basedn, - scope => 'sub', - filter => '(&(objectclass=dhcpSubnet)(dhcphlpcont:dn:='.$dhcpdn.'))'); -#Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); -$mesg->code && die $mesg->error; -my @subnets = $mesg->sorted('cn'); +# Write File +print "Generate DHCP Master Include File\n"; +open DATEI, "> $dhcpdconfpath/includes/dhcp.master.inc"; +print DATEI $writemaster; +close DATEI; +# Writing DHCP MASTER INCLUDE FILE Completed +################################################# -# write Subnet Declarations -printf DATEI "\n\n######################\n# DHCP Subnets\n######################\n\n"; -foreach my $subnetentry ( @subnets ) { - my $subnetdn = $subnetentry->dn; - my $subnet = $subnetentry->get_value( 'cn' ); - my $netmask = $subnetentry->get_value( 'dhcpoptnetmask' ); - printf DATEI "subnet %s netmask %s {\n", $subnet, $netmask; - # write DHCP Options in Subnet Scope - my $optindent = " "; - dhcpoptions($subnetentry,$optindent); +################################################# +# DHCP INCLUDE FILES, one for each AdministrativeUnit +foreach my $searchbase ( @searchbases ){ - # write Pool Declarations in Subnet Declaration - # ldapsearch on Pool Objects referencing to DHCP Subnet Object - $mesg2 = $ldap->search(base=>$basedn, - scope => 'sub', - filter => '(&(objectclass=dhcpPool)(dhcphlpcont:dn:='.$subnetdn.'))'); - #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); - $mesg2->code && die $mesg2->error; - my @pools = $mesg2->sorted('cn'); + my $writeinc; + my $lastchange; + my $includedatei = lc "dhcp.$searchbase->{ou}.inc"; + my $audn = $searchbase->{dn}; + my $dhcpmtime = $searchbase->{dhcpmtime}; + #print "$includedatei\n"; + #print "$audn\n"; - foreach my $poolentry ( @pools ) { - printf DATEI "%spool {\n", $optindent; - # write DHCP Options in Pool Scope - my $poolindent = " "; - if ( $failoverpeer ){ - printf DATEI "%sfailover peer \"%s\";\n", $poolindent, $failoverpeer; - printf DATEI "%sdeny dynamic bootp clients;\n", $poolindent; - } - if ($poolentry->exists( 'dhcpRange' )) { - #foreach my $ranges ( @) { - my @range = split /_/,$poolentry->get_value( 'dhcpRange' ); - printf DATEI "%srange %s %s;\n", $poolindent, $range[0], $range[1]; - } - dhcpoptions($poolentry,$poolindent); - printf DATEI "%s}\n", $optindent; + # Include File Header + $writeinc .= "# DHCP Config Include File \"$includedatei\"\n# AU: $searchbase->{ou}\n# (DN: $audn)\n# generated: $acttime\n# Unix: $acteptime\n\n"; + + ########################### + # DHCP SUBNETS (and POOLS) + # LDAP Search: DHCP Subnet Objects referencing to DHCP Service Object + my @subnets = get_dhcpsubnet_objects($ldap,$audn,$dhcpdn); + # write Subnet declarations + $writeinc .= "\n\n######################\n# DHCP Subnets\n######################\n\n"; + foreach my $subnetentry ( @subnets ) { + $writeinc .= dhcpsubnet($subnetentry); } - # close Subnet Declaration - printf DATEI "}\n\n"; -} - - -#################################### -# DHCP HOSTS - -# ldapsearch on DHCP Host Objects referencing to DHCP Service Object -$mesg = $ldap->search(base=>$basedn, - scope => 'sub', - filter => '(&(objectclass=dhcpHost)(dhcphlpcont:dn:='.$dhcpdn.'))'); - #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); - $mesg->code && die $mesg->error; -my @hosts = $mesg->sorted('dn'); - -# write Host Declarations -printf DATEI "\n\n######################\n# DHCP Hosts\n######################\n"; - -# grouping Hosts by Administrative Units (AU) -my $hostau = ""; -foreach my $hostentry ( @hosts ) { - - # für jede AU eigener Abschnitt (oder abzweigung in eigene includedatei ...) - my $hostdn = $hostentry->dn(); - my @dnarray = split /,/,$hostdn; - my @auarray = split /=/,$dnarray[2]; - my $hostauactual = $auarray[1]; - if ( $hostau ne $hostauactual) { - # hier neues Datei Handle und neuer Pfad falls eigene includedatei ... - printf DATEI "\n################################################\n# AU: %s \n", $hostauactual; - $hostau = $hostauactual; + ########################### + # DHCP HOSTS + # LDAP Search: DHCP Host Objects referencing to DHCP Service Object + my @hosts = get_dhcphost_objects($ldap,$audn,$dhcpdn); + # write Host Declarations + $writeinc .= "\n\n######################\n# DHCP Hosts\n######################\n"; + foreach my $hostentry ( @hosts ) { + $writeinc .= dhcphost($hostentry); } - # DHCP Options in Host Scope - dhcphost($hostentry); + + # Write File + if ($dhcpmtime == 0){ $lastchange = "not changed yet!"; } + else{ $lastchange = "last change: ".localtime($dhcpmtime); } + print "Generate Include-File $includedatei ($lastchange)\n"; + open DATEI, "> $dhcpdconfpath/includes/$includedatei"; + print DATEI $writeinc; + close DATEI; } +# Writing DHCP INCLUDE FILES Completed +####################################### -close DATEI; - # LDAP unbind $mesg = $ldap->unbind; + exit (0); + ################################################################################################### # Subroutines ############### @@ -185,9 +168,10 @@ exit (0); sub dhcpoptions { my $entry = shift; my $indent = shift; - my @atts = $entry->attributes; + my @atts = $entry->attributes; + my $output = ""; - # DHCP Optionen mit 'option' vorne dran + # DHCP Option beginning with with 'option' my @options1 = grep /dhcpopt/, @atts; #printf "options: @options1\n"; foreach my $option ( @options1 ){ @@ -195,13 +179,13 @@ sub dhcpoptions { my $value = $entry->get_value( $option ); $option =~ s/dhcpopt//; if ( $option eq "Domain-name"){ - printf DATEI "%soption %s \"%s\";\n", $indent, lc($option), $value; + $output .= $indent."option ".lc($option)." \"$value\";\n"; }else{ - printf DATEI "%soption %s %s;\n", $indent, lc($option), $value; + $output .= $indent."option ".lc($option)." $value;\n"; } } } - # DHCP Optionen + # DHCP Options without 'option' my @options2 = grep /dhcpOpt/, @atts; #printf "Options: @options2\n"; foreach my $option ( @options2 ){ @@ -209,40 +193,218 @@ sub dhcpoptions { my $value = $entry->get_value( $option ); $option =~ s/dhcpOpt//; if ( $option eq "Filename"){ - printf DATEI "%s%s \"%s\";\n", $indent, lc($option), $value; + $output .= $indent.lc($option)." \"$value\";\n"; }else{ - printf DATEI "%s%s %s;\n", $indent, lc($option), $value; + $output .= $indent.lc($option)." $value;\n"; } } } + + return $output; +} + + +# write DHCP Pool declaration (+ specific Options), Parameter: DHCP Object LDAP Entry +sub dhcppool { + my $entry = shift; + my $indent = shift; + my @atts = $entry->attributes; + my $output = ""; + # open Pool Declaration + $output .= $indent."pool {\n"; + # write DHCP Options in Pool Scope + my $poolindent = $indent." "; + if ( $failoverpeer ){ + $output .= $poolindent."failover peer \"$failoverpeer\";\n"; + $output .= $poolindent."deny dynamic bootp clients;\n"; + } + if ($entry->exists( 'dhcpRange' )) { + #foreach my $ranges ( @) { + my @range = split /_/,$entry->get_value( 'dhcpRange' ); + $output .= $poolindent."range $range[0] $range[1];\n"; + } + $output .= dhcpoptions($entry,$poolindent); + # close Pool Declaration + $output .= "$indent}\n"; + + return $output; } -# write DHCP Host specific Options, Parameter: DHCP Object LDAP Entry +# write DHCP Subnet declaration (specific Options), Parameter: DHCP Object LDAP Entry +sub dhcpsubnet { + my $entry = shift; + my @atts = $entry->attributes; + my $output = ""; + + my $subnetdn = $entry->dn; + my $subnet = $entry->get_value( 'cn' ); + my $netmask = $entry->get_value( 'dhcpoptnetmask' ); + # open Subnet Declaration + $output .= "subnet $subnet netmask $netmask {\n"; + # write DHCP Options in Subnet Scope + my $optindent = " "; + $output .= dhcpoptions($entry,$optindent); + # write Pool Declarations in Subnet Declaration + # ldapsearch on Pool Objects referencing to DHCP Subnet Object + $mesg = $ldap->search(base=>$basedn, + scope => 'sub', + filter => '(&(objectclass=dhcpPool)(dhcphlpcont:dn:='.$subnetdn.'))'); + #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); + $mesg->code && die $mesg->error; + my @pools = $mesg->sorted('cn'); + foreach my $poolentry ( @pools ) { + $output .= dhcppool($poolentry,$optindent); + } + # close Subnet Declaration + $output .= "}\n\n"; + + return $output; +} + + +# write DHCP Host declaration (specific Options), Parameter: DHCP Object LDAP Entry sub dhcphost { my $entry = shift; my @atts = $entry->attributes; + my $output = ""; - printf DATEI "\nhost %s {\n", lc $entry->get_value( 'hostname' ); + $output .= "\nhost ".lc $entry->get_value('hostname')." {\n"; + #printf DATEI "\nhost %s {\n", lc $entry->get_value( 'hostname' ); # Host specific DHCP Options - if ($entry->exists( 'hwaddress' )) { - printf DATEI " hardware ethernet %s;\n", $entry->get_value( 'hwaddress' ); + if ($entry->exists('hwaddress')) { + $output .= " hardware ethernet ".$entry->get_value('hwaddress').";\n"; } - if ($entry->exists( 'dhcpoptfixed-address' )) { + if ($entry->exists('dhcpoptfixed-address')) { if ( $entry->get_value('dhcpoptfixed-address') eq "ip" ){ - my @ip = split /_/, $entry->get_value( 'ipaddress' ); - printf DATEI " fixed-address %s;\n", lc $ip[0]; + my @ip = split /_/, $entry->get_value('ipaddress'); + $output .= " fixed-address ".lc $ip[0].";\n"; } if ( $entry->get_value('dhcpoptfixed-address') eq "hostname" ){ - printf DATEI " fixed-address %s.%s;\n", lc $entry->get_value( 'hostname' ), lc $entry->get_value( 'domainname' ); + $output .= " fixed-address ".lc $entry->get_value('hostname').".".lc $entry->get_value('domainname').";\n"; } } my @hwoptions = grep /Hw-/, @atts; foreach my $hwoption ( @hwoptions ){ - printf DATEI " option %s \"%s\";\n", lc($hwoption), $entry->get_value($hwoption); + $output .= " option ".lc($hwoption)." \"".$entry->get_value($hwoption)."\";\n"; } # remaining DHCP Options my $optindent = " "; - dhcpoptions ($entry, $optindent); - printf DATEI "}\n"; + $output .= dhcpoptions ($entry, $optindent); + $output .= "}\n"; + + return $output; +} + +sub get_dhcpservice_object { + my $ldap = shift; + my $basedn = shift; + # Ldapsearch on DHCP Service Object + + my $mesg = $ldap->search(base => $basedn, + scope => 'base', + filter => '(objectclass=dhcpService)'); + #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); + $mesg->code && die $mesg->error; + my $dhcpservice = $mesg->count or die "DHCP Service Object does not exist in the System"; + my $dhcpsrventry = $mesg->entry(0); + + return $dhcpsrventry; +} + +# all Subnet Objects of one AU Container +sub get_dhcpsubnet_objects { + my $ldap = shift; + my $audn = shift; + my $dhcpdn = shift; + + # ldapsearch on Subnet Objects referencing to DHCP Service Object + $mesg = $ldap->search(base=>"cn=dhcp,".$audn, + scope => 'sub', + filter => '(&(objectclass=dhcpSubnet)(dhcphlpcont:dn:='.$dhcpdn.'))'); + #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); + $mesg->code && die $mesg->error; + my @dhcpsubnets = $mesg->sorted('cn'); + + return @dhcpsubnets; +} + +# all Host Objects of one AU Container +sub get_dhcphost_objects { + my $ldap = shift; + my $audn = shift; + my $dhcpdn = shift; + + # ldapsearch on DHCP Host Objects referencing to DHCP Service Object + $mesg = $ldap->search(base=>"cn=computers,".$audn, + scope => 'sub', + filter => '(&(objectclass=dhcpHost)(dhcphlpcont:dn:='.$dhcpdn.'))'); + #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); + $mesg->code && die $mesg->error; + my @dhcphosts = $mesg->sorted('dn'); + + return @dhcphosts; +} + +# all AU containers +sub get_dhcpunits { + #my $ldap = shift; + #my $basedn = shift; + + # ldapsearch on Subnet Objects referencing to DHCP Service Object + $mesg = $ldap->search(base=>$basedn, + scope => 'sub', + filter => '(objectclass=administrativeUnit)', + #filter => '(&(objectclass=administrativeUnit)(dhcpMTime>='.$yday.'))', + attrs => [ 'ou','dhcpMTime' ] ); + #Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries ); + $mesg->code && die $mesg->error; + my @adminunits = $mesg->entries; + + return @adminunits; +} + + +# Generate Searchbases-Array for AdminUnit-specific LDAP Search on DHCP Objects +sub searchbases { + my $acteptime = shift; ### falls noch plausibiltäts-test: acteptime > dhcpmtime + my $opta = $opt_a; + #print "opt_a: $opta \n"; + my @adunits = get_dhcpunits(); + if ( $opta ){ + # All Admin Units + foreach my $adunit (@adunits){ + push @searchbases, { dn => $adunit->dn, ou => $adunit->get_value('ou'), dhcpmtime => $adunit->get_value('dhcpMTime') }; + } + }else{ + # Only Admin Units which DHCP Data changed since last generation + foreach my $adunit (@adunits){ + my $changetime = "1"; + my $dhandle = 1; + open DAT, "< $dhcpdconfpath/includes/dhcp.".lc $adunit->get_value('ou').".inc" #or open DAT and my $incgen = 1; #or die "Can't open/generate Include File"; + #print $incgen; + or $dhandle = 0; + if ($dhandle){ + while (){ + chomp; + if (/^# Unix: (\S+)/){ $changetime = $1; } + } + close DAT; + } + my $actualize = ""; + if ($adunit->exists( 'dhcpMTime' ) && $adunit->get_value('dhcpMTime') >= $changetime ) { + #printf "%s - %s\n", $adunit->dn, $adunit->get_value('dhcpMTime'); + $actualize = "needs to be actualized\n"; + push @searchbases, { dn => $adunit->dn, ou => $adunit->get_value('ou'), dhcpmtime => $adunit->get_value('dhcpMTime') }; + } + if ($opt_v){ + print $adunit->get_value('ou')."\n"; + print "dhcpmodify: ".$adunit->get_value('dhcpMTime')."\n"; + print "lastchange: $changetime\n"; + print $actualize; + print "------------------------\n"; + } + } + } + return @searchbases; } \ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au.dwt b/ldap-site-mngmt/webinterface/au/au.dwt new file mode 100755 index 00000000..2156b7c0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au.dwt @@ -0,0 +1,79 @@ + + + + {SEITENTITEL} + + + + + + + + + + +
+ + + + + +

Rechner und IP Management

+
+ + + + +
+

Startseite +  >>  {AU}  [ {DOMAIN} ]

+
+
+ + + + +
+ {LOGIN} +
+
+ + + + + +
{MAINMENU}
+ +
+ + + + + + + + + + + +
+ + +
+ + {NAVIGATION} + +
+
+ + +
+ + {HAUPTFENSTER} + +
+
+ + + + diff --git a/ldap-site-mngmt/webinterface/au/au_childs.dwt b/ldap-site-mngmt/webinterface/au/au_childs.dwt new file mode 100755 index 00000000..92b28c2c --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_childs.dwt @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + +

Untergeordnete AUs von -  {AU}  -

+ + + + + + + + + + + + + + + +
Untergeordnete AUDomain
{CHILDOU}  {CHILDDOMAIN}  
+ Zum Verwalten oder Löschen einer untergeordneten AU, wählen Sie links entsprechenden Submenü-Eintrag.
+ Dort können Sie auch den DNS Domainnamen der untergeordneten AU bearbeiten bzw. neu zuordnen (d.h. im
+ DNS der Organisation aufnehmen). +
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_show.dwt b/ldap-site-mngmt/webinterface/au/au_show.dwt new file mode 100755 index 00000000..d48db3f9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_show.dwt @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + +

Administrative Unit -  {AU}  -

Im LDAP Verzeichnis gespeicherte Daten:

+ Sie können den Namen und die Beschreibung bearbeiten. Zur Verwaltung, der ihnen + zugeordneten IP Adressbereiche benutzen Sie bitte das Modul IP Management.
+ Wollen Sie ihren DNS Domainnamen ändern so wenden Sie sich an den Haupt-Administrator + ihrer übergeordneten AU  -  {PARENTAU}   + (Email:  {EMAILMA} ) + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
AttributWert
Name: + + +   +
Bechreibung: + + +   +
DNS Domain:{DOMAIN}  
IP Bereiche:{MIPBS}  
+

Weitere Statistiken zu Ihrer AU:

+ + + + + + + + + + + + + + + + + +
  
Hauptadministratoren:...
Anzahl Rechner:...
.... :...
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_start.dwt b/ldap-site-mngmt/webinterface/au/au_start.dwt new file mode 100755 index 00000000..91ef90d4 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_start.dwt @@ -0,0 +1,32 @@ + + + + + + + + + + + +

Modul - AU Management:

+

Dieses Modul dient der Verwaltung ihrer Abteilung oder Administrativen Einheit + (Administrative Unit - AU).
+ Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:

+
    +
  • Eigene AU

    + Hier erhalten Sie eine Übersicht über Ihre Administrative Unit. Sie können bestimmte + Daten bearbeiten, z.B. den Name(cn) oder die Beschreibung. Zudem können Sie Statistiken + zu Ihrer AU einsehen. + +
  • +
  • Untergeordnete AUs

    + Hier erhalten Sie eine Übersicht Ihrer untergeordneten eigenständigen Administrativen + Einheiten. Sie können diese bearbeiten und löschen. +
  • +
  • Neue untergeordnete AUs

    + Hier können Sie eine neue untergeordnete eigenständigen AU anlegen. +
  • +
+ +
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/child_au.dwt b/ldap-site-mngmt/webinterface/au/child_au.dwt new file mode 100755 index 00000000..0f5a2964 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/child_au.dwt @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

AU  -  {CHILDCN}  -  verwalten:

Daten bearbeiten:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributWert
Eindeutiger Name (ou):
(Teil des dn, ohne Leerzeichen eingeben)  
+ +   +
Name der Abteilung (cn):   + +   +
DNS Domain :   + + + .uni-freiburg.de +
Delegierte IP Bereiche:{MIPBS}  
+

Untergeordnete AU -  {CHILDCN}  - löschen:

+ + + + + + + + + + + + + + + + + + + +
Wählen Sie einen Modus:
+ + Nur die untergeordnete AU löschen (nur eine Ebene).
+ Rechner und DHCP Objekte werden aus dieser in eigene AU integrieren
+ + Komplett löschen: untergeordnete AU und alle darunter angelegten AUs
+ +
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/menu.dwt b/ldap-site-mngmt/webinterface/au/menu.dwt new file mode 100755 index 00000000..b130ebfa --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/menu.dwt @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + {SUB} + + + + + + + + +
{ICON}  + {TEXT_M} 
diff --git a/ldap-site-mngmt/webinterface/au/new_child.dwt b/ldap-site-mngmt/webinterface/au/new_child.dwt new file mode 100755 index 00000000..23c93de1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/new_child.dwt @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Neue untergeordnete AU anlegen:

Notwendige Attribute (müssen angegeben werden):

+ + + + + + + + + + + + + + + + + + +
AttributWert
Eindeutiger Name (ou):
(Teil des dn, ohne Leerzeichen eingeben)  
+   +
MainAdmin neue AU:
(Wählen Sie einen Benutzer aus)
+ +   +

Optionale Attribute:

+ + + + + + + + + + + + + + + + + + + + + +
AttributWert
Name der Abteilung (cn):   + +
DNS Domain :   + + .uni-freiburg.de  +
Beschreibung der AU:   + +

Objekte, die Sie in die neue untergeordnete AU verschieben möchten :

+ + + + + + + + + + + +
ObjektAuswahl
Rechner:
+ (Wählen Sie die zu verschiebenden Rechner aus,
Mehrfachauswahl möglich)
+ +
+
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_menu.php b/ldap-site-mngmt/webinterface/computers/computers_menu.php index 564f9b28..201192ab 100644 --- a/ldap-site-mngmt/webinterface/computers/computers_menu.php +++ b/ldap-site-mngmt/webinterface/computers/computers_menu.php @@ -15,32 +15,27 @@ function createComputersMenu($rollen , $mnr, $auDN, $sbmnr, $mcnr) { array("link" => "groupoverview.php", "text" => "Rechnergruppen", "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), - array("link" => "machineconfig_default.php", - "text" => "Default MachineConfigs", - "zugriff" => array("MainAdmin","HostAdmin")), - array("link" => "new_mcdef.php", - "text" => "Neue MachineConfig", - "zugriff" => array("MainAdmin","HostAdmin")), + #array("link" => "machineconfig_default.php", + # "text" => "Default MachineConfigs", + # "zugriff" => array("MainAdmin","HostAdmin")), + #array("link" => "new_mcdef.php", + # "text" => "Neue MachineConfig", + # "zugriff" => array("MainAdmin","HostAdmin")), array("link" => "new_pxe.php", "text" => "Neues PXE Bootmenü", "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin"))); # Submenus - #$comps = array(); - $computers_array = get_hosts($auDN,array("dn","hostname","ou")); - #if (count($computers_array) != 0){ + /*$computers_array = get_hosts($auDN,array("dn","hostname","ou")); for($n=0;$n "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, "text" => $computers_array[$n]['hostname'], "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); # print_r($comps); echo "
"; - - - } - #} - $comps[] = array("link" => "new_host.php?sbmnr=".$n, - "text" => "Neuer Rechner", + }*/ + $comps[] = array("link" => "new_host.php?sbmnr=0", #.$n, + "text" => "Neuen Rechner anlegen", "zugriff" => array("MainAdmin","HostAdmin")); $groups_array = get_groups($auDN,array("dn","cn")); @@ -53,7 +48,7 @@ function createComputersMenu($rollen , $mnr, $auDN, $sbmnr, $mcnr) { } $groups[] = array("link" => "new_group.php?sbmnr=".$n, - "text" => "Neue Gruppe", + "text" => "Neue Gruppe anlegen", "zugriff" => array("MainAdmin","HostAdmin")); # default machine-configs @@ -140,14 +135,14 @@ function createComputersMenu($rollen , $mnr, $auDN, $sbmnr, $mcnr) { } } $htmlcode= " - +   ".$zwisch2." -   - +   + ".$item2['text']."   diff --git a/ldap-site-mngmt/webinterface/computers/computers_start.dwt b/ldap-site-mngmt/webinterface/computers/computers_start.dwt index 09cade01..378e5d76 100644 --- a/ldap-site-mngmt/webinterface/computers/computers_start.dwt +++ b/ldap-site-mngmt/webinterface/computers/computers_start.dwt @@ -21,7 +21,7 @@ ihre gemeinsamen Hardware-Parameter. Daneben verwalten Sie hier gruppen-spezifische Computer-Profile (MachineConfig) und PXE Boot Konfigurationen. -
  • Default MachineConfig

    +
  • Neues PXE Bootmenü

    Hier können Sie neue PXE Bootmenüs (PXEConfigs) für ihre Rechner oder Rechnergruppen anlegen. diff --git a/ldap-site-mngmt/webinterface/computers/delete_confirm.php b/ldap-site-mngmt/webinterface/computers/delete_confirm.php index c3f2bc8b..32eb4cf4 100644 --- a/ldap-site-mngmt/webinterface/computers/delete_confirm.php +++ b/ldap-site-mngmt/webinterface/computers/delete_confirm.php @@ -3,6 +3,7 @@ include('../standard_header.inc.php'); $dn = $_POST['dn']; $name = $_POST['name']; +$dhcphlpcont = $_POST['dhcphlpcont']; $delurl = $_POST['delurl']; $backurl = $_POST['backurl']; $successurl = $_POST['successurl']; @@ -23,6 +24,7 @@ echo " Falls ja:

    +

    diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost.dwt b/ldap-site-mngmt/webinterface/computers/dhcphost.dwt index 2f381850..ba9a8872 100644 --- a/ldap-site-mngmt/webinterface/computers/dhcphost.dwt +++ b/ldap-site-mngmt/webinterface/computers/dhcphost.dwt @@ -32,6 +32,21 @@ {HOST_DHCPOPT} + + + Default Lease Time: + + +   + + + + Max Lease Time: + + +   + + diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost.php b/ldap-site-mngmt/webinterface/computers/dhcphost.php index 3eb07d19..27ce686b 100644 --- a/ldap-site-mngmt/webinterface/computers/dhcphost.php +++ b/ldap-site-mngmt/webinterface/computers/dhcphost.php @@ -31,11 +31,13 @@ $hostDN = $_GET['dn']; # Rechner Daten $attributes = array("hostname","domainname","ipaddress","hwaddress","description","hlprbservice", "dhcphlpcont","dhcpoptfixed-address","dhcpopthardware","dhcpoptfilename", - "dhcpoptnext-server","hw-mouse","hw-graphic","hw-monitor"); + "dhcpoptnext-server","dhcpoptmax-lease-time","dhcpoptdefault-lease-time","hw-mouse","hw-graphic","hw-monitor"); $host = get_node_data($hostDN,$attributes); $hostip = explode('_',$host['ipaddress']); # print_r($hostip); echo "

    "; $dhcphlpcont = $host['dhcphlpcont']; +$dhcpmaxlease = $host['dhcpoptmax-lease-time']; +$dhcpdefaultlease = $host['dhcpoptdefault-lease-time']; $objectDN = $dhcphlpcont; $rbsDN = $host['hlprbservice']; @@ -79,7 +81,8 @@ if ($dhcphlpcont == ""){ # Host in Service oder Subnet? $objecttype = "service"; $dhcp = ""; - $ocarray = get_node_data($dhcphlpcont,array("objectclass","dhcphlpcont")); + + /*$ocarray = get_node_data($dhcphlpcont,array("objectclass","dhcphlpcont")); #print_r($ocarray); echo "
    "; $sub = array_search('dhcpSubnet', $ocarray['objectclass']); #print_r($sub); @@ -89,7 +92,8 @@ if ($dhcphlpcont == ""){ $expsub = explode('=',$exp0[0]); $dhcpsub = $expsub[1]; $dhcp .= "Subnet ".$dhcpsub." / "; $dhcphlpcont = $ocarray['dhcphlpcont']; - } + }*/ + $exp1 = explode(',',$dhcphlpcont); $expdhcp = explode('=',$exp1[0]); $dhcpserv = $expdhcp[1]; $expdhcpau = explode('=',$exp1[2]); $dhcpau = $expdhcpau[1]; @@ -146,9 +150,9 @@ if ($dhcphlpcont == ""){   - fixed-address:   - ".$fixedaddress."  - + fixed-address:   + ".$fixedaddress."  + @@ -170,6 +174,8 @@ $template->assign(array("HOSTDN" => $hostDN, "HOST_DHCPOPT" => $host_dhcpopt, "NEXTSERVER" => $host['dhcpoptnext-server'], "FILENAME" => $host['dhcpoptfilename'], + "DEFAULTLEASE" => $dhcpdefaultlease, + "MAXLEASE" => $dhcpmaxlease, "HOSTLINK" => "", "RBSLINK" => "", "HWLINK" => "", diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php index a35a29cb..9cd71f41 100644 --- a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php +++ b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php @@ -17,7 +17,21 @@ $sbmnr = $_POST['sbmnr']; $dhcp = htmlentities($dhcp); $olddhcp = htmlentities($olddhcp); - +# sonstige Attribute +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +#print_r($atts); echo "

    "; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "

    "; /*echo "new dhcp:"; print_r($dhcp); echo "
    "; echo "old dhcp:"; print_r($olddhcp); echo "
    "; @@ -53,7 +67,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ if ($olddhcp != ""){ echo "DHCP replace "; print_r($olddhcp); echo " with "; print_r($entrydhcp); echo "
    "; if ($result = ldap_mod_replace($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich in DHCP ".$dhcpcn." [Abt.: ".$dhcpau."] angemeldet

    "; }else{ $mesg = "Fehler beim ändern des DHCP Dienstes zu ".$dhcpcn."!

    "; @@ -64,7 +78,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ } echo "DHCP add "; print_r($entrydhcp); echo "
    "; if ($result = ldap_mod_add($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich in DHCP ".$dhcpcn." [Abt.: ".$dhcpau."] angemeldet

    "; }else{ $mesg = "Fehler beim ändern des DHCP Dienstes zu ".$dhcpcn."!

    "; @@ -80,7 +94,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ #} echo "DHCP delete "; echo "
    "; if ($result = ldap_mod_del($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich aus DHCP gelöscht

    "; }else{ $mesg = "Fehler beim löschen aus DHCP Dienst!

    "; @@ -99,7 +113,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ if ($oldfixedaddress != ""){ echo "Fixed Address ändern"; echo "
    "; if ($result = ldap_mod_replace($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich auf ".$fixedaddress." geändert

    "; }else{ $mesg = "Fehler beim ändern der Option Fixed-Address auf ".$fixedaddress."!

    "; @@ -107,7 +121,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ }else{ echo "Fixed Address auf IP Adresse setzen"; echo "
    "; if ($result = ldap_mod_add($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich auf ".$fixedaddress." gesetzt

    "; }else{ $mesg = "Fehler beim setzen der Option Fixed-Address auf ".$fixedaddress."!

    "; @@ -117,7 +131,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ $entryfixadd ['dhcpoptfixed-address'] = array(); echo "No Fixed Address"; echo "
    "; if ($result = ldap_mod_del($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich gelöscht

    "; }else{ $mesg = "Fehler beim löschen der Option Fixed-Address!

    "; @@ -125,6 +139,79 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ } } +##################################### +# Restliche Attribute (u.a. Description) + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} + +#print_r($entryadd); echo "
    "; +#print_r($entrymod); echo "
    "; +#print_r($entrydel); echo "
    "; + + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "
    "; + #echo "neu anlegen
    "; + foreach (array_keys($entryadd) as $key){ + $addatts .= "".$key.","; + } + if(ldap_mod_add($ds,$hostDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen

    "; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."

    "; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "
    "; + #echo "ändern
    "; + foreach (array_keys($entrymod) as $key){ + $modatts .= "".$key.","; + } + if(ldap_mod_replace($ds,$hostDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert

    "; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."

    "; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "
    "; + #echo "löschen
    "; + foreach (array_keys($entrydel) as $key){ + $delatts .= "".$key.","; + } + if(ldap_mod_del($ds,$hostDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht

    "; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."

    "; + } +} + ##################### diff --git a/ldap-site-mngmt/webinterface/computers/groupoverview.php b/ldap-site-mngmt/webinterface/computers/groupoverview.php index b9f9ce05..15424fbd 100644 --- a/ldap-site-mngmt/webinterface/computers/groupoverview.php +++ b/ldap-site-mngmt/webinterface/computers/groupoverview.php @@ -37,6 +37,7 @@ $template->define_dynamic("Gruppen", "Webseite"); foreach ($group_array as $group){ + $groupname = "
    ".$group['cn'].""; $anzahlmember = count($group['member']); if ( count($group['dhcphlpcont']) != 0 ){ @@ -46,7 +47,7 @@ foreach ($group_array as $group){ }else{$dhcpcont = "";} $template->assign(array("DN" => $group['dn'], - "GROUPCN" => $group['cn'], + "GROUPCN" => $groupname, "GROUPDESC" => $group['description'], "MEMBERS" => $anzahlmember, # "MEMBER" => $group['member'], diff --git a/ldap-site-mngmt/webinterface/computers/host.dwt b/ldap-site-mngmt/webinterface/computers/host.dwt index 8eedca62..bd05e75b 100644 --- a/ldap-site-mngmt/webinterface/computers/host.dwt +++ b/ldap-site-mngmt/webinterface/computers/host.dwt @@ -109,6 +109,7 @@ + diff --git a/ldap-site-mngmt/webinterface/computers/host_add.php b/ldap-site-mngmt/webinterface/computers/host_add.php index bde6f26a..0f01fe75 100644 --- a/ldap-site-mngmt/webinterface/computers/host_add.php +++ b/ldap-site-mngmt/webinterface/computers/host_add.php @@ -5,7 +5,7 @@ $hostname = $_POST['hostname']; $hostdesc = $_POST['hostdesc']; $mac = $_POST['mac']; $ip = $_POST['ip']; - +$dhcp = $_POST['dhcpcont']; $hostname = htmlentities($hostname); $hostdesc = htmlentities($hostdesc); @@ -67,13 +67,15 @@ if ( $hostname != ""){ $hostDN = "HostName=".$hostname.",cn=computers,".$auDN; # print_r($hostDN); echo "
    "; - if (add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts)){ + if (add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts,$dhcp)){ $mesg .= "
    Neuer Rechner erfolgreich angelegt
    "; } else{ $mesg .= "
    Fehler beim anlegen des Rechners!
    "; } + # DHCP + $url = 'hostoverview.php'; } } diff --git a/ldap-site-mngmt/webinterface/computers/host_change.php b/ldap-site-mngmt/webinterface/computers/host_change.php index a0e149b7..52df970f 100644 --- a/ldap-site-mngmt/webinterface/computers/host_change.php +++ b/ldap-site-mngmt/webinterface/computers/host_change.php @@ -57,7 +57,7 @@ echo "Host DN:"; print_r($hostDN); echo "
    "; echo "submenuNR:"; print_r($submenu); echo "

    "; */ -$seconds = 200; +$seconds = 2; $url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr; echo " @@ -89,6 +89,7 @@ if ( $oldhostname != "" && $hostname != "" && $oldhostname != $hostname ){ $newhostDN = "hostname=".$hostname.",cn=computers,".$auDN; # print_r($newhostDN); echo "

    "; modify_host_dn($hostDN, $newhostDN); + $hostDN = $newhostDN; # newsubmenu holen...hosts neu holen, sortieren, ->position #$newhosts = get_hosts($auDN,array("dn")); @@ -231,9 +232,9 @@ if ( $oldip == "" && $ip != "" ){ # print_r($newip); echo "

    "; if (new_ip_host($newip,$hostDN,$auDN)){ $mesg = "IP erfolgreich eingetragen

    "; - if ($dhcptype == "subnet"){ - adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont); - } + #if ($dhcptype == "subnet"){ + # adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont); + #} }else{ $mesg = "Fehler beim eintragen der IP

    "; } @@ -389,8 +390,9 @@ if (count($entrydel) != 0 ){ } */ - -update_dhcpmtime(); +if ( $dhcphlpcont != "" ){ + update_dhcpmtime(array()); +} $mesg .= "
    Sie werden automatisch auf die vorherige Seite zurückgeleitet.
    Falls nicht, klicken Sie hier back"; diff --git a/ldap-site-mngmt/webinterface/computers/host_delete.php b/ldap-site-mngmt/webinterface/computers/host_delete.php index 0470ed91..4d7a935b 100644 --- a/ldap-site-mngmt/webinterface/computers/host_delete.php +++ b/ldap-site-mngmt/webinterface/computers/host_delete.php @@ -3,6 +3,7 @@ include('../standard_header.inc.php'); $hostDN = $_POST['dn']; $hostname = $_POST['name']; +$dhcphlpcont = $_POST['dhcphlpcont']; $hostDN = htmlentities($hostDN); $hostname = htmlentities($hostname); @@ -28,7 +29,9 @@ echo " if ( $hostDN != ""){ if ( delete_host($hostDN) ){ - update_dhcpmtime(); + if ( $dhcphlpcont != "" ){ + update_dhcpmtime(array()); + } $mesg = "Rechner ".$hostname." erfolgreich gelöscht!

    "; } else{ diff --git a/ldap-site-mngmt/webinterface/computers/new_host.dwt b/ldap-site-mngmt/webinterface/computers/new_host.dwt index b9bccec4..43625f57 100644 --- a/ldap-site-mngmt/webinterface/computers/new_host.dwt +++ b/ldap-site-mngmt/webinterface/computers/new_host.dwt @@ -76,6 +76,15 @@ + + DHCP:   + + + + diff --git a/ldap-site-mngmt/webinterface/computers/new_host.php b/ldap-site-mngmt/webinterface/computers/new_host.php index 92184308..507fc0ac 100644 --- a/ldap-site-mngmt/webinterface/computers/new_host.php +++ b/ldap-site-mngmt/webinterface/computers/new_host.php @@ -32,11 +32,22 @@ $hostdesc = str_replace ( "_", " ", $_GET['hostdesc']); $mac = str_replace ( "_", " ", $_GET['mac']); $ip = str_replace ( "_", " ", $_GET['ip']); +# DHCP Einbindung +$objecttype = "nodhcp"; +$dhcp_selectbox = ""; +$altdhcp = alternative_dhcpobjects($objecttype,"",""); +if (count($altdhcp) != 0){ + foreach ($altdhcp as $item){ + $dhcp_selectbox .= " + "; + } +} $template->assign(array("HOSTNAME" => $hostname, "HOSTDESC" => $hostdesc, "MAC" => $mac, "IP" => $ip, + "DHCPSELECT" => $dhcp_selectbox, "MOUSE" => "", "GRAPHIC" => "", "MONITOR" => "", diff --git a/ldap-site-mngmt/webinterface/computers/new_pxe.php b/ldap-site-mngmt/webinterface/computers/new_pxe.php index 07890505..8eef2888 100644 --- a/ldap-site-mngmt/webinterface/computers/new_pxe.php +++ b/ldap-site-mngmt/webinterface/computers/new_pxe.php @@ -6,7 +6,7 @@ include('../standard_header.inc.php'); $titel = "Computers Management"; # 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. $mainnr = 3; -$mnr = 5; +$mnr = 3; $sbmnr = -1; $mcnr = -1; # 3. Dateiname und evtl. Pfad des Templates für die Webseite diff --git a/ldap-site-mngmt/webinterface/computers/rbshost.php b/ldap-site-mngmt/webinterface/computers/rbshost.php index 438009ed..3d53ba0a 100644 --- a/ldap-site-mngmt/webinterface/computers/rbshost.php +++ b/ldap-site-mngmt/webinterface/computers/rbshost.php @@ -108,8 +108,8 @@ if ($rbsDN == ""){ "; $rbs_dhcpopt = ""; -} +} $template->assign(array("HOSTDN" => $hostDN, @@ -170,43 +170,46 @@ if (count($hostpxeconfigs) != 0){ } } -# Default PXEs des RBS -$defaultpxeconfigs = get_pxeconfigs($rbsDN,array("dn","cn","description","timerange","filename")); +# Default PXEs des RBS $template->assign(array("DEFPXEDN" => "", - "DEFPXECN" => "Keine PXE Config angelegt", - "DEFPXEDESC" => "", - "DEFPXETR" => "",)); + "DEFPXECN" => "Keine PXE Config angelegt", + "DEFPXEDESC" => "", + "DEFPXETR" => "",)); $template->define_dynamic("Defpxes", "Webseite"); -if (count($defaultpxeconfigs) != 0){ - for ($i=0;$i".$defaultpxeconfigs[$i]['cn'].""; - - $deftrange = ""; - if (count($defaultpxeconfigs[$i]['timerange']) > 1 ){ - foreach ($defaultpxeconfigs[$i]['timerange'] as $tr){ - $exptime = array_merge(explode('_',$tr), array($defaultpxeconfigs[$i]['cn'])); - $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht - if ($exptime[0] == "X"){$exptime[0]="täglich";} - # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} - $deftrange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59
    "; - } - }else{ - $exptime = array_merge(explode('_',$defaultpxeconfigs[$i]['timerange']), array($defaultpxeconfigs[$i]['cn'])); - $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht - if ($exptime[0] == "X"){$exptime[0]="täglich";} - # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} - $deftrange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59"; - } - - $template->assign(array("DEFPXEDN" => $defaultpxeconfigs[$i]['dn'], - "DEFPXECN" => $defpxelink, - "DEFPXEDESC" => $defaultpxeconfigs['description'], - "DEFPXETR" => $deftrange, )); - $template->parse("DEFPXES_LIST", ".Defpxes"); - } +if ($rbsDN != ""){ + $defaultpxeconfigs = get_pxeconfigs($rbsDN,array("dn","cn","description","timerange","filename")); + + if (count($defaultpxeconfigs) != 0){ + for ($i=0;$i".$defaultpxeconfigs[$i]['cn'].""; + + $deftrange = ""; + if (count($defaultpxeconfigs[$i]['timerange']) > 1 ){ + foreach ($defaultpxeconfigs[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr), array($defaultpxeconfigs[$i]['cn'])); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $deftrange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59
    "; + } + }else{ + $exptime = array_merge(explode('_',$defaultpxeconfigs[$i]['timerange']), array($defaultpxeconfigs[$i]['cn'])); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $deftrange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59"; + } + + $template->assign(array("DEFPXEDN" => $defaultpxeconfigs[$i]['dn'], + "DEFPXECN" => $defpxelink, + "DEFPXEDESC" => $defaultpxeconfigs['description'], + "DEFPXETR" => $deftrange, )); + $template->parse("DEFPXES_LIST", ".Defpxes"); + } + } } } diff --git a/ldap-site-mngmt/webinterface/computers/rbshost_change.php b/ldap-site-mngmt/webinterface/computers/rbshost_change.php index edff80bc..179451ad 100644 --- a/ldap-site-mngmt/webinterface/computers/rbshost_change.php +++ b/ldap-site-mngmt/webinterface/computers/rbshost_change.php @@ -53,7 +53,7 @@ if ($rbs != "none" && $rbs != $oldrbs){ if ($oldrbs != ""){ echo "RBS replace "; print_r($oldrbs); echo " with "; print_r($entryrbs); echo "
    "; if ($result = ldap_mod_replace($ds,$hostDN,$entryrbs)){ - update_dhcpmtime(); + update_dhcpmtime(array()); rbs_adjust_host($hostDN, $rbs); $mesg = "Remote Boot Service erfolgreich zu ".$rbscn." [Abt.: ".$rbsau."] geändert

    "; }else{ @@ -62,7 +62,7 @@ if ($rbs != "none" && $rbs != $oldrbs){ }else{ echo "RBS add "; print_r($entryrbs); echo "
    "; if ($result = ldap_mod_add($ds,$hostDN,$entryrbs)){ - update_dhcpmtime(); + update_dhcpmtime(array()); rbs_adjust_host($hostDN, $rbs); $mesg = "Remote Boot Service erfolgreich zu ".$rbscn." [Abt.: ".$rbsau."] geändert

    "; }else{ @@ -75,7 +75,7 @@ if ($rbs != "none" && $rbs != $oldrbs){ $entryrbs ['dhcpoptfilename'] = array(); echo "RBS delete "; echo "
    "; if ($result = ldap_mod_del($ds,$hostDN,$entryrbs)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich aus RBS gelöscht

    "; }else{ $mesg = "Fehler beim löschen aus RBS!

    "; diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt index 0d6a8684..8c9aefdc 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt @@ -3,67 +3,10 @@

    Dynamische DHCP Pools

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SubnetzIP Ranges (innerhalb Subnetz)Unknown Clients
    {SUBNET}/24

    - - Pool löschen (Häkchen setzen)
    - - -    -    - - -
    - - - - -    -    - -
    - -   -
    - - - - - - - - - - + + {POOLFORMULAR} + +

    Dynamischen DHCP Pool hinzufügen

    @@ -73,18 +16,18 @@
    - IP Range (innerhalb eines Subnetzes)
    + IP Range (innerhalb eines Subnetzes)
    weitere Ranges können später hinzugefügt werden - Unknown Clients + Unknown Clients - +    -    - + + Pool löschen (Häkchen setzen) + + + + + + +    -    + + +
    + + + + + +    -    + + + + + +   + + + + + + + + + + + + + + + + +
    + + + + + "; + +$template->assign(array("POOLFORMULAR" => $poolform)); +$template->parse("POOLFORM_LIST", "Poolform"); +#$template->clear_dynamic("Poolform"); +#$template->clear_parse("POOLFORM_LIST"); + $template->define_dynamic("Dhcppools", "Webseite"); $template->define_dynamic("Dhcpranges", "Webseite"); - +# Für jeden Pool ... foreach ($pools as $pool){ - + + # DHCP Subnet des Pools + $subnet = ldap_explode_dn($pool['dhcphlpcont'],1); + $subnetdnexp = ldap_explode_dn( $pool['dhcphlpcont'], 0); + $subnetauexp = array_slice($subnetdnexp, 3); + $subnetau = implode(',',$subnetauexp); + + $template->clear_parse("DHCPRANGES_LIST"); - # DHCP Range + # DHCP Ranges if (count($pool['dhcprange']) != 0){ #$template->define_dynamic("Dhcpranges", "Webseite"); if (count($pool['dhcprange']) > 1){ @@ -81,10 +163,7 @@ foreach ($pools as $pool){ } } - # DHCP Subnet - $subnet = ldap_explode_dn($pool['dhcphlpcont'],1); - - + # Unknown-Clients if ($pool['dhcpoptallow'] == "unknown-clients"){ $unknownclients = "allow"; $ucselectbox = " @@ -102,28 +181,24 @@ foreach ($pools as $pool){ $ucselectbox = " "; - } - + } $template->assign(array("POOLDN" => $pool['dn'], "CN" => $pool['cn'], "SUBNETDN" => $pool['dhcphlpcont'], "SUBNET" => $subnet[0], + "SUBNETAU" => $subnetau, "DESCRIPTION" => $pool['description'], "STATEMENTS" => $pool['dhcpstatements'], "UCSELECT" => $ucselectbox, "UCNOW" => $unknownclients, - "ALLOW" => $pool['dhcpoptallow'], - "DENY" => $pool['dhcpoptdeny'], - "IGNORE" => $pool['dhcpoptignore'], "DEFAULTLEASE" => $pool['dhcpoptdefault-lease-time'], "MAXLEASE" => $pool['dhcpoptmax-lease-time'], "MNR" => $mnr)); $template->parse("DHCPPOOLS_LIST", ".Dhcppools"); - #$template->clear_dynamic("Dhcppools"); - } +} ################################################################################### diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php index c6cef33a..416654e2 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php @@ -8,7 +8,7 @@ $range2 = $_POST['addrange2']; $unknownclients = $_POST['unknownclients']; $mnr = $_POST['mnr']; -$seconds = 200; +$seconds = 2; $url = "dhcppool.php?mnr=".$mnr; echo " @@ -28,57 +28,63 @@ if ($syntax->check_ip_syntax($range1) && $syntax->check_ip_syntax($range2)){ $fe = explode('.',$range2); if ( $fs[0] == $fe[0] && $fs[1] == $fe[1] && $fs[2] == $fe[2] ) { if ( $fs[3] <= $fe[3] ){ - # Range zusammenstellen - $range = implode("_", array($range1,$range2)); - # Freie IP Bereiche testen - $fipb_array = get_freeipblocks_au($auDN); - 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); - break; - } + # DHCP Subnet DN finden + $subnet = implode(".", array($fs[0],$fs[1],$fs[2],"0")); + print_r($subnet);echo"

    "; + 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; } - if ($i < count($fipb_array) ){ - foreach ( $fipb_array as $item ){ - $entry ['FreeIPBlock'][] = $item; - } - $results = ldap_mod_replace($ds,$auDN,$entry); - if ($results){ - echo "
    Neue FIPBs erfolgreich eingetragen!
    "; - - # DHCP Subnet DN finden - $subnet = implode(".", array($fs[0],$fs[1],$fs[2],"0")); - print_r($subnet);echo"

    "; - 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 "

    "; - if (count($result[0]) != 0){ - $result = add_dhcppool($result[0]['dn'],$range,$unknownclients,$result[0]['dhcphlpcont']); + $result = ldapArraySauber($result); + #print_r($result);echo "

    "; + if (count($result[0]) != 0){ + + $subnetdn = $result[0]['dn']; + $subnetdnexp = ldap_explode_dn( $subnetdn, 0); + $subnetauexp = array_slice($subnetdnexp, 3); + $subnetau = implode(',',$subnetauexp); + + # Range zusammenstellen + $range = implode("_", array($range1,$range2)); + + # Freie IP Bereiche testen + $fipb_array = get_freeipblocks_au($auDN); + 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); + break; + } + } + if ($i < count($fipb_array) ){ + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + echo "
    Neue FIPBs erfolgreich eingetragen!
    "; + $result = add_dhcppool($subnetdn,$range,$unknownclients,$result[0]['dhcphlpcont']); if ($result){ echo "
    Dynamischer DHCP Pool erfolgreich eingetragen!
    " ; - update_dhcpmtime(); + update_dhcpmtime(array($subnetau)); }else{ echo "
    Fehler beim eintragen des dynamischen DHCP Pools!
    "; # Range wieder in FIPBs aufnehmen. $entry2 ['FreeIPBlock'] = $range; ldap_mod_add($ds,$auDN,$entry2); merge_ipranges($auDN); - } - }else{ - echo "DHCP Subnet nicht im System vorhanden!
    "; - } - }else{ - echo "
    Fehler beim eintragen der FIPBs!
    "; - } + } + }else{ + echo "
    Fehler beim eintragen der FIPBs!
    "; + } + }else{ + printf("
    IP Range %s ist nicht im verfuegbaren Bereich!
    ", $range ); + } }else{ - printf("
    IP Range %s ist nicht im verfuegbaren Bereich!
    ", $range ); - } + echo "DHCP Subnet nicht im System vorhanden!
    "; + } }else{ echo "erster Range Wert grösser als zweiter Range Wert
    "; } diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php index b0ed4210..375cc01a 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php @@ -5,6 +5,7 @@ $syntax = new Syntaxcheck; $pooldn = $_POST['pooldn']; $subnet = $_POST['subnet']; +$subnetau = $_POST['subnetau']; $delpool = $_POST['delpool']; $poolranges = array(); foreach ($pooldn as $dn){ @@ -20,8 +21,14 @@ $addrange2 = $_POST['addrange2']; $uc = $_POST['unknownclients']; $olduc = $_POST['olduc']; +# Array to fill with AUs to update dhcpMTime +$au_to_update = array(); + +$mnr = $_POST['mnr']; + #print_r($pooldn); echo "
    "; #print_r($subnet); echo "
    "; +#print_r($subnetau); echo "
    "; #print_r($delpool); echo "

    "; #print_r($oldrange1); echo "
    "; #print_r($oldrange2); echo "
    "; @@ -33,9 +40,7 @@ $olduc = $_POST['olduc']; #print_r($olduc); echo "

    "; #print_r($uc); echo "

    "; -$mnr = $_POST['mnr']; - -$seconds = 2000; +$seconds = 200; $url = "dhcppool.php?mnr=".$mnr; echo " @@ -48,9 +53,9 @@ echo " - + diff --git a/ldap-site-mngmt/webinterface/standard_header.inc.php b/ldap-site-mngmt/webinterface/standard_header.inc.php index 62e51f9b..f86de2a0 100644 --- a/ldap-site-mngmt/webinterface/standard_header.inc.php +++ b/ldap-site-mngmt/webinterface/standard_header.inc.php @@ -38,28 +38,32 @@ if (!($ds = uniLdapConnect($uid,$userPassword))){ "; die; -} +} -# AU Daten holen -$attributes = array("ou","associateddomain","maxipblock","freeipblock","cn","description"); -$au_data = get_au_data($auDN,$attributes); -$assocdom = $au_data[0]['associateddomain']; -$au_ou = $au_data[0]['ou']; -$au_cn = $au_data[0]['cn']; -$au_desc = $au_data[0]['description']; -$au_mipb = $au_data[0]['maxipblock']; -$au_fipb = $au_data[0]['freeipblock']; +if ($auDN != ""){ -# AU Domain Daten holen -$domain_data = get_domain_data($auDN,array("dn")); + # AU Daten holen + $attributes = array("ou","associateddomain","maxipblock","freeipblock","cn","description"); + $au_data = get_au_data($auDN,$attributes); + $assocdom = $au_data[0]['associateddomain']; + $au_ou = $au_data[0]['ou']; + $au_cn = $au_data[0]['cn']; + $au_desc = $au_data[0]['description']; + $au_mipb = $au_data[0]['maxipblock']; + $au_fipb = $au_data[0]['freeipblock']; + + # AU Domain Daten holen + $domain_data = get_domain_data($auDN,array("dn")); + + $expAuDn = explode(",",$auDN); + if ($expAuDn[1] == "ou=RIPM"){ + $domDN = "ou=DNS,".$suffix; + } + else{$domDN = $domain_data[0]['dn']; echo "
    ";} + + $domprefix = str_replace('.'.$domsuffix,'',$assocdom); + # print_r($domprefix); -$expAuDn = explode(",",$auDN); -if ($expAuDn[1] == "ou=RIPM"){ - $domDN = "ou=DNS,".$suffix; } -else{$domDN = $domain_data[0]['dn']; echo "
    ";} - -$domprefix = str_replace('.'.$domsuffix,'',$assocdom); -# print_r($domprefix); ?> \ No newline at end of file -- cgit v1.2.3-55-g7522
    "; - +######################################################################################### +# Pools löschen, entsprechende Arrays ($pooldn, $uc, ...) zur weiteren Verarbeitung anpassen for ($i=0;$i", $pooldn[$i]); $dhcpoptdel = "dhcpopt".$olduc[$i]; $entrydel [$dhcpoptdel] = array(); - print_r($entrydel); echo "
    "; + #print_r($entrydel); echo "
    "; ldap_mod_del($ds,$pooldn[$i],$entrydel); $dhcpoptadd = "dhcpopt".$uc[$i]; $entryadd [$dhcpoptadd] = "unknown-clients"; - print_r($entryadd); echo "

    "; + #print_r($entryadd); echo "

    "; ldap_mod_add($ds,$pooldn[$i],$entryadd); + printf("Pool %s:
    DHCP Option unknown-clients von %s auf %s geändert

    ",$pooldn[$i],$olduc[$i],$uc[$i]); + # Subnet-AU auf DHCP-Modify setzen + $au_to_update [] = $subnetau[$i]; } # Ranges hinzufügen if ( $addrange1[$i] != "" && $addrange2[$i] != "" ){ @@ -128,6 +138,8 @@ for ($i=0;$i",$addrange1[$i],$addrange2[$i],$net); }else{ echo "
    Fehler beim eintragen des dynamischen DHCP Pools!
    "; @@ -143,7 +155,9 @@ for ($i=0;$i"; $poolranges [$rangepooldn[$i]][$range_key] = $range; $mod_dhcpranges [$rangepooldn[$i]][$range_key] = $range; + # Subnet-AU auf DHCP-Modify setzen + $au_to_update [] = $subnetau[$i]; foreach ($diffrange as $dr){ $new_fipbs ['freeipblock'][] = $dr; @@ -206,7 +224,9 @@ for ($i=0;$i"; #print_r($new_fipbs); echo "

    "; + +######################################################################################### +# In Arrays $dhcp_modranges und $new_fipbs gespeicherte Änderungen im LDAP schreiben $keys = array_keys($mod_dhcpranges); foreach ($keys as $pdn){ #print_r($pdn); echo "
    "; @@ -265,8 +287,13 @@ if ( count($diff) != 0 || count($revdiff) != 0 ){ printf("Fehler beim Anpassen der FIPBs"); } } -# DHCP Modify Timestamp festhalten -update_dhcpmtime(); + +######################################################################################### +# DHCP Modify Timestamps in betreffenden AUs aktualisieren +#echo "
    Subnet-AU: ";print_r ($au_to_update); echo "
    "; +update_dhcpmtime($au_to_update); + + $mesg .= "
    Sie werden automatisch auf die vorherige Seite zurückgeleitet.
    Falls nicht, klicken Sie hier back"; diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php index 388f01ff..8ca55023 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php @@ -65,7 +65,7 @@ $attributes = array("dn","cn","dhcpprimarydn","dhcpsecondarydn","description","d $dhcpsv_data = get_node_data($dhcpserviceDN, $attributes); #print_r($dhcpsv_data); -# RBS Anbieten +# DHCP Service Anbieten # momentanes Offer # todo: falls dhcpofferDN leer dann standardwert AU teilbaum $offerexp = ldap_explode_dn($dhcpsv_data['dhcpofferdn'], 1); diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php index 4b17dec9..687a5bbd 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php @@ -98,30 +98,43 @@ if ( $oldcn != "" && $cn == "" ){ if ( $dhcpoffer != "none" ){ - if ( $dhcpoffer != "off" && $dhcpoffer == $olddhcpoffer ){ + if ( ($dhcpoffer != "off" && $dhcpoffer == $olddhcpoffer) || ($dhcpoffer == "off" && $olddhcpoffer == "") ){ $mesg = "Sie haben die gleiche Abteilung ausgewählt
    Keine Änderung!"; } if ( $dhcpoffer != "off" && $dhcpoffer != $olddhcpoffer ){ $entryoffer ['dhcpofferdn'] = $dhcpoffer; - if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){ - $mesg = "DHCP Service Offer erfolgreich geändert

    "; + if ($olddhcpoffer == ""){ + # Offer anlegen + if(ldap_mod_add($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich angelegt

    "; + } + else{ + $mesg = "Fehler beim ändern des DHCP Service Offers!

    "; + } } else{ - $mesg = "Fehler beim ändern des DHCP Service Offers!

    "; + # Offer ändern + if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich geändert

    "; + } + else{ + $mesg = "Fehler beim ändern des DHCP Service Offers!

    "; + } } } - /*if ( $dhcpoffer == "off" && $olddhcpoffer != "" ){ + if ( $dhcpoffer == "off" && $olddhcpoffer != "" ){ $entryoffer ['dhcpofferdn'] = array(); if(ldap_mod_del($ds,$dhcpDN,$entryoffer)){ - $mesg = "DHCP Service Offer erfolgreich geändert

    "; + $mesg = "DHCP Service Offer erfolgreich gelöscht

    "; + cleanup_del_dhcpservice ($dhcpDN); } else{ $mesg = "Fehler beim ändern des DHCP Service Offers!

    "; } - }*/ + } } @@ -133,7 +146,7 @@ if ( $adddhcpoptdefinition != "" ){ $entryadd['optiondefinition'] = $adddhcpoptdefinition; if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Selbst-definierte DHCP Option erfolgreich eingetragen

    "; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim eintragen Selbst-definierte DHCP Option

    "; } @@ -176,7 +189,7 @@ if (count($entryadd) != 0 ){ } if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Attribute ".$addatts." erfolgreich eingetragen

    "; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim eintragen der Attribute ".$addatts."

    "; } @@ -188,7 +201,7 @@ if (count($entrymod) != 0 ){ } if(ldap_mod_replace($ds,$dhcpDN,$entrymod)){ $mesg = "Attribute ".$modatts." erfolgreich geaendert

    "; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim aendern der Attribute ".$modatts."

    "; } @@ -200,7 +213,7 @@ if (count($entrydel) != 0 ){ } if(ldap_mod_del($ds,$dhcpDN,$entrydel)){ $mesg = "Attribute ".$delatts." erfolgreich geloescht

    "; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim loeschen der Attribute ".$delatts."

    "; } diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt index 0f16f966..9160219c 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt @@ -5,7 +5,7 @@

    DHCP Subnet   {CN}

    DHCP Subnet   {CN} / {NETMASK}

    @@ -17,7 +17,7 @@ - + - + - - + @@ -135,26 +135,26 @@ - + - - + - + - - - - - + - + @@ -107,15 +101,15 @@ - + - + + - + --> diff --git a/ldap-site-mngmt/webinterface/dns/dns.php b/ldap-site-mngmt/webinterface/dns/dns.php index dd9e5756..99fef1fb 100644 --- a/ldap-site-mngmt/webinterface/dns/dns.php +++ b/ldap-site-mngmt/webinterface/dns/dns.php @@ -7,7 +7,7 @@ $titel = "DNS Zone Management"; $mnr = 0; $mainnr = 6; # 3. Dateiname und evtl. Pfad des Templates für die Webseite -$webseite = "dns_start.dwt"; +$webseite = "dns_inwork.dwt"; include("../class.FastTemplate.php"); diff --git a/ldap-site-mngmt/webinterface/dns/dns_inwork.dwt b/ldap-site-mngmt/webinterface/dns/dns_inwork.dwt new file mode 100755 index 00000000..d64dc090 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns_inwork.dwt @@ -0,0 +1,15 @@ +
    Wert
    Eingebunden in DHCP Dienst: {DHCPSVNOW}  @@ -107,17 +107,17 @@
    Default Lease Time:Routers: - -   + +  
    Max Lease Time: - -   + Broadcast Address: + +  
    Routers:Default Lease Time: - -   + +  
    Broadcast Address: - -   + Max Lease Time: + +  
    Allow: diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php index ded54e2c..875f464b 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php @@ -283,7 +283,7 @@ if (count($entrydel) != 0 ){ } -update_dhcpmtime(); +update_dhcpmtime(array()); $mesg .= "
    Sie werden automatisch auf die vorherige Seite zurückgeleitet.
    Falls nicht, klicken Sie hier back"; diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php index 5bbe10d0..28c8277b 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php @@ -21,7 +21,7 @@ echo " if ( $subnetDN != ""){ if( delete_dhcpsubnet($subnetDN,$cn)){ $mesg = "Subnet ".$cn." erfolgreich gelöscht!

    "; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim löschen des Subnets ".$cn." !

    "; } diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt index 7cf7f42c..61d052b1 100644 --- a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt @@ -77,21 +77,15 @@
    Default Lease Time: - -
    Max Lease Time:Routers: - +
    DDNS Update Style:Broadcast Address: - +
    Routers:Default Lease Time: - +
    Broadcast Address:Max Lease Time: - +
    NTP Servers:
    + + + + + + + + + + +

    Modul - DNS Zonen Management:

    +

    Dieses Modul steht noch nicht zur Verfügung ...
    + +

    \ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/dns_menu.php b/ldap-site-mngmt/webinterface/dns/dns_menu.php index 1ce8e5b7..bf6e5bbe 100644 --- a/ldap-site-mngmt/webinterface/dns/dns_menu.php +++ b/ldap-site-mngmt/webinterface/dns/dns_menu.php @@ -7,18 +7,19 @@ function createDNSMenu($rollen , $mnr) { $hauptmenu = array(array("link" => "dns.php", "text" => "Übersicht", "zugriff" => "alle"), - array("link" => "dns.php", - "text" => "SOA Record", - "zugriff" => array("MainAdmin")), - array("link" => "dns.php", - "text" => "INCLUDE Direktiven", - "zugriff" => array("MainAdmin","ZoneAdmin")), - array("link" => "dns.php", - "text" => "Zonen Delgierung", - "zugriff" => array("MainAdmin")), - array("link" => "dns.php", - "text" => "Resource Records", - "zugriff" => array("MainAdmin","HostAdmin","ZoneAdmin"))); + #array("link" => "dns.php", + # "text" => "SOA Record", + # "zugriff" => array("MainAdmin")), + #array("link" => "dns.php", + # "text" => "INCLUDE Direktiven", + # "zugriff" => array("MainAdmin","ZoneAdmin")), + #array("link" => "dns.php", + # "text" => "Zonen Delgierung", + # "zugriff" => array("MainAdmin")), + #array("link" => "dns.php", + # "text" => "Resource Records", + # "zugriff" => array("MainAdmin","HostAdmin","ZoneAdmin")) + ); #$rollen = array_keys($roles); diff --git a/ldap-site-mngmt/webinterface/ip/ip_deleg.php b/ldap-site-mngmt/webinterface/ip/ip_deleg.php index dafdaff6..6b1cf3ed 100644 --- a/ldap-site-mngmt/webinterface/ip/ip_deleg.php +++ b/ldap-site-mngmt/webinterface/ip/ip_deleg.php @@ -6,7 +6,7 @@ include('../standard_header.inc.php'); $titel = "IP Address Management"; # 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. $mainnr = 2; -$mnr = 3; +$mnr = 2; # 3. Dateiname und evtl. Pfad des Templates für die Webseite $webseite = "ip_deleg.dwt"; diff --git a/ldap-site-mngmt/webinterface/ip/ip_menu.php b/ldap-site-mngmt/webinterface/ip/ip_menu.php index 73796814..459e47e8 100644 --- a/ldap-site-mngmt/webinterface/ip/ip_menu.php +++ b/ldap-site-mngmt/webinterface/ip/ip_menu.php @@ -23,9 +23,9 @@ function createIPMenu($rollen , $mnr) { array("link" => $iprechnerlink, "text" => "IP Adressen Rechner", "zugriff" => array("MainAdmin","HostAdmin")), - array("link" => $ipdhcplink, - "text" => "IP Adressen DHCP", - "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + #array("link" => $ipdhcplink, + # "text" => "IP Adressen DHCP", + # "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), array("link" => $ipdeleglink, "text" => "Delegierte IP Bereiche", "zugriff" => array("MainAdmin"))); diff --git a/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php b/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php index 7d337f7e..851eb77f 100644 --- a/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php +++ b/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php @@ -42,7 +42,8 @@ foreach ($tochange as $i){ $oldip[$i] = htmlentities($oldip[$i]); if (new_ip_host($newipp,$hostDN[$i],$auDN)){ $mesg = "Neue IP Adresse eingetragen
    "; - update_dhcpmtime(); + # falls Rechner in DHCP -> fixed-address auf IP Setzen... + # und update_dhcpmtime(array()); }else{$mesg = "Fehler beim eintragen der neuen IP Adresse
    ";} }else{echo "falsche IP Syntax";} @@ -70,7 +71,8 @@ foreach ($tochange as $i){ if (modify_ip_host($newipp,$hostDN[$i],$auDN)){ $mesg = "IP Adresse geaendert
    "; adjust_hostip_tftpserverip($oldip[$i],$newip[$i]); - update_dhcpmtime(); + # Falls Rechner in DHCP + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim aendern der IP Adresse
    "; # oldip die schon gelöscht wurde wieder einfügen @@ -94,7 +96,8 @@ foreach ($tochange as $i){ if (delete_ip_host($hostDN[$i],$auDN)){ $mesg = "IP Adresse geloescht
    "; adjust_hostip_tftpserverip($oldip[$i],""); - update_dhcpmtime(); + # falls Rechner in DHCP -> fixed-address auf dynamic/Hostname setzen + update_dhcpmtime(array()); }else{$mesg = "Fehler beim loeschen der IP Adresse
    ";} $mesg .= "
    Sie werden automatisch auf die vorherige Seite zurückgeleitet.
    diff --git a/ldap-site-mngmt/webinterface/ip/ip_start.dwt b/ldap-site-mngmt/webinterface/ip/ip_start.dwt index b5e4931f..2b451f4e 100644 --- a/ldap-site-mngmt/webinterface/ip/ip_start.dwt +++ b/ldap-site-mngmt/webinterface/ip/ip_start.dwt @@ -18,11 +18,11 @@ Hier koennen Sie die IP Adressen ihrer Rechner verwalten. Sie koennen IP Adressen neu zuweisen, aendern oder loeschen. -
  • IP Adressen DHCP

    +
  • Delegierte IP Adressen

    In diesem Bereich verwalten Sie ihre an untergeordnete Abteilungen delegierten IP Adressbereiche. Sie koennen neue IP Bereiche delegieren, Delegierungen aendern oder diff --git a/ldap-site-mngmt/webinterface/lib/au_management_functions.php b/ldap-site-mngmt/webinterface/lib/au_management_functions.php index e6f46cfc..0f725198 100644 --- a/ldap-site-mngmt/webinterface/lib/au_management_functions.php +++ b/ldap-site-mngmt/webinterface/lib/au_management_functions.php @@ -46,6 +46,7 @@ function new_childau($childDN,$childou,$childcn,$childdesc,$mainadmin){ $entryAU ["objectclass"][1] = "organizationalunit"; $entryAU ["objectclass"][2] = "top"; $entryAU ["ou"] = $childou; + $entryAU ["dhcpmtime"] = 0; if ($childcn != ""){$entryAU ["cn"] = $childcn;} if ($childdesc != ""){$entryAU ["description"] = $childdesc;} diff --git a/ldap-site-mngmt/webinterface/lib/config.inc.php b/ldap-site-mngmt/webinterface/lib/config.inc.php index e6dc17b1..fe76a958 100644 --- a/ldap-site-mngmt/webinterface/lib/config.inc.php +++ b/ldap-site-mngmt/webinterface/lib/config.inc.php @@ -3,7 +3,7 @@ #Pfad festlegen wo die Anwendungsskripte sich befinden #$START_PATH="http://132.230.4.150/test/"; #$START_PATH="https://132.230.9.56/lsm/"; - $START_PATH="https://dhcp.uni-freiburg.de/lsm/"; + $START_PATH="https://dhcp.uni-freiburg.de/"; # Anlegen einer Variablen für den Speicherort von den CSVs # $TMPPATH_CSV="/home/gruppe1/public_html/htdocs/"; diff --git a/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php b/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php index fd939369..05d47f49 100644 --- a/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php +++ b/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php @@ -18,19 +18,46 @@ $ldapError = null; ################################################################################################### -# immer wenn ein DHCP Objekt geändert wird (DHCP modify time aktualisieren) -function update_dhcpmtime(){ +# wenn DHCP Objekte geändert werden DHCP modify time der AU aktualisieren, und auch der AUs +# referenzierter Objekte (Subnetz, RBS Dhcp Optionen) aktualisieren +function update_dhcpmtime($au_array){ global $ds, $auDN, $ldapError; $entry ['dhcpmtime'] = time(); + + # eigene AU $results = ldap_mod_replace($ds,$auDN,$entry); if ($results){ - echo "
    dhcpMTime erfolgreich aktualisiert!
    " ; - return 1; + echo "
    dhcpMTime erfolgreich in AU ".$auDN." aktualisiert!
    " ; + #return 1; }else{ echo "
    Fehler beim Aktualisieren der dhcpMTime!
    " ; } + + # andere AUs + if ( count($au_array) != 0 ) { + $au_array = array_unique($au_array); + # Bind als DHCP Manager + $dhcp_uid = "dhcpmanager"; + $dhcp_userPassword = "dhcpman02"; + if (!($dhcp_ds = uniLdapConnect($dhcp_uid,$dhcp_userPassword))){ + echo "Konnte nicht als DHCP-Manager mit LDAP Server verbinden"; + die; + }else{ + #echo "DHCP BIND erfolgreich"; + foreach ($au_array as $au){ + $results = ldap_mod_replace($dhcp_ds,$au,$entry); + if ($results){ + echo "dhcpMTime erfolgreich in AU ".$au." aktualisiert!
    " ; + #return 1; + }else{ + echo "
    Fehler beim Aktualisieren der dhcpMTime!
    " ; + } + } + ldap_unbind($dhcp_ds); + } + } } @@ -270,7 +297,7 @@ function add_dhcpservice ($dhcpserviceName,$dhcpoffer,$atts){ } - +# Löschen von Referenzen (dhcpHlpService) auf DHCP Service Objekt function cleanup_del_dhcpservice ($dhcpserviceDN){ global $ds, $suffix, $auDN, $ldapError; @@ -289,7 +316,7 @@ function cleanup_del_dhcpservice ($dhcpserviceDN){ } - +# Anpassen von Referenzen auf DHCP Service Objekt an neuen DN function adjust_dhcpservice_dn ($newdhcpserviceDN,$dhcpserviceDN){ global $ds, $suffix, $auDN, $ldapError; @@ -318,7 +345,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){ $expip = explode('.',$ip); $subnetDN = ""; - if ($objecttype == "subnet"){ + /*if ($objecttype == "subnet"){ # alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs $servarray = alternative_dhcpservices(""); #print_r($servarray); echo "
    "; @@ -337,7 +364,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){ } } } - } + }*/ if ($objecttype == "service"){ # alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs @@ -348,7 +375,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){ $alt_dhcp[] = $servarray[$i]; } } - # Subnetz entsprechend IP + /*# Subnetz entsprechend IP $subarray = alternative_dhcpsubnets($objectDN); #print_r($subarray); if (count($subarray) != 0){ @@ -369,7 +396,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){ $alt_dhcp[] = $subarray[$i]; } } - } + }*/ } if ($objecttype == "nodhcp"){ @@ -381,7 +408,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){ $alt_dhcp[] = $servarray[$i]; } } - # Subnetz entsprechend IP + /*# Subnetz entsprechend IP $subarray = alternative_dhcpsubnets($objectDN); #print_r($subarray); if (count($subarray) != 0){ @@ -402,7 +429,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){ $alt_dhcp[] = $subarray[$i]; } } - } + }*/ } #echo "
    ";print_r($alt_dhcp); return $alt_dhcp; @@ -461,8 +488,8 @@ function add_dhcpsubnet ($cn,$dhcpservice,$netmask,$atts){ if ($result = ldap_add($ds, $dhcpsubnetDN, $entrydhcp)){ printf("Subnet %s / %s erfolgreich eingetragen",$cn,$netmask); + update_dhcpmtime(array()); return 1; - update_dhcpmtime(); #if ( check_ip_in_subnet($range1,$cn) && check_ip_in_subnet($range2,$cn)){ # $dhcprange = implode('_',array($range1,$range2)); # if ( $range = new_ip_dhcprange($dhcprange,$dhcpsubnetDN,$auDN) ){ @@ -503,7 +530,7 @@ function delete_dhcpsubnet($subnetDN,$cn){ $results = ldap_mod_add($ds,$auDN,$entry); if ($results){ merge_ipranges($auDN); - update_dhcpmtime(); + update_dhcpmtime(array()); return 1; }else{ return 0; @@ -555,7 +582,7 @@ function modify_subnet_dn($subnetDN,$newsubnetDN){ $results = ldap_mod_replace($ds,$auDN,$entry); if ($results){ merge_ipranges($auDN); - update_dhcpmtime(); + update_dhcpmtime(array()); echo "
    FIPBs erfolgreich angepasst!
    " ; return 1; }else{ diff --git a/ldap-site-mngmt/webinterface/lib/host_management_functions.php b/ldap-site-mngmt/webinterface/lib/host_management_functions.php index 31f358b8..8534371e 100644 --- a/ldap-site-mngmt/webinterface/lib/host_management_functions.php +++ b/ldap-site-mngmt/webinterface/lib/host_management_functions.php @@ -62,7 +62,7 @@ function modify_host_dn($hostDN, $newhostDN){ # Rechner neu anlegen -function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){ +function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts,$dhcp){ global $ds, $suffix, $auDN, $assocdom, $ldapError; @@ -73,7 +73,12 @@ function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){ $entryhost ["hostname"] = $hostname; $entryhost ["domainname"] = $assocdom; if ($hostdesc != ""){$entryhost ["description"] = $hostdesc;} - if ($mac != ""){$entryhost ["hwaddress"] = $mac;} + if ($mac != ""){ + $entryhost ["hwaddress"] = $mac; + if ($dhcp != "none" && $dhcp != ""){ + $entryhost ["dhcphlpcont"] = $dhcp; + } + } foreach (array_keys($atts) as $key){ if ($atts[$key] != ""){ $entryhost[$key] = $atts[$key]; @@ -91,14 +96,25 @@ function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){ print_r($newip); echo "

    "; if (new_ip_host($newip,$hostDN,$auDN)){ echo "IP erfolgreich eingetragen

    "; + if ($mac != "" && $dhcp != "none" && $dhcp != ""){ + $entryfa ["dhcpoptfixed-address"] = "ip"; + if (ldap_mod_add($ds,$hostDN,$entryfa)){ + echo "DHCP Fixed-Address erfolgreich auf IP gesetzt

    "; + }else{ + echo "Fehler beim Setzen der DHCP Fixed-Address

    "; + } + } }else{ echo "Fehler beim eintragen der IP

    "; } }else{ - echo "Falsche IP Syntax! IP nicht eingetragen"; + echo "Falsche IP Syntax! IP nicht eingetragen

    "; } } - + echo "Rechner erfolgreich eingetragen"; + if ($mac != "" && $dhcp != "none" && $dhcp != ""){ + update_dhcpmtime(array()); + } return 1; } else{ diff --git a/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php b/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php index 6fd64737..71ea576f 100644 --- a/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php +++ b/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php @@ -195,7 +195,7 @@ function rbs_adjust_host($hostDN, $rbs){ } # Bei Änderung der TFTP Server IP eines RBS-Objekts entsprechend DHCP Option next-server -# in den Hostobjekten anpassen +# in den Hostobjekten anpassen und DHCP modify time in den AUs aktualisieren function adjust_dhcpnextserver($tftpIP, $rbsDN){ global $ds, $suffix, $ldapError; @@ -224,15 +224,7 @@ function adjust_dhcpnextserver($tftpIP, $rbsDN){ } if ( count($host_au) != 0 ){ $host_au = array_unique($host_au); - $entry ['dhcpmtime'] = time(); - foreach ($host_au as $au){ - $results = ldap_mod_replace($ds,$au,$entry); - if ($results){ - #echo "
    dhcpMTime erfolgreich aktualisiert!
    " ; - }else{ - echo "
    Fehler beim Aktualisieren der dhcpMTime!
    " ; - } - } + update_dhcpmtime($host_au); } } @@ -271,15 +263,7 @@ function adjust_dhcpfilename($initbootfile, $rbsDN, $type){ } if ( count($host_au) != 0 ){ $host_au = array_unique($host_au); - $entry ['dhcpmtime'] = time(); - foreach ($host_au as $au){ - $results = ldap_mod_replace($ds,$au,$entry); - if ($results){ - #echo "
    dhcpMTime erfolgreich aktualisiert!
    " ; - }else{ - echo "
    Fehler beim Aktualisieren der dhcpMTime!
    " ; - } - } + update_dhcpmtime($host_au); } } diff --git a/ldap-site-mngmt/webinterface/rbs/rbservice_change.php b/ldap-site-mngmt/webinterface/rbs/rbservice_change.php index f7557dfb..b39478ba 100644 --- a/ldap-site-mngmt/webinterface/rbs/rbservice_change.php +++ b/ldap-site-mngmt/webinterface/rbs/rbservice_change.php @@ -128,7 +128,17 @@ if ( $rbsoffer != "none" && $rbsoffer != $oldrbsoffer ){ else{ $mesg = "Fehler beim ändern des RBS Offers!

    "; } -} +} + +/*if ( $rbsoffer == "off" && $olddhcpoffer != "" ){ + $entryoffer ['dhcpofferdn'] = array(); + if(ldap_mod_del($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich geändert

    "; + } + else{ + $mesg = "Fehler beim ändern des DHCP Service Offers!

    "; + } +}*/ ##################################### diff --git a/ldap-site-mngmt/webinterface/roles/roles_menu.php b/ldap-site-mngmt/webinterface/roles/roles_menu.php index e389f4e9..62abf05c 100644 --- a/ldap-site-mngmt/webinterface/roles/roles_menu.php +++ b/ldap-site-mngmt/webinterface/roles/roles_menu.php @@ -12,15 +12,16 @@ function createRolesMenu($rollen , $mnr, $assocdom) { array("link" => "role_show.php?role=MainAdmin&mnr=1", "text" => "Main Admins", "zugriff" => array("MainAdmin")), - array("link" => "role_show.php?role=HostAdmin&mnr=2", - "text" => "Host Admins", - "zugriff" => array("MainAdmin")), - array("link" => "role_show.php?role=DhcpAdmin&mnr=3", - "text" => "DHCP Admins", - "zugriff" => array("MainAdmin")), - array("link" => "role_show.php?role=ZoneAdmin&mnr=4", - "text" => "DNS Admins", - "zugriff" => array("MainAdmin"))); + #array("link" => "role_show.php?role=HostAdmin&mnr=2", + # "text" => "Host Admins", + # "zugriff" => array("MainAdmin")), + #array("link" => "role_show.php?role=DhcpAdmin&mnr=3", + # "text" => "DHCP Admins", + # "zugriff" => array("MainAdmin")), + #array("link" => "role_show.php?role=ZoneAdmin&mnr=4", + # "text" => "DNS Admins", + # "zugriff" => array("MainAdmin")) + ); }else{ $hauptmenu = array(array("link" => "roles.php", "text" => "Übersicht", @@ -28,12 +29,13 @@ function createRolesMenu($rollen , $mnr, $assocdom) { array("link" => "role_show.php?role=MainAdmin&mnr=1", "text" => "Main Admins", "zugriff" => array("MainAdmin")), - array("link" => "role_show.php?role=HostAdmin&mnr=2", - "text" => "Host Admins", - "zugriff" => array("MainAdmin")), - array("link" => "role_show.php?role=DhcpAdmin&mnr=3", - "text" => "DHCP Admins", - "zugriff" => array("MainAdmin"))); + #array("link" => "role_show.php?role=HostAdmin&mnr=2", + # "text" => "Host Admins", + # "zugriff" => array("MainAdmin")), + #array("link" => "role_show.php?role=DhcpAdmin&mnr=3", + # "text" => "DHCP Admins", + # "zugriff" => array("MainAdmin")) + ); } # $rollen = array_keys($roles); diff --git a/ldap-site-mngmt/webinterface/roles/roles_start.dwt b/ldap-site-mngmt/webinterface/roles/roles_start.dwt index 22ab0857..665bed3f 100644 --- a/ldap-site-mngmt/webinterface/roles/roles_start.dwt +++ b/ldap-site-mngmt/webinterface/roles/roles_start.dwt @@ -18,7 +18,7 @@ Rollen, IP Adressen und deren Delegierung, Rechner (Gruppen), deren Hardware-Profile und PXE Boot Konfigurationen, sowie die Dienste DHCP und DNS.
  • -
  • Host Admins

    +