X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fids.cgi;h=bc066a0dc31e3dd95f14ffa2b8f97e007535f564;hb=a27c40a05bda1e3dc64954c0550ec32bc84c6763;hp=7da270c97ecd23f1e2598fca216245703760d239;hpb=48a2495afd78163adfd984689ab1c08091fdd2d3;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 7da270c97e..bc066a0dc3 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2005-2011 IPFire Team # +# Copyright (C) 2007-2015 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -55,16 +55,7 @@ $snortsettings{'ENABLE_SNORT'} = 'off'; $snortsettings{'ENABLE_SNORT_GREEN'} = 'off'; $snortsettings{'ENABLE_SNORT_BLUE'} = 'off'; $snortsettings{'ENABLE_SNORT_ORANGE'} = 'off'; -$snortsettings{'ENABLE_GUARDIAN'} = 'off'; -$snortsettings{'GUARDIAN_INTERFACE'} = `cat /var/ipfire/red/iface`; -$snortsettings{'GUARDIAN_HOSTGATEWAYBYTE'} = '1'; -$snortsettings{'GUARDIAN_LOGFILE'} = '/var/log/guardian/guardian.log'; -$snortsettings{'GUARDIAN_ALERTFILE'} = '/var/log/snort/alert'; -$snortsettings{'GUARDIAN_IGNOREFILE'} = '/var/ipfire/guardian/guardian.ignore'; -$snortsettings{'GUARDIAN_TARGETFILE'} = '/var/ipfire/guardian/guardian.target'; -$snortsettings{'GUARDIAN_TIMELIMIT'} = '86400'; $snortsettings{'ACTION'} = ''; -$snortsettings{'ACTION2'} = ''; $snortsettings{'RULES'} = ''; $snortsettings{'OINKCODE'} = ''; $snortsettings{'INSTALLDATE'} = ''; @@ -263,13 +254,11 @@ if (-e "/etc/snort/snort.conf") { ####################### End added for snort rules control ################################# if ($snortsettings{'RULES'} eq 'subscripted') { - #$url="http://dl.snort.org/sub-rules/snortrules-snapshot-2.8_s.tar.gz?oink_code=$snortsettings{'OINKCODE'}"; - $url=" http://www.snort.org/reg-rules/snortrules-snapshot-2903_s.tar.gz/$snortsettings{'OINKCODE'}"; - #$url="http://www.snort.org/pub-bin/oinkmaster.cgi/$snortsettings{'OINKCODE'}/snortrules-snapshot-2.8_s.tar.gz"; + $url=" https://www.snort.org/rules/snortrules-snapshot-2982.tar.gz?oinkcode=$snortsettings{'OINKCODE'}"; } elsif ($snortsettings{'RULES'} eq 'registered') { - #$url="http://dl.snort.org/reg-rules/snortrules-snapshot-2.8.tar.gz?oink_code=$snortsettings{'OINKCODE'}"; - $url=" http://www.snort.org/reg-rules/snortrules-snapshot-2903.tar.gz/$snortsettings{'OINKCODE'}"; - #$url="http://www.snort.org/pub-bin/oinkmaster.cgi/$snortsettings{'OINKCODE'}/snortrules-snapshot-2.8.tar.gz"; + $url=" https://www.snort.org/rules/snortrules-snapshot-2982.tar.gz?oinkcode=$snortsettings{'OINKCODE'}"; +} elsif ($snortsettings{'RULES'} eq 'community') { + $url=" https://www.snort.org/rules/community"; } else { $url="http://rules.emergingthreats.net/open/snort-2.9.0/emerging.rules.tar.gz"; } @@ -278,8 +267,9 @@ if ($snortsettings{'ACTION'} eq $Lang::tr{'save'} && $snortsettings{'ACTION2'} e { $errormessage = $Lang::tr{'invalid input for oink code'} unless ( ($snortsettings{'OINKCODE'} =~ /^[a-z0-9]+$/) || - ($snortsettings{'RULESTYPE'} eq 'nothing' ) || - ($snortsettings{'RULESTYPE'} eq 'community' )); + ($snortsettings{'RULES'} eq 'nothing' ) || + ($snortsettings{'RULES'} eq 'emerging' ) || + ($snortsettings{'RULES'} eq 'community' )); &General::writehash("${General::swroot}/snort/settings", \%snortsettings); if ($snortsettings{'ENABLE_SNORT'} eq 'on') @@ -312,39 +302,11 @@ if ($snortsettings{'ACTION'} eq $Lang::tr{'save'} && $snortsettings{'ACTION2'} e } else { unlink "${General::swroot}/snort/enable_preprocessor_http_inspect"; } - if ($snortsettings{'ENABLE_GUARDIAN'} eq 'on') - { - system ('/usr/bin/touch', "${General::swroot}/guardian/enable"); - } else { - unlink "${General::swroot}/guardian/enable"; - } system('/usr/local/bin/snortctrl restart >/dev/null'); -} elsif ($snortsettings{'ACTION'} eq $Lang::tr{'save'} && $snortsettings{'ACTION2'} eq "guardian" ){ - foreach my $key (keys %snortsettings){ - if ( $key !~ /^GUARDIAN/ ){ - delete $snortsettings{$key}; - } - } - &General::writehashpart("${General::swroot}/snort/settings", \%snortsettings); - open(IGNOREFILE, ">$snortsettings{'GUARDIAN_IGNOREFILE'}") or die "Unable to write guardian ignore file $snortsettings{'GUARDIAN_IGNOREFILE'}"; - print IGNOREFILE $snortsettings{'GUARDIAN_IGNOREFILE_CONTENT'}; - close(IGNOREFILE); - open(GUARDIAN, ">/var/ipfire/guardian/guardian.conf") or die "Unable to write guardian conf /var/ipfire/guardian/guardian.conf"; - print GUARDIAN </dev/null'); } + # INSTALLMD5 is not in the form, so not retrieved by getcgihash &General::readhash("${General::swroot}/snort/settings", \%snortsettings); @@ -401,11 +363,9 @@ $checked{'ENABLE_SNORT_BLUE'}{$snortsettings{'ENABLE_SNORT_BLUE'}} = "checked='c $checked{'ENABLE_SNORT_ORANGE'}{'off'} = ''; $checked{'ENABLE_SNORT_ORANGE'}{'on'} = ''; $checked{'ENABLE_SNORT_ORANGE'}{$snortsettings{'ENABLE_SNORT_ORANGE'}} = "checked='checked'"; -$checked{'ENABLE_GUARDIAN'}{'off'} = ''; -$checked{'ENABLE_GUARDIAN'}{'on'} = ''; -$checked{'ENABLE_GUARDIAN'}{$snortsettings{'ENABLE_GUARDIAN'}} = "checked='checked'"; $selected{'RULES'}{'nothing'} = ''; $selected{'RULES'}{'community'} = ''; +$selected{'RULES'}{'emerging'} = ''; $selected{'RULES'}{'registered'} = ''; $selected{'RULES'}{'subscripted'} = ''; $selected{'RULES'}{$snortsettings{'RULES'}} = "selected='selected'"; @@ -413,9 +373,9 @@ $selected{'RULES'}{$snortsettings{'RULES'}} = "selected='selected'"; &Header::openpage($Lang::tr{'intrusion detection system'}, 1, ''); ####################### Added for snort rules control ################################# -print ""; +print ""; print < + + END ; ####################### End added for snort rules control ################################# @@ -472,7 +432,7 @@ if ($return) { $Lang::tr{'snort working'}
- +
 END
