diff options
author | Tarik Gasmi | 2007-09-18 17:18:38 +0200 |
---|---|---|
committer | Tarik Gasmi | 2007-09-18 17:18:38 +0200 |
commit | 12183ece8e4cb1bb81072a72f696572c8b3a07ee (patch) | |
tree | 1e7b274e6a4229d4d1819d4feaabe272b1037a62 /ldap-site-mngmt | |
parent | Added theme.conf for openslx theme for pxe. Only labels should be added autom... (diff) | |
download | core-12183ece8e4cb1bb81072a72f696572c8b3a07ee.tar.gz core-12183ece8e4cb1bb81072a72f696572c8b3a07ee.tar.xz core-12183ece8e4cb1bb81072a72f696572c8b3a07ee.zip |
ldap-site-mngmt: actualized WebIF and DHCPConfig Generationscript
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1340 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'ldap-site-mngmt')
50 files changed, 1410 insertions, 506 deletions
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 (<DAT>){ + 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 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> 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 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Untergeordnete AUs von - <i>{AU}</i> -</h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Untergeordnete AU</b></td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Domain</b></td> + </tr> + + + + <!-- BEGIN DYNAMIC BLOCK: Childaus --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{CHILDOU} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{CHILDDOMAIN} </td> + </tr> + <!-- END DYNAMIC BLOCK: Childaus --> + + </table></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + Zum Verwalten oder Löschen einer untergeordneten AU, wählen Sie links entsprechenden Submenü-Eintrag.<br> + Dort können Sie auch den DNS Domainnamen der untergeordneten AU bearbeiten bzw. neu zuordnen (d.h. im <br> + DNS der Organisation aufnehmen). + </td> + </tr> + +</table>
\ 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 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Administrative Unit - <i>{AU}</i> -</h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td><h4>Im LDAP Verzeichnis gespeicherte Daten:</h4> + Sie können den Namen und die Beschreibung bearbeiten. Zur Verwaltung, der ihnen + zugeordneten IP Adressbereiche benutzen Sie bitte das Modul <b>IP Management</b>.<br> + Wollen Sie ihren DNS Domainnamen ändern so wenden Sie sich an den Haupt-Administrator + ihrer übergeordneten AU - <b>{PARENTAU}</b> + (Email: <b>{EMAILMA}</b> ) + + </td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='au_change.php' method='post'> + + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Name: </b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='commonname' value='{CN}' size='40' class='medium_form_field'> + <input type='hidden' name='oldcn' value='{CN}'> + <input type='hidden' name='audn' value='{AUDN}'> + </td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Bechreibung:</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='description' value='{DSC}' size='40' class='medium_form_field'> + <input type='hidden' name='olddesc' value='{DSC}'> + <input type='hidden' name='audn' value='{AUDN}'> + </td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DNS Domain:</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{DOMAIN} </td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IP Bereiche:</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MIPBS} </td> + </tr> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td><h4>Weitere Statistiken zu Ihrer AU:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr height='1'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Hauptadministratoren:</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>...</td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Anzahl Rechner:</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>...</td> + </tr> + <tr height='45'> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>.... :</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>...</td> + </tr> + </table></td> + </tr> +</table>
\ 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 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - AU Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung ihrer Abteilung oder Administrativen Einheit + (Administrative Unit - AU).<br> + Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> + <ul> + <li><p><b>Eigene AU</b></p> + 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. + + </li> + <li><p><b>Untergeordnete AUs</b></p> + Hier erhalten Sie eine Übersicht Ihrer untergeordneten eigenständigen Administrativen + Einheiten. Sie können diese bearbeiten und löschen. + </li> + <li><p><b>Neue untergeordnete AUs</b></p> + Hier können Sie eine neue untergeordnete eigenständigen AU anlegen. + </li> + </ul> + + </td> + </tr> + +</table>
\ 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 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>AU - <i>{CHILDCN}</i> - verwalten:</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Daten bearbeiten:</h4></td> + </tr> + <tr> + <td height='5'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='childau_change.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (ou):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childou' value='{CHILDOU}' size='40' class='medium_form_field'> + <input type='hidden' name='oldchildou' value='{CHILDOU}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Name der Abteilung (cn): </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childcn' value='{CHILDCN}' size='40' class='medium_form_field'> + <input type='hidden' name='oldchildcn' value='{CHILDCN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DNS Domain :</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childdomain' value='{CHILDDOMAIN}' size='25' class='medium_form_field'> + <input type='hidden' name='oldchilddomain' value='{CHILDDOMAIN}'> + <b><font size="+1">.uni-freiburg.de</font></b> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Delegierte IP Bereiche:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MIPBS} </td> + </tr> + + <input type='hidden' name='childdn' value='{CHILDDN}'> + <input type='hidden' name='submenu' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Untergeordnete AU - <i>{CHILDCN}</i> - löschen:</h4></td> + </tr> + <tr> + <td height='5'></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='childau_delete.php' method='post'> + + <tr> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Wählen Sie einen Modus:<br></td> + + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='radio' name='delmodus' value='integrate' checked></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Nur die untergeordnete AU löschen (nur eine Ebene). <br> + Rechner und DHCP Objekte werden aus dieser in eigene AU integrieren</td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='radio' name='delmodus' value='complete'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Komplett löschen: untergeordnete AU und alle darunter angelegten AUs</td> + </tr> + <input type='hidden' name='childdn' value='{CHILDDN}'> + <input type='hidden' name='oldchilddomain' value='{CHILDDOMAIN}'> + <input type='hidden' name='childou' value='{CHILDOU}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td></tr> + +</table>
\ 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 @@ + +<table cellpadding='0' cellspacing='0' border='0' width='100%'> + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'> +
+ <td width='8%' align='right' style="border-style=none;">{ICON}</td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="74%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + <!-- BEGIN DYNAMIC BLOCK: Submenu --> + + {SUB} + + <!-- END DYNAMIC BLOCK: Submenu --> + + <tr height='5'> + </tr> + + <!-- END DYNAMIC BLOCK: Hauptmenu --> + +</table> 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 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neue untergeordnete AU anlegen:</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute (müssen angegeben werden):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='childau_add.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (ou):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childou' value='{CHILDOU}' size='40' class='medium_form_field'> + </td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>MainAdmin neue AU:</b><br>(Wählen Sie einen Benutzer aus)</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='adduser' size='1' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Users --> + <option value='{UDN}'>{USER}</option> + <!-- END DYNAMIC BLOCK: Users --> + + </select> + <input type='hidden' name='role' value='MainAdmin'> + </td> + </tr> + </table></td> + </tr> + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Optionale Attribute:</h3></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Name der Abteilung (cn): </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childcn' value='{CHILDCN}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DNS Domain :</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childdomain' value='{CHILDDOMAIN}' size='24' class='medium_form_field'> + <b><font size="+1">.uni-freiburg.de</font></b> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung der AU:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='childdesc' value='{CHILDDESC}' size='40' class='medium_form_field'> + </td> + + + </tr> + </table></td> + </tr> + + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Objekte, die Sie in die neue untergeordnete AU verschieben möchten :</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Objekt</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Auswahl</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Rechner:</b><br> + (Wählen Sie die zu verschiebenden Rechner aus, <br>Mehrfachauswahl möglich)</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='addhost[]' size='{HOSTNUMBER}' class='medium_form_selectbox' multiple> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}_{HOSTNAME}'>{HOSTNAME}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + </select> + </td> + </tr> + </table></td> + </tr> + + <tr> + <td height='5'></td> + </tr> + <tr> + <td style='border-width: 0 0 0 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ 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<count($computers_array);$n++){ $comps[] = array("link" => "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, "text" => $computers_array[$n]['hostname'], "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); # print_r($comps); echo "<br>"; - - - } - #} - $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= " - <tr height='3'> + <tr height='4'> <td></td><td></td><td></td><td></td> </tr> <tr> <td width='8%'> </td> <td width='8%' align='right'>".$zwisch2."</td> - <td width='5%' align='left' style='border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:2;background-color:{FARBE_S}'> </td>
- <td width='69%' align='left' style='border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:2;padding-left:15px;background-color:{FARBE_S}'> + <td width='5%' align='left' style='border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:4;background-color:{FARBE_S}'> </td>
+ <td width='69%' align='left' style='border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:4;padding-left:12px;background-color:{FARBE_S}'> <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> <td width='10%'> </td> </tr> 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. </li> - <li><p><b>Default MachineConfig</b></p> + <!-- <li><p><b>Default MachineConfig</b></p> Hier verwalten Sie ihre Default Computer-Profile (bearbeiten, löschen, kopieren), d.h. Computer-Profile, die beim booten von Rechnern verwendet werden, für die keine rechner- oder gruppen-spezifischen MachineConfigs angelegt sind. @@ -29,7 +29,7 @@ <li><p><b>Neue MachineConfig</b></p> Hier köennen Sie neue Computer-Profile (MachineConfigs) als rechner-, gruppen- spezifische, oder Default MachineConfigs anlegen. - </li> + </li> --> <li><p><b>Neues PXE Bootmenü</b></p> 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:<br><br> <input type='hidden' name='dn' value='".$dn."'> <input type='hidden' name='name' value='".$name."'> + <input type='hidden' name='dhcphlpcont' value='".$dhcphlpcont."'> <input type='hidden' name='successurl' value='".$successurl."'> <input type='hidden' name='pxedn' value='".$pxedn."'> <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> 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 @@ </tr> {HOST_DHCPOPT} + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Default Lease Time:</b></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> + </td> + </tr> </table></td> </tr> 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 "<br><br>"; $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 "<br>"; $sub = array_search('dhcpSubnet', $ocarray['objectclass']); #print_r($sub); @@ -89,7 +92,8 @@ if ($dhcphlpcont == ""){ $expsub = explode('=',$exp0[0]); $dhcpsub = $expsub[1]; $dhcp .= "Subnet <b>".$dhcpsub."</b> / "; $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 == ""){ <td class='tab_d_ohne'> </td> </tr> <tr valign='top'> - <td class='tab_d'><b>fixed-address:</b> </td> - <td class='tab_d'>".$fixedaddress." </td> - <td class='tab_d'> + <td class='tab_d_ohne'><b>fixed-address:</b> </td> + <td class='tab_d_ohne'>".$fixedaddress." </td> + <td class='tab_d_ohne'> <select name='fixadd' size='3' class='medium_form_selectbox'> ".$fixedaddselopt." </select> @@ -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" => "<a href='host.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", "RBSLINK" => "<a href='rbshost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", "HWLINK" => "<a href='hwhost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", 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 "<br><br>"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "<br><br>"; /*echo "new dhcp:"; print_r($dhcp); echo "<br>"; echo "old dhcp:"; print_r($olddhcp); echo "<br>"; @@ -53,7 +67,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ if ($olddhcp != ""){ echo "DHCP replace "; print_r($olddhcp); echo " with "; print_r($entrydhcp); echo "<br>"; if ($result = ldap_mod_replace($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich in DHCP <b>".$dhcpcn." [Abt.: ".$dhcpau."]</b> angemeldet<br><br>"; }else{ $mesg = "Fehler beim ändern des DHCP Dienstes zu <b>".$dhcpcn."</b>!<br><br>"; @@ -64,7 +78,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ } echo "DHCP add "; print_r($entrydhcp); echo "<br>"; if ($result = ldap_mod_add($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich in DHCP <b>".$dhcpcn." [Abt.: ".$dhcpau."]</b> angemeldet<br><br>"; }else{ $mesg = "Fehler beim ändern des DHCP Dienstes zu <b>".$dhcpcn."</b>!<br><br>"; @@ -80,7 +94,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ #} echo "DHCP delete "; echo "<br>"; if ($result = ldap_mod_del($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich aus DHCP gelöscht<br><br>"; }else{ $mesg = "Fehler beim löschen aus DHCP Dienst!<br><br>"; @@ -99,7 +113,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ if ($oldfixedaddress != ""){ echo "Fixed Address ändern"; echo "<br>"; if ($result = ldap_mod_replace($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich auf <b>".$fixedaddress."</b> geändert<br><br>"; }else{ $mesg = "Fehler beim ändern der Option Fixed-Address auf <b>".$fixedaddress."</b>!<br><br>"; @@ -107,7 +121,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ }else{ echo "Fixed Address auf IP Adresse setzen"; echo "<br>"; if ($result = ldap_mod_add($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich auf <b>".$fixedaddress."</b> gesetzt<br><br>"; }else{ $mesg = "Fehler beim setzen der Option Fixed-Address auf <b>".$fixedaddress."</b>!<br><br>"; @@ -117,7 +131,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ $entryfixadd ['dhcpoptfixed-address'] = array(); echo "No Fixed Address"; echo "<br>"; if ($result = ldap_mod_del($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich gelöscht<br><br>"; }else{ $mesg = "Fehler beim löschen der Option Fixed-Address!<br><br>"; @@ -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 "<br>"; +#print_r($entrymod); echo "<br>"; +#print_r($entrydel); echo "<br>"; + + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "<br>"; + #echo "neu anlegen<br>"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_add($ds,$hostDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "<br>"; + #echo "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$hostDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "<br>"; + #echo "löschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$hostDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + ##################### 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 = "<a href='group.php?dn=".$group['dn']."&sbmnr=".$i."' class='headerlink'>".$group['cn']."</a>"; $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 @@ <input type='hidden' name='dn' value='{HOSTDN}'> <input type='hidden' name='name' value='{HOSTNAME}'> + <input type='hidden' name='dhcphlpcont' value='{DHCPCONT}'> <input type='hidden' name='delurl' value='host_delete.php'> <input type='hidden' name='backurl' value='host.php?dn={HOSTDN}&sbmnr={SBMNR}'> 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 "<br>"; - if (add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts)){ + if (add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts,$dhcp)){ $mesg .= "<br>Neuer Rechner erfolgreich angelegt<br>"; } else{ $mesg .= "<br>Fehler beim anlegen des Rechners!<br>"; } + # 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 "<br>"; echo "submenuNR:"; print_r($submenu); echo "<br><br>"; */ -$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 "<br><br>"; 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 "<br><br>"; if (new_ip_host($newip,$hostDN,$auDN)){ $mesg = "IP erfolgreich eingetragen<br><br>"; - 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<br><br>"; } @@ -389,8 +390,9 @@ if (count($entrydel) != 0 ){ } */ - -update_dhcpmtime(); +if ( $dhcphlpcont != "" ){ + update_dhcpmtime(array()); +} $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; 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 <b>".$hostname."</b> erfolgreich gelöscht!<br><br>"; } 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 @@ <input type='Text' name='attribs[hw-monitor]' value='{MONITOR}' size='30' class='medium_form_field'> </td> </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='dhcpcont' size='2' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + {DHCPSELECT} + </select> + </td> + </tr> </table></td> </tr> 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 .= " + <option value='".$item['dn']."'>".$item['cn']." ".$item['au']."</option>"; + } +} $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 == ""){ </tr>"; $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<count($defaultpxeconfigs);$i++){ - if ($defaultpxeconfigs[$i]['filename'] == "default"){ - $defpxelink = "<a href='showpxe.php?dn=".$defaultpxeconfigs[$i]['dn']."&mnr=1&sbmnr=".$sbmnr."&mcnr=-1&hostdn=".$hostDN."' class='headerlink'>".$defaultpxeconfigs[$i]['cn']."</a>"; - - $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 <br> "; - } - }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<count($defaultpxeconfigs);$i++){ + if ($defaultpxeconfigs[$i]['filename'] == "default"){ + $defpxelink = "<a href='showpxe.php?dn=".$defaultpxeconfigs[$i]['dn']."&mnr=1&sbmnr=".$sbmnr."&mcnr=-1&hostdn=".$hostDN."' class='headerlink'>".$defaultpxeconfigs[$i]['cn']."</a>"; + + $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 <br> "; + } + }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 "<br>"; if ($result = ldap_mod_replace($ds,$hostDN,$entryrbs)){ - update_dhcpmtime(); + update_dhcpmtime(array()); rbs_adjust_host($hostDN, $rbs); $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn." [Abt.: ".$rbsau."]</b> geändert<br><br>"; }else{ @@ -62,7 +62,7 @@ if ($rbs != "none" && $rbs != $oldrbs){ }else{ echo "RBS add "; print_r($entryrbs); echo "<br>"; if ($result = ldap_mod_add($ds,$hostDN,$entryrbs)){ - update_dhcpmtime(); + update_dhcpmtime(array()); rbs_adjust_host($hostDN, $rbs); $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn." [Abt.: ".$rbsau."]</b> geändert<br><br>"; }else{ @@ -75,7 +75,7 @@ if ($rbs != "none" && $rbs != $oldrbs){ $entryrbs ['dhcpoptfilename'] = array(); echo "RBS delete "; echo "<br>"; if ($result = ldap_mod_del($ds,$hostDN,$entryrbs)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich aus RBS gelöscht<br><br>"; }else{ $mesg = "Fehler beim löschen aus RBS!<br><br>"; 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 @@ <td colspan='2'><h3>Dynamische DHCP Pools </h3></td> </tr> - <tr><td> - <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> - - <form action='dhcppools_change.php' method='post'> - - <tr> - <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Subnetz</b></td> - <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Ranges (innerhalb Subnetz)</b></td> - <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Unknown Clients</b></td> - </tr> - - <!-- BEGIN DYNAMIC BLOCK: Dhcppools --> - <tr height='50' valign='top'> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>{SUBNET}/24</b><br><br> - <input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'> - Pool löschen (Häkchen setzen)</td> - - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <!-- BEGIN DYNAMIC BLOCK: Dhcpranges --> - <input type='Text' name='range1[]' value='{RANGE1}' size='15' maxlength='15' class='medium_form_field'> - - - <input type='Text' name='range2[]' value='{RANGE2}' size='15' maxlength='15' class='medium_form_field'> - <input type='hidden' name='oldrange1[]' value='{RANGE1}'> - <input type='hidden' name='oldrange2[]' value='{RANGE2}'><br> - <input type='hidden' name='rangepooldn[]' value='{RPOOLDN}'> - <!-- END DYNAMIC BLOCK: Dhcpranges --> - - <input type='Text' name='addrange1[]' value='' size='15' maxlength='15' class='medium_form_field'> - - - <input type='Text' name='addrange2[]' value='' size='15' maxlength='15' class='medium_form_field'> - </td> - - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <select name='unknownclients[]' size='3' class='small_form_selectbox'> - {UCSELECT} - </select> - <input type='hidden' name='olduc[]' value='{UCNOW}'> - </td> - </tr> - <!--<tr> - <td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'> - Pool löschen (Häkchen setzen)</td> - </tr>--> - - <input type='hidden' name='pooldn[]' value='{POOLDN}'> - <input type='hidden' name='subnet[]' value='{SUBNET}'> - <!-- END DYNAMIC BLOCK: Dhcppools --> - - <input type='hidden' name='mnr' value='{MNR}'> - - </table></td> - </tr> - <tr> - <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> - </form></td> - </tr> - - <tr> - <td height='50'></td> - </tr> - + <!-- BEGIN DYNAMIC BLOCK: Poolform --> + {POOLFORMULAR} + <!-- END DYNAMIC BLOCK: Poolform --> + <tr> <td colspan='2'><h4>Dynamischen DHCP Pool hinzufügen </h4></td> </tr> @@ -73,18 +16,18 @@ <form action='dhcppool_add.php' method='post'> <tr valign='bottom'> - <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Range (innerhalb eines Subnetzes)</b><br> + <td width='50%' class='tab_h'><b>IP Range (innerhalb eines Subnetzes)</b><br> weitere Ranges können später hinzugefügt werden</td> - <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Unknown Clients</b></td> + <td width='50%' class='tab_h'><b>Unknown Clients</b></td> </tr> <tr height='50' valign='top'> - <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <td class='tab_d'> <input type='Text' name='addrange1' value='' size='15' maxlength='15' class='medium_form_field'> - <input type='Text' name='addrange2' value='' size='15' maxlength='15' class='medium_form_field'> </td> - <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <td class='tab_d'> <select name='unknownclients' size='3' class='small_form_selectbox'> <option selected value='deny'> DENY </option> <option value='allow'> ALLOW </option> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool.php b/ldap-site-mngmt/webinterface/dhcp/dhcppool.php index dd648f49..2d7da0ff 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcppool.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool.php @@ -3,7 +3,7 @@ include('../standard_header.inc.php'); # 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. $titel = "DHCP Service Management"; -# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +# 2. Nummern der zugehörigen Menus. $mainnr = 5; $mnr = 3; $sbmnr = -1; @@ -11,7 +11,6 @@ $sbmnr = -1; $webseite = "dhcppool.dwt"; include("../class.FastTemplate.php"); - include('dhcp_header.inc.php'); @@ -28,36 +27,119 @@ include("ip_blocks.inc.php"); ################################################################################### -$template->assign(array("POOLDN" => "", +$template->define_dynamic("Poolform", "Webseite"); +$template->assign(array("POOLFORMULAR" => "", + #"POOLDN" => "", "CN" => "", "SUBNETDN" => "", - "SUBNET" => "", - "RANGE1" => "", - "RANGE2" => "", + #"SUBNET" => "", + #"RANGE1" => "", + #"RANGE2" => "", "DESCRIPTION" => "", "STATEMENTS" => "", - "ALLOW" => "", - "DENY" => "", - "IGNORE" => "", "DEFAULTLEASE" => "", "MAXLEASE" => "", "MNR" => $mnr)); -# DHCP Subnet Daten -#$dhcppoolDN = $_GET['dn']; +# 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); #print_r($pools); + +if (count($pools) != 0){ + + + +$poolform = " + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcppools_change.php' method='post'> + + <tr> + <td width='30%' class='tab_h'><b>Subnetz</b></td> + <td width='50%' class='tab_h'><b>IP Ranges (innerhalb Subnetz)</b></td> + <td width='20%' class='tab_h'><b>Unknown Clients</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Dhcppools --> + + <tr height='50' valign='top'> + <td class='tab_d'><b>{SUBNET}/24</b><br><br> + <input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'> + Pool löschen (Häkchen setzen)</td> + + <td class='tab_d'> + + <!-- BEGIN DYNAMIC BLOCK: Dhcpranges --> + + <input type='Text' name='range1[]' value='{RANGE1}' size='15' maxlength='15' class='medium_form_field'> + - + <input type='Text' name='range2[]' value='{RANGE2}' size='15' maxlength='15' class='medium_form_field'> + <input type='hidden' name='oldrange1[]' value='{RANGE1}'> + <input type='hidden' name='oldrange2[]' value='{RANGE2}'><br> + <input type='hidden' name='rangepooldn[]' value='{RPOOLDN}'> + + <!-- END DYNAMIC BLOCK: Dhcpranges --> + + <input type='Text' name='addrange1[]' value='' size='15' maxlength='15' class='medium_form_field'> + - + <input type='Text' name='addrange2[]' value='' size='15' maxlength='15' class='medium_form_field'> + </td> + + <td class='tab_d'> + <select name='unknownclients[]' size='3' class='small_form_selectbox'> + {UCSELECT} + </select> + <input type='hidden' name='olduc[]' value='{UCNOW}'> + </td> + </tr> + <!--<tr> + <td colspan='3' class='tab_d'><input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'> + Pool löschen (Häkchen setzen)</td> + </tr>--> + + <input type='hidden' name='pooldn[]' value='{POOLDN}'> + <input type='hidden' name='subnet[]' value='{SUBNET}'> + <input type='hidden' name='subnetau[]' value='{SUBNETAU}'> + + <!-- END DYNAMIC BLOCK: Dhcppools --> + + <input type='hidden' name='mnr' value='{MNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='50'></td> + </tr>"; + +$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 = "<option selected value='allow'> ALLOW </option> @@ -102,28 +181,24 @@ foreach ($pools as $pool){ $ucselectbox = "<option selected value='deny'> DENY </option> <option value='allow'> ALLOW </option> <option value='ignore'> IGNORE </option>"; - } - + } $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"<br><br>"; + 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 "<br>Neue FIPBs erfolgreich eingetragen!<br>"; - - # DHCP Subnet DN finden - $subnet = implode(".", array($fs[0],$fs[1],$fs[2],"0")); - print_r($subnet);echo"<br><br>"; - 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){ - $result = add_dhcppool($result[0]['dn'],$range,$unknownclients,$result[0]['dhcphlpcont']); + $result = ldapArraySauber($result); + #print_r($result);echo "<br><br>"; + 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 "<br>Neue FIPBs erfolgreich eingetragen!<br>"; + $result = add_dhcppool($subnetdn,$range,$unknownclients,$result[0]['dhcphlpcont']); if ($result){ echo "<br>Dynamischer DHCP Pool erfolgreich eingetragen!<br>" ; - update_dhcpmtime(); + update_dhcpmtime(array($subnetau)); }else{ echo "<br>Fehler beim eintragen des dynamischen DHCP Pools!<br>"; # 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!<br>"; - } - }else{ - echo "<br>Fehler beim eintragen der FIPBs!<br>"; - } + } + }else{ + echo "<br>Fehler beim eintragen der FIPBs!<br>"; + } + }else{ + printf("<br>IP Range %s ist nicht im verfuegbaren Bereich!<br>", $range ); + } }else{ - printf("<br>IP Range %s ist nicht im verfuegbaren Bereich!<br>", $range ); - } + echo "DHCP Subnet nicht im System vorhanden!<br>"; + } }else{ echo "erster Range Wert grösser als zweiter Range Wert<br>"; } 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 "<br>"; #print_r($subnet); echo "<br>"; +#print_r($subnetau); echo "<br>"; #print_r($delpool); echo "<br><br>"; #print_r($oldrange1); echo "<br>"; #print_r($oldrange2); echo "<br>"; @@ -33,9 +40,7 @@ $olduc = $_POST['olduc']; #print_r($olduc); echo "<br><br>"; #print_r($uc); echo "<br><br>"; -$mnr = $_POST['mnr']; - -$seconds = 2000; +$seconds = 200; $url = "dhcppool.php?mnr=".$mnr; echo " @@ -48,9 +53,9 @@ echo " <table border='0' cellpadding='30' cellspacing='0'> <tr><td>"; - +######################################################################################### +# Pools löschen, entsprechende Arrays ($pooldn, $uc, ...) zur weiteren Verarbeitung anpassen for ($i=0;$i<count($delpool);$i++){ - # Löschen und Arrays $pooldn, $uc, ... und $rpooldn anpassen zur weiteren Verarbeitung $key = array_keys ( $pooldn, $delpool[$i] ); $key_r = array_keys ( $rangepooldn, $delpool[$i] ); @@ -71,6 +76,8 @@ for ($i=0;$i<count($delpool);$i++){ $delete = ldap_delete($ds,$delpool[$i]); if ($delete){ + # Subnet-AU auf DHCP-Modify setzen + $au_to_update [] = $subnetau[$i]; # Arrays von gelöschten Pools für weitere Verarbeitung bereinigen foreach ( $key as $nr ){ array_splice ( &$pooldn, $nr, 1 ); @@ -98,22 +105,25 @@ for ($i=0;$i<count($delpool);$i++){ } } - +######################################################################################### +# Änderungen in bestehenden Pools (unknown-clients) und Ranges hinzufügen for ($i=0;$i<count($pooldn);$i++){ $entrydel = array(); $entryadd = array(); # DENY, ALLOW, IGNORE Unknown-clients verarbeiten if ( $uc[$i] != $olduc[$i] ){ - printf("Unknown-Clients für Pool %s ändern<br>", $pooldn[$i]); $dhcpoptdel = "dhcpopt".$olduc[$i]; $entrydel [$dhcpoptdel] = array(); - print_r($entrydel); echo "<br>"; + #print_r($entrydel); echo "<br>"; ldap_mod_del($ds,$pooldn[$i],$entrydel); $dhcpoptadd = "dhcpopt".$uc[$i]; $entryadd [$dhcpoptadd] = "unknown-clients"; - print_r($entryadd); echo "<br><br>"; + #print_r($entryadd); echo "<br><br>"; ldap_mod_add($ds,$pooldn[$i],$entryadd); + printf("Pool %s:<br>DHCP Option <b>unknown-clients</b> von <b>%s</b> auf <b>%s</b> geändert<br><br>",$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<count($pooldn);$i++){ $newrange = implode("_", array($addrange1[$i],$addrange2[$i])); $result = add_dhcprange($newrange,$pooldn[$i]); if ($result){ + # Subnet-AU auf DHCP-Modify setzen + $au_to_update [] = $subnetau[$i]; printf("Neue dynamische IP Range %s - %s erfolgreich in Subnetz %s0 eingetragen!<br>",$addrange1[$i],$addrange2[$i],$net); }else{ echo "<br>Fehler beim eintragen des dynamischen DHCP Pools!<br>"; @@ -143,7 +155,9 @@ for ($i=0;$i<count($pooldn);$i++){ } -# bereits angelegte Ranges verarbeiten (löschen, verkleinern, vergrößern) +######################################################################################### +# In Pools bereits angelegte Ranges verarbeiten (löschen, verkleinern, vergrößern) +# vorzunehmende Änderungen in Arrays ($mod_dhcpranges, $new_fibs) speichern $fipbs = get_freeipblocks_au($auDN); $new_fipbs ['freeipblock'] = $fipbs; $mod_dhcpranges = array(); @@ -161,6 +175,8 @@ for ($i=0;$i<count($rangepooldn);$i++){ array_splice ( &$mod_dhcpranges[$rangepooldn[$i]], $range_key, 1 ); array_splice ( &$poolranges[$rangepooldn[$i]], $range_key, 1 ); $new_fipbs ['freeipblock'][] = $oldrange; + # Subnet-AU auf DHCP-Modify setzen + $au_to_update [] = $subnetau[$i]; } elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $range1[$i] != "" && $range2[$i] != "" ){ $or1 = ip2long($oldrange1[$i]); @@ -179,6 +195,8 @@ for ($i=0;$i<count($rangepooldn);$i++){ #print_r($range_key); echo "<br>"; $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<count($rangepooldn);$i++){ } if ( $test ){ $poolranges [$rangepooldn[$i]][] = $ar; - $mod_dhcpranges [$rangepooldn[$i]][] = $ar; + $mod_dhcpranges [$rangepooldn[$i]][] = $ar; + # Subnet-AU auf DHCP-Modify setzen + $au_to_update [] = $subnetau[$i]; } } }else{ @@ -222,9 +242,11 @@ for ($i=0;$i<count($rangepooldn);$i++){ #} } } - #print_r($mod_dhcpranges); echo "<br>"; #print_r($new_fipbs); echo "<br><br>"; + +######################################################################################### +# 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 "<br>"; @@ -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 "<br>Subnet-AU: ";print_r ($au_to_update); echo "<br>"; +update_dhcpmtime($au_to_update); + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; 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<br> Keine Änderung!"; } if ( $dhcpoffer != "off" && $dhcpoffer != $olddhcpoffer ){ $entryoffer ['dhcpofferdn'] = $dhcpoffer; - if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){ - $mesg = "DHCP Service Offer erfolgreich geändert<br><br>"; + if ($olddhcpoffer == ""){ + # Offer anlegen + if(ldap_mod_add($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich angelegt<br><br>"; + } + else{ + $mesg = "Fehler beim ändern des DHCP Service Offers!<br><br>"; + } } else{ - $mesg = "Fehler beim ändern des DHCP Service Offers!<br><br>"; + # Offer ändern + if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich geändert<br><br>"; + } + else{ + $mesg = "Fehler beim ändern des DHCP Service Offers!<br><br>"; + } } } - /*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<br><br>"; + $mesg = "DHCP Service Offer erfolgreich gelöscht<br><br>"; + cleanup_del_dhcpservice ($dhcpDN); } else{ $mesg = "Fehler beim ändern des DHCP Service Offers!<br><br>"; } - }*/ + } } @@ -133,7 +146,7 @@ if ( $adddhcpoptdefinition != "" ){ $entryadd['optiondefinition'] = $adddhcpoptdefinition; if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Selbst-definierte DHCP Option erfolgreich eingetragen<br><br>"; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim eintragen Selbst-definierte DHCP Option<br><br>"; } @@ -176,7 +189,7 @@ if (count($entryadd) != 0 ){ } if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; } @@ -188,7 +201,7 @@ if (count($entrymod) != 0 ){ } if(ldap_mod_replace($ds,$dhcpDN,$entrymod)){ $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; } @@ -200,7 +213,7 @@ if (count($entrydel) != 0 ){ } if(ldap_mod_del($ds,$dhcpDN,$entrydel)){ $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; } 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 @@ </tr> <tr> - <td colspan='2'><h3>DHCP Subnet <code class='font_object'> {CN} </code> </h3></td> + <td colspan='2'><h3>DHCP Subnet <code class='font_object'> {CN} / {NETMASK} </code> </h3></td> </tr> <tr><td> <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> @@ -17,7 +17,7 @@ <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> </tr> - <tr height='50'> + <!-- <tr height='50'> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Subnet (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> <input type='Text' name='cn' value='{CN}' size='15' maxlength='15' class='medium_form_field'> @@ -30,7 +30,7 @@ <input type='Text' name='netmask' value='{NETMASK}' size='15' maxlength='15' class='medium_form_field'> <input type='hidden' name='oldnetmask' value='{NETMASK}'> </td> - </tr> + </tr> --> <tr valign='top'> <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Eingebunden in DHCP Dienst: <b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{DHCPSVNOW} @@ -107,17 +107,17 @@ </tr> <tr> - <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Default Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Routers:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> - <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='30' class='medium_form_field'> - <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> + <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptrouters]' value='{ROUTERS}'> </td> </tr> <tr> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='30' class='medium_form_field'> - <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Broadcast Address:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptbroadcast-address]' value='{BROADCAST}'> </td> </tr> <tr> @@ -135,26 +135,26 @@ </td> </tr> <tr> - <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Routers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Default Lease Time:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> - <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'> - <input type='hidden' name='oldattribs[dhcpoptrouters]' value='{ROUTERS}'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> </td> </tr> <tr> - <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Broadcast Address:</b></td> - <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> - <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'> - <input type='hidden' name='oldattribs[dhcpoptbroadcast-address]' value='{BROADCAST}'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> </td> </tr> - <tr> + <!-- <tr> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> <input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'> <input type='hidden' name='oldattribs[dhcpoptntp-servers]' value='{NTPSERVERS}'> </td> - </tr> + </tr> --> <tr> <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Allow:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> 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 .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; 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 <b>".$cn."</b> erfolgreich gelöscht!<br><br>"; - update_dhcpmtime(); + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim löschen des Subnets <b>".$cn."</b> !<br><br>"; } 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 @@ </tr> <tr height='50'> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'> - </td> - </tr> - <tr height='50'> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Routers:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'> + <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'> </td> </tr> <tr height='50'> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DDNS Update Style:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Broadcast Address:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <input type='Text' name='attribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}' size='40' class='medium_form_field'> + <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'> </td> </tr> <tr height='50'> @@ -107,15 +101,15 @@ </td> </tr> <tr height='50'> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Routers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'> </td> </tr> <tr height='50'> - <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Broadcast Address:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'> </td> </tr> <!-- <tr height='50'> @@ -129,13 +123,13 @@ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> <input type='Text' name='attribs[dhcpoptfilename]' value='{FILENAME}' size='40' class='medium_form_field'> </td> - </tr> --> + </tr> <tr height='50'> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td> <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> <input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'> </td> - </tr> + </tr>--> <input type='hidden' name='mnr' value='{MNR}'> <input type='hidden' name='sbmnr' value='{SBMNR}'> 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 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - DNS Zonen Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul steht noch nicht zur Verfügung ...<br> + + </td> + </tr> + +</table>
\ 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<br>"; - update_dhcpmtime(); + # falls Rechner in DHCP -> fixed-address auf IP Setzen... + # und update_dhcpmtime(array()); }else{$mesg = "Fehler beim eintragen der neuen IP Adresse<br>";} }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<br>"; adjust_hostip_tftpserverip($oldip[$i],$newip[$i]); - update_dhcpmtime(); + # Falls Rechner in DHCP + update_dhcpmtime(array()); }else{ $mesg = "Fehler beim aendern der IP Adresse<br>"; # 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<br>"; 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<br>";} $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> 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. </li> - <li><p><b>IP Adressen DHCP</b></p> + <!-- <li><p><b>IP Adressen DHCP</b></p> In diesem Bereich koennen Sie die IP Adressen verwalten, die Sie fuer den DHCP Dienst reservieren. D.h. die IP Adress Ranges, welche Sie DHCP Subnetzen oder Pools zugewiesen haben zur dynamischen IP Adresszuweisung. - </li> + </li> --> <li><p><b>Delegierte IP Adressen</b></p> 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 "<br><b>dhcpMTime</b> erfolgreich aktualisiert!<br>" ; - return 1; + echo "<br><b>dhcpMTime</b> erfolgreich in AU ".$auDN." aktualisiert!<br>" ; + #return 1; }else{ echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ; } + + # 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 <b>DHCP-Manager</b> 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 "<b>dhcpMTime</b> erfolgreich in AU ".$au." aktualisiert!<br>" ; + #return 1; + }else{ + echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ; + } + } + 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 "<br>"; @@ -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 "<br>";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 <b>%s / %s</b> 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 "<br>FIPBs erfolgreich angepasst!<br>" ; 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 "<br><br>"; if (new_ip_host($newip,$hostDN,$auDN)){ echo "IP erfolgreich eingetragen<br><br>"; + if ($mac != "" && $dhcp != "none" && $dhcp != ""){ + $entryfa ["dhcpoptfixed-address"] = "ip"; + if (ldap_mod_add($ds,$hostDN,$entryfa)){ + echo "DHCP Fixed-Address erfolgreich auf IP gesetzt<br><br>"; + }else{ + echo "Fehler beim Setzen der DHCP Fixed-Address<br><br>"; + } + } }else{ echo "Fehler beim eintragen der IP<br><br>"; } }else{ - echo "Falsche IP Syntax! IP nicht eingetragen"; + echo "Falsche IP Syntax! IP nicht eingetragen<br><br>"; } } - + 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 "<br><b>dhcpMTime</b> erfolgreich aktualisiert!<br>" ; - }else{ - echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ; - } - } + 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 "<br><b>dhcpMTime</b> erfolgreich aktualisiert!<br>" ; - }else{ - echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ; - } - } + 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!<br><br>"; } -} +} + +/*if ( $rbsoffer == "off" && $olddhcpoffer != "" ){ + $entryoffer ['dhcpofferdn'] = array(); + if(ldap_mod_del($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich geändert<br><br>"; + } + else{ + $mesg = "Fehler beim ändern des DHCP Service Offers!<br><br>"; + } +}*/ ##################################### 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. </li> - <li><p><b>Host Admins</b></p> + <!-- <li><p><b>Host Admins</b></p> Diese verwalten Rechner (Gruppen), deren Hardware-Profile und PXE Boot Konfigurationen, und koennen diese im DHCP und DNS anmelden (verwalten im DNS nur deren Namenseintraege). </li> @@ -28,7 +28,7 @@ <li><p><b>DNS Admins</b></p> Sind die Administratoren der mit der AU assozierten DNS Zone. D.h. sie verwalten SOA, Include Direktiven untergeordneter Include Files, sowie alle Nameneintraege der Zone. - </li> + </li> --> </ul> </td> 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))){ </html> "; 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 "<br>";} + + $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 "<br>";} - -$domprefix = str_replace('.'.$domsuffix,'',$assocdom); -# print_r($domprefix); ?>
\ No newline at end of file |