]> git.ipfire.org Git - people/dweismueller/ipfire-2.x.git/blobdiff - html/cgi-bin/guardian.cgi
guardian.cgi: Add dropdown to select the used loglevel.
[people/dweismueller/ipfire-2.x.git] / html / cgi-bin / guardian.cgi
index e6bd57b1b1e507712fad5307fe654cda0c300bb8..81e18cca5a48cdce6dc323088c5c21fc15c2fdf2 100644 (file)
@@ -44,9 +44,6 @@ my %cgiparams=();
 # Path to the guardian.ignore file.
 my $ignorefile ='/var/ipfire/guardian/guardian.ignore';
 
-# Path to the guardian.target file.
-my $targetfile ='/var/ipfire/guardian/guardian.ignore';
-
 our %netsettings = ();
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 
@@ -61,7 +58,7 @@ $settings{'GUARDIAN_ENABLED'} = 'off';
 $settings{'GUARDIAN_ENABLE_SNORT'} = 'on';
 $settings{'GUARDIAN_ENABLE_SSH'} = 'on';
 $settings{'GUARDIAN_ENABLE_HTTPD'} = 'on';
-$settings{'GUARDIAN_BLOCKINTERFACES'} ='default';
+$settings{'GUARDIAN_LOGLEVEL'} ='info';
 $settings{'GUARDIAN_BLOCKTIME'} = '86400';
 $settings{'GUARDIAN_LOGFILE'} = '/var/log/guardian/guardian.log';
 $settings{'GUARDIAN_SNORT_ALERTFILE'} = '/var/log/snort/alert';
@@ -234,6 +231,7 @@ if ( ($memory != 0) && (@pid[0] ne "///") ) {
 # Function to display the status of guardian and allow base configuration.
 sub showMainBox() {
        my %checked = ();
+       my %selected = ();
 
        $checked{'GUARDIAN_ENABLED'}{'on'} = '';
        $checked{'GUARDIAN_ENABLED'}{'off'} = '';
@@ -248,6 +246,8 @@ sub showMainBox() {
        $checked{'GUARDIAN_ENABLE_HTTPD'}{'on'} = '';
        $checked{'GUARDIAN_ENABLE_HTTPD'}{$settings{'GUARDIAN_ENABLE_HTTPD'}} = "checked='checked'";
 
+       $selected{'GUARDIAN_LOGLEVEL'}{$settings{'GUARDIAN_LOGLEVEL'}}= 'selected';
+
        &Header::openpage($Lang::tr{'guardian configuration'}, 1, '');
        &Header::openbigbox('100%', 'left', '', $errormessage);
 
@@ -340,6 +340,15 @@ END
                        <tr>
                                <td colspan='2'><br></td>
                        </tr>
+                       <tr>
+                               <td align='left' width='20%'>$Lang::tr{'guardian loglevel'}</td>
+                               <td><select name='GUARDIAN_LOGLEVEL'>
+                                       <option value='off' $selected{'GUARDIAN_LOGLEVEL'}{'off'}>off</option>
+                                       <option value='info' $selected{'GUARDIAN_LOGLEVEL'}{'info'}>info</option>
+                                       <option value='debug' $selected{'GUARDIAN_LOGLEVEL'}{'debug'}>debug</option>
+                               </select></td>
+                       </tr>
+
                        <tr>
                                <td width='20%' class='base'>$Lang::tr{'guardian blocktime'}:</td>
                                <td><input type='text' name='GUARDIAN_BLOCKTIME' value='$settings{'GUARDIAN_BLOCKTIME'}' size='10' /></td>
@@ -592,21 +601,17 @@ sub BuildConfiguration() {
        # We set this to 1 (enabled) to prevent guardian from blocking the ISP gateway.
        my $HostGatewayByte = "1";
 
-       # Grab interface of red network zone.
-       my $red_interface = &General::get_red_interface();
-
        # Open configfile for writing.
        open(FILE, ">$configfile");
 
-       print FILE "Interface                   $red_interface\n";
        print FILE "EnableSnortMonitoring       $settings{'GUARDIAN_ENABLE_SNORT'}\n";
        print FILE "EnableSSHMonitoring         $settings{'GUARDIAN_ENABLE_SSH'}\n";
        print FILE "EnableHTTPDMonitoring       $settings{'GUARDIAN_ENABLE_HTTPD'}\n";
+       print FILE "LogLevel                    $settings{'GUARDIAN_LOGLEVEL'}\n";
        print FILE "HostGatewayByte             $HostGatewayByte\n";
        print FILE "LogFile                     $settings{'GUARDIAN_LOGFILE'}\n";
        print FILE "AlertFile                   $settings{'GUARDIAN_SNORT_ALERTFILE'}\n";
        print FILE "IgnoreFile                  $ignorefile\n";
-       print FILE "TargetFile                  $targetfile\n";
        print FILE "TimeLimit                   $settings{'GUARDIAN_BLOCKTIME'}\n";
 
        close(FILE);