[Netpass-devel] NetPass/www/htdocs/Admin autohandler,1.11,1.12 gencfg.mhtml,1.13,1.14 logout.mhtml,1
Brought to you by:
jeffmurphy
From: jeff m. <jef...@us...> - 2005-05-06 03:10:16
|
Update of /cvsroot/netpass/NetPass/www/htdocs/Admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3466/www/htdocs/Admin Modified Files: autohandler gencfg.mhtml logout.mhtml mr.mhtml netgroups.mhtml network.mhtml Log Message: netgroup/network editor UI Index: autohandler =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/autohandler,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- autohandler 4 May 2005 03:09:45 -0000 1.11 +++ autohandler 6 May 2005 03:09:33 -0000 1.12 @@ -14,8 +14,6 @@ if (hostname =~ /-d.cit.buffalo.edu$/) { $serverType = "DEVELOPMENT"; } - - if ($printable == 0) { print qq{<script src="/resources/js/xmlhttp.js" type="text/javascript"></script>}; $m->comp('/style/back/start_sidebar', %ARGS); @@ -25,7 +23,9 @@ <div class="sbHeader"><%$serverType%> SERVER</div> </center> <P> -% if (exists $m->session->{'logged_in'} && ($m->session->{'logged_in'} == 1)) { + +% if (exists $m->session->{'logged_in'} && ($m->session->{'logged_in'} == 1)) { + <center> <div class='sbHeader'>Logged in as <%$m->session->{'username'}%></div> <a class='sbLinks' title='' href="/Admin/logout.mhtml"><I>(Logout)</I></a><BR> @@ -62,13 +62,13 @@ </DIV> <P><P> <BR><H6><I><%join('.', (split(/\./, hostname))[0,1])%></I></H6> -% } + <%perl> + } } # if someone changes our group membership, pick it up right away instead of # requiring a logout/login - $m->session->{'my_groups'} = $np->db->getUserGroups($m->session->{'username'}) if ($m->session->{'logged_in'} && ($m->session->{'username'} ne "")); Index: mr.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/mr.mhtml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- mr.mhtml 4 May 2005 20:22:17 -0000 1.9 +++ mr.mhtml 6 May 2005 03:09:33 -0000 1.10 @@ -171,7 +171,7 @@ $np->db->audit( -user => $user, -mac => $mac, -ip => $ip, - -msg => [ "manually registered by ".$m->session->{'logged_in'} ] + -msg => [ "manually registered by ".$m->session->{'username'} ] ); return ""; Index: logout.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/logout.mhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- logout.mhtml 3 May 2005 16:13:30 -0000 1.3 +++ logout.mhtml 6 May 2005 03:09:33 -0000 1.4 @@ -13,7 +13,12 @@ --></script> <%perl> if (exists $m->session->{'logged_in'}) { + _log("INFO", $m->session->{'username'}." is logging out of Admin tool\n"); + $m->audit(-severity => 'NOTICE', -ip => $ENV{'REMOTE_ADDR'}, + -user => $m->session->{'username'}, + -msg => [ "$username logged out of Admin tool" ]); $m->session->{'logged_in'} = 0; + tied(%{$m->session})->delete; print "Logging out. Please wait..<P>"; print qq{<META HTTP-EQUIV=REFRESH CONTENT="1; URL=/Admin">}; } Index: network.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/network.mhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- network.mhtml 4 May 2005 20:22:17 -0000 1.2 +++ network.mhtml 6 May 2005 03:09:33 -0000 1.3 @@ -21,10 +21,10 @@ RO none </%doc> <%args> - $submit => ''; + $submitButton => ''; + $network => ''; </%args> <%perl> -return unless $m->comp('/Admin/Login', %ARGS); my ($isRoot, $junk) = $m->comp('/Admin/MemberOf', 'acl' => [ 'Admin' ], 'group' => 'default'); if (!$isRoot) { @@ -32,9 +32,8 @@ return; } -# these group names can not be used as 'netgroups' - -my $reservedGroups = { 'default' => 1, 'clientAccess' => 1 }; +my $ip = $ENV{'REMOTE_ADDR'}; +my $whoami = $m->session->{'username'}; # fetch all known networks and netgroups @@ -44,37 +43,103 @@ my $ng = $np->cfg->getNetgroup(-network => $nw); push @$allNetgroups, $ng if ($ng ne "") && (!grep(/^$ng$/, @$allNetgroups)); } +$m->comp('/Admin/LockConfig', 'enableWhenLocked' => [ 'addNetwork', 'submitButton' ], 'init' => 0); +my $WH = "--Select a Network--"; </%perl> <h2> Network Configuration </h2> -% $m->comp('/Admin/LockConfig'); -% my $WH = "-" x 20; + +Notes: +<ul> +<li>Networks are in CIDR notation (A.B.C.D/M) +<li>To add a new network: +<ol> + <li> Click inside the "Add Network.." box. + <li> Type in a network name (CIDR notation only) + <li> Click 'Commit Changes' +</ol> +<LI>To edit a network (once it's been added): +<ol> + <li>Select the network from the drop-down menu. + <LI>Edit it's parameters. + <li>Click 'Commit Changes' +</ol> +</ul> <script language='JavaScript'><!-- -var pageDirty = false; setWhereAmI('Configuration > Network'); +DBG_init(); --></script> <form method="post"> <table border=0> <tr> - <th>Netgroups</th> - <th>Networks</th> -</tr> -<tr> - <td style='text-align:center;'> - <%$q->scrolling_list(-name => 'netgroups', -values => [ $WH, sort @$allNetgroups ], -size => 15, -multiple => 'false')%><BR> - <input id='addNetgroup' name='addNetgroup' size=20 value='Add Netgroup...' disabled> + <td> + <%$q->popup_menu(-id => 'network', -name => 'network', -values => [ $WH, sort @$allNetworks ], -onchange => 'network_onchange_network();')%> </td> - <td style='text-align:center;'> - <%$q->scrolling_list(-name => 'networks', -values => [ $WH, sort @$allNetworks ], -size => 15, -multiple => 'false')%><BR> - <input id='addNetwork' name='addNetwork' size=20 value='Add Network...' disabled> + <td> + <input id='addNetwork' name='addNetwork' size=20 value='Add Network...' disabled + onblur='network_onblur_addNetwork(this);' onfocus='network_onfocus_addNetwork(this);'> + </td> + <td> + <input type='submit' name='submitButton' id='submitButton' value='Commit Changes' disabled> </td> </tr> -</table> -<table id='networkPolicy'> +% if ($network) { +<tr><td colspan=3><PRE> + - comment + - ha enabled/disabled + settings + - primary-redirector + - secondary-redirector + - servers + - virtualip + - garp enabled/disabled + settings + - delay + - number + - netgroup membership (uneditable list + link) + - interface + - nonquar/quar vlan id + - switches (list + add new + link to switch config)</PRE> +</td></tr> +<tr><td colspan=3> +% my $ng = $np->cfg->getNetgroup(-network => $network); +% my $ngtxt = $ng ? qq{<BR>(Part of the "<a href='netgroups.mhtml?netgroups=$ng'>$ng</a>" netgroup)} : ""; +% $m->comp('/Admin/TableEditPolicy', %ARGS, 'tableName' => 'Network General Settings for '.$network.$ngtxt, +% 'showDefault' => 1, 'formatFor' => 'network', +% 'network' => $network, 'suppressKeys' => { 'PID_DIR' => 1, 'BASE_DIR' => 1 } ); +% } +</td></tr> </table> </form> + + + +<script src="/resources/js/common.js" type="text/javascript"></script> +<script src="/resources/js/network.js" type="text/javascript"></script> + + +<%perl> +my $lstat = $np->db->isConfigLocked(); + +if (ref($lstat) eq "HASH") { + # the config is locked + if ($lstat->{'user'} eq $m->session->{'username'}) { + # by us, so show the unlock button + print qq{<script>lockConfig_results("OK lock");lockConfig_enableElements();</script>}; + } else { + # but not by us, show the force unlock button + print qq{<script>lockConfig_results("NOK lock $lstat->{'user'}");lockConfig_disableElements();</script>}; + } +} +elsif ($lstat) { + # there was a problem +} +else { + # the config is not locked, show the lock button + print qq{<script>lockConfig_results("OK unlock");lockConfig_disableElements();</script>}; +} + +</%perl> Index: gencfg.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/gencfg.mhtml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- gencfg.mhtml 4 May 2005 20:22:17 -0000 1.13 +++ gencfg.mhtml 6 May 2005 03:09:33 -0000 1.14 @@ -107,6 +107,43 @@ -size => 3, )%> </TD></TR> + +<TR> +<TD CLASS='left'>Disable Strikes For Manual Quarantine</TD> +<TD CLASS='right'> +<%$q->radio_group ( + -name => 'policy:NO_STRIKES_FOR_MANUAL', + -values => [ 'Yes', 'No' ], + -default => $np->cfg->policy(-key => 'NO_STRIKES_FOR_MANUAL' ) ? "Yes" : "No", + -size => 3, + )%> +</TD> +</TR> + +<TR> +<TD CLASS='left'>Disable Strikes For Snort Quarantine</TD> +<TD CLASS='right'> +<%$q->radio_group ( + -name => 'policy:NO_STRIKES_FOR_SNORT', + -values => [ 'Yes', 'No' ], + -default => $np->cfg->policy(-key => 'NO_STRIKES_FOR_SNORT' ) ? "Yes" : "No", + -size => 3, + )%> +</TD> +</TR> + +<TR> +<TD CLASS='left'>Disable Strikes For Nessus Quarantine</TD> +<TD CLASS='right'> +<%$q->radio_group ( + -name => 'policy:NO_STRIKES_FOR_NESSUS', + -values => [ 'Yes', 'No' ], + -default => $np->cfg->policy(-key => 'NO_STRIKES_FOR_NESSUS' ) ? "Yes" : "No", + -size => 3, + )%> +</TD> +</TR> + <TR> <TD CLASS='left'>RESULTS_DISPLAY</TD> <TD CLASS='right'> Index: netgroups.mhtml =================================================================== RCS file: /cvsroot/netpass/NetPass/www/htdocs/Admin/netgroups.mhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- netgroups.mhtml 5 May 2005 02:19:34 -0000 1.4 +++ netgroups.mhtml 6 May 2005 03:09:33 -0000 1.5 @@ -18,8 +18,6 @@ $networks => ''; </%args> <%perl> -return unless $m->comp('/Admin/Login', %ARGS); - my ($isRoot, $junk) = $m->comp('/Admin/MemberOf', 'acl' => [ 'Admin' ], 'group' => 'default'); if (!$isRoot) { print qq{<p class='error'>Sorry, you don't have access to this form.}; @@ -65,6 +63,8 @@ <h2> Netgroup Configuration </h2> +% $m->comp('/Admin/LockConfig', 'enableWhenLocked' => [ 'addNetgroup', 'submitButton' ], 'init' => 0); + Notes: <ul> <li>Netgroups are not case-sensitive. @@ -88,7 +88,6 @@ </ul> <%perl> -$m->comp('/Admin/LockConfig', 'enableWhenLocked' => [ 'addNetgroup', 'submitButton' ]); my $WH = "-" x 20; if ($submitButton eq 'Commit Changes') { @@ -171,14 +170,14 @@ my $var = $2; if ($section eq "policy") { - if ($ARGS{"usedefault:$var"}) { + if ($ARGS{"override:$var"}) { + $np->cfg->policy(-key => $var, -network => $netgroups, + -val => $ARGS{$ak}); + } else { my $rv2 = $np->cfg->removePolicy(-key => $var, -location => 'group', -network => $netgroups); $rv .= " $rv2" if ($rv2); - } else { - $np->cfg->policy(-key => $var, -network => $netgroups, - -val => $ARGS{$ak}); } } } @@ -222,7 +221,7 @@ </table> <P> % if ($netgroups) { -% $m->comp('/Admin/TableEditPolicy', %ARGS, 'tableName' => 'Netgroup General Settings for '.$netgroups, 'network' => $netgroups, 'suppressKeys' => { 'PID_DIR' => 1, 'BASE_DIR' => 1 } ); +% $m->comp('/Admin/TableEditPolicy', %ARGS, 'tableName' => 'Netgroup General Settings for '.$netgroups, 'network' => $netgroups, 'suppressKeys' => { 'PID_DIR' => 1, 'BASE_DIR' => 1 }, 'showDefault' => 1, 'formatFor' => 'group' ); % } </form> |