@@ -491,7 +451,7 @@ END
 	refreshpage();
 }
 
-&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system2'});
+&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system'});
 print <
-	
+	
@@ -519,6 +476,7 @@ print <
 	
@@ -535,7 +493,7 @@ print <Oinkcode: 
 
 
-	"
 print <
 
GREEN Snort @@ -504,14 +464,11 @@ if ($netsettings{'ORANGE_DEV'} ne '') { print "       ORANGE Snort"; } print "       RED Snort"; -if ( -e "/var/ipfire/guardian/guardian.conf" ) { - print "       Guardian"; -} print <



$Lang::tr{'ids rules update'}

- $Lang::tr{'ids rules license'} www.snort.org$Lang::tr{'ids rules license1'}

+ $Lang::tr{'ids rules license'} www.snort.org$Lang::tr{'ids rules license1'}

$Lang::tr{'ids rules license2'} Get an Oinkcode, $Lang::tr{'ids rules license3'}
+
END ; if ( -e "/var/tmp/snortrules.tar.gz"){ @@ -547,10 +505,10 @@ print " $Lang::tr{'updates installed'}: $snortsettings{'INSTALLDATE'}
-
+

- +
@@ -563,37 +521,11 @@ if ($results ne '') { &Header::closebox(); -####################### Added for guardian control #################################### -if ( -e "/var/ipfire/guardian/guardian.conf" ) { - &Header::openbox('100%', 'LEFT', $Lang::tr{'guardian configuration'}); -print < - - - - - - -
$Lang::tr{'guardian interface'}
$Lang::tr{'guardian timelimit'}
$Lang::tr{'guardian logfile'}
$Lang::tr{'guardian alertfile'}
$Lang::tr{'guardian ignorefile'}
- -END -; - &Header::closebox(); -} - - - - ####################### Added for snort rules control ################################# if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable_green" || -e "${General::swroot}/snort/enable_blue" || -e "${General::swroot}/snort/enable_orange" ) { &Header::openbox('100%', 'LEFT', $Lang::tr{'intrusion detection system rules'}); # Output display table for rule files - print "
"; + print "
"; print ""; @@ -614,7 +546,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable # Check if reached half-way through rule file rules to start new column if ($ruledisplaycnt > $rulecnt) { - print "
"; + print "
"; $ruledisplaycnt = 0; } @@ -665,21 +597,21 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable } # Output rule file name and checkbox - print ""; - print ""; + print "
$rulefile
"; + print "
$rulefile
"; # Check for empty 'Description' if ($snortrules{$rulefile}{'Description'} eq '') { - print ""; + print "
No description available
"; } else { # Output rule file 'Description' - print "
No description available
"; + print "
$snortrules{$rulefile}{'Description'}
"; } # Check for display flag if ($displayrulefilerules) { # Rule file definition rule display - print ""; } # Close display table - print "
$snortrules{$rulefile}{'Description'}
"; + print ""; + print "
"; # Local vars my $ruledefdisplaycnt = 0; @@ -694,7 +626,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable # If have display 2 rules, start new row if (($ruledefdisplaycnt % 2) == 0) { - print ""; + print ""; $ruledefdisplaycnt = 0; } @@ -706,7 +638,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable # Create rule file rule's checkbox $checkboxname = "SNORT_RULE_$rulefile"; $checkboxname .= "_$ruledef"; - print ""; + print ""; # Increment count $ruledefdisplaycnt++; @@ -714,26 +646,24 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable # If do not have second rule for row, create empty cell if (($ruledefdisplaycnt % 2) != 0) { - print ""; + print ""; } # Close display table - print "
$snortrules{$rulefile}{'Definition'}{$ruledef}{'Description'} $snortrules{$rulefile}{'Definition'}{$ruledef}{'Description'}
"; + print "
"; # Increment ruledisplaycnt $ruledisplaycnt++; } - print "
"; + print ""; print < -   - - +