Changeset 182

Show
Ignore:
Timestamp:
03/20/05 14:22:07 (5 years ago)
Author:
mbr
Message:

- Updated to not attempt to download Snort rules from snort.org

because the rules are no longer available for automatic downloads

- Changed the install.pl script and the --update-rules mode for

fwsnort to download the latest signature set from
 http://www.bleedingsnort.com/.
(Snort.org is now offering pay-service around their rule sets).

- Added signature test for the "flowbits" keyword.

Location:
fwsnort/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • fwsnort/trunk/ChangeLog

    r181 r182  
    1 fwsnort-0.6.4 (12/18/2004); 
     1fwsnort-0.6.5 (03/20/2005): 
     2    - Updated to not attempt to download Snort rules from snort.org 
     3      because the rules are no longer available for automatic downloads 
     4    - Changed the install.pl script and the --update-rules mode for 
     5      fwsnort to download the latest signature set from 
     6      http://www.bleedingsnort.com/. 
     7      (Snort.org is now offering pay-service around their rule sets). 
     8    - Added signature test for the "flowbits" keyword. 
     9 
     10fwsnort-0.6.4 (12/18/2004): 
    211    - Updated to Snort-2.3 rules.  FWSnort can convert a total of 1710 
    312      out of 2559 total Snort-2.3 rules. 
     
    817    - Added --replace-string patches. 
    918 
    10 fwsnort-0.6.3 (04/04/2004); 
     19fwsnort-0.6.3 (04/04/2004): 
    1120    - Added ignore functionality for both IPs and networks 
    1221    - Split --ipt-block into --ipt-drop and --ipt-reject to add DROP 
     
    1524      file to be added. 
    1625 
    17 fwsnort-0.6.2 (03/19/2004); 
     26fwsnort-0.6.2 (03/19/2004): 
    1827    - Added --internal-net and --dmz-net options so that internal and 
    1928      dmz networks can be manually specified without having to parse 
  • fwsnort/trunk/TODO

    r176 r182  
    1 - Port the string match extension to the 2.6 kernel. 
     1 - Port the string match extension to the 2.6 kernel. 
     2 - Have some level of (optional) integration with the --replace-string 
     3   patches 
     4 - Allow a list of SIDs to have a manually specified target (such as 
     5   -j REJECT --reject-with tcp-reset).  The list should come from the 
     6   command line with a new option and/or be read from a file. 
  • fwsnort/trunk/VERSION

    r176 r182  
    1 0.6.4 
     10.6.5 
  • fwsnort/trunk/fwsnort

    r179 r182  
    1313# Credits: (see the CREDITS file) 
    1414# 
    15 # Version: 0.6.4 
     15# Version: 0.6.5 
    1616# 
    1717# Copyright (C) 2003 Michael Rash (mbr@cipherdyne.org) 
     
    105105my $log_dir     = '/var/log'; 
    106106 
    107 my $snort_website = 'www.snort.org'; 
    108 my $download_rules_file = 'snortrules-snapshot-CURRENT.tar.gz'; 
     107### Snort.org no longer allows auto downloads of signatures 
     108my $bleeding_snort_website = 'www.bleedingsnort.com'; 
    109109 
    110110### config file 
     
    119119 
    120120### version number 
    121 my $version = '0.6.4'; 
     121my $version = '0.6.5'; 
    122122 
    123123### supported variables in snort signatures 
     
    204204        'distance'     => '[\s;]distance:\s*(\d+)\s*;', 
    205205        'within'       => '[\s;]within:\s*(\d+)\s*;', 
     206        'flowbits'     => '[\s;]flowbits:\s*\S+\s*;', 
    206207#        'offset'       => '[\s;]offset:\s*\d+\s*;', 
    207208#        'depth'        => '[\s;]depth:\s*\d+\s*;', 
     
    16951696    ### make sure we can actually reach snort.org. 
    16961697    print "[+] Downloading latest rules:\n", 
    1697         "    http://$snort_website/dl/rules/$download_rules_file\n"; 
    1698     if (&test_snort_website()) { 
    1699         chdir $fwsnort_dir or die "[*] Could not chdir $fwsnort_dir: $!"; 
    1700         if (-e $download_rules_file) { 
    1701             unlink $download_rules_file or die "[*] Could not remove ", 
    1702                 "$download_rules_file: $!"; 
    1703         } 
    1704         system "$cmds{'wget'} http://$snort_website/dl/rules/" . 
    1705             "$download_rules_file"; 
    1706         system "$cmds{'tar'} xvfz $download_rules_file"; 
    1707         if (-d 'rules') { 
    1708             if (-d 'snort_rules') { 
    1709                 rmtree 'snort_rules.orig' if -d 'snort_rules.orig'; 
    1710                 move 'snort_rules', 'snort_rules.orig'; 
    1711             } 
    1712             move 'rules', 'snort_rules' or die "[*] Could not ", 
    1713                 "move rules -> snort_rules: $!"; 
    1714         } else { 
    1715             print "[-] $download_rules_file did not appear to ", 
    1716                 "contain a\n    \"rules\" directory.  Defaulting to ", 
    1717                 "existing snort-2.0 rules.\n"; 
    1718         } 
    1719     } else { 
    1720         print "[-] Could not connect to $snort_website on tcp/80.\n", 
    1721             "    Defaulting to existing snort-2.0 rules.\n"; 
    1722     } 
    1723     print "[+] Moving rules files to $fwsnort_dir/snort_rules/\n", 
    1724         "[+] Finished.\n"; 
     1698        "    http://$bleeding_snort_website/bleeding-all.rules\n"; 
     1699    chdir $rules_dir or die "[*] Could not chdir $rules_dir: $!"; 
     1700    if (-e 'bleeding-all.rules') { 
     1701        move 'bleeding-all.rules', 'bleeding-all.rules.tmp' 
     1702            or die "[*] Could not move bleeding-all.rules -> ", 
     1703            "bleeding-all.rules.tmp"; 
     1704    } 
     1705    system "$cmds{'wget'} http://$bleeding_snort_website/bleeding-all.rules"; 
     1706    if (-e 'bleeding-all.rules') {  ### successful download 
     1707        unlink 'bleeding-all.rules.tmp'; 
     1708    } else { 
     1709        print "[-] Could not download bleeding-all.rules file.\n"; 
     1710        if (-e 'bleeding-all.rules.tmp') { 
     1711            ### move the original back 
     1712            move 'bleeding-all.rules', 'bleeding-all.rules.tmp' 
     1713                or die "[*] Could not move bleeding-all.rules -> ", 
     1714                "bleeding-all.rules.tmp"; 
     1715        } 
     1716    } 
     1717    print "[+] Finished.\n"; 
    17251718    exit 0; 
    1726 } 
    1727  
    1728 sub test_snort_website() { 
    1729     my $sock = new IO::Socket::INET( 
    1730         PeerAddr => $snort_website, 
    1731         PeerPort => 80, 
    1732         Proto    => 'tcp', 
    1733         Timeout  => 7 
    1734     ); 
    1735     if (defined($sock)) { 
    1736         close $sock; 
    1737         return 1; 
    1738     } 
    1739     return 0; 
    17401719} 
    17411720 
     
    18331812    --dmz-net <net/mask>      - Manually specify a dmz network 
    18341813                                (CIDR or standard notation). 
    1835     -u   --update-rules       - Download latest snort rules from 
    1836                                 http://$snort_website/ 
     1814    -u   --update-rules       - Download latest Bleeding-Snort rules 
     1815                                from http://$bleeding_snort_website/ 
    18371816    -t   --type=<type>        - Only process snort rules of type <type> 
    18381817                                (e.g. "ddos" or "backdoor") 
  • fwsnort/trunk/install.pl

    r174 r182  
    4141my $rules_dir   = "${fwsnort_dir}/snort_rules"; 
    4242 
    43 my $snort_website = 'www.snort.org'; 
    44 my $download_rules_file = 'snortrules-snapshot-CURRENT.tar.gz'; 
     43### Snort.org no longer allows auto downloads of signatures 
     44my $bleeding_snort_website = 'www.bleedingsnort.com'; 
    4545 
    4646### system binaries 
     
    133133 
    134134    my $local_rules_dir = 'snort_rules'; 
    135     if (&query_get_latest_snort_rules()) { 
    136         ### make sure we can actually reach snort.org. 
    137         if (&test_snort_website()) { 
    138             if (-e $download_rules_file) { 
    139                 unlink $download_rules_file or die "[*] Could not remove ", 
    140                     "$download_rules_file: $!"; 
    141             } 
    142             system "$cmds{'wget'} http://$snort_website/dl/rules/" . 
    143                 $download_rules_file; 
    144             if (-e $download_rules_file) { 
    145                 system "$cmds{'tar'} xvfz $download_rules_file"; 
    146                 if (-d 'rules') { 
    147                     rmtree 'downloaded_snort_rules' 
    148                         if -d 'downloaded_snort_rules'; 
    149                     move 'rules', 'downloaded_snort_rules' 
    150                         or die "[*] Could not move rules -> ", 
    151                             "downloaded_snort_rules: $!"; 
    152                     $local_rules_dir = 'downloaded_snort_rules'; 
    153                 } else { 
    154                     print "[-] $download_rules_file did not appear to ", 
    155                         "contain a\n    \"rules\" directory.  Defaulting to ", 
    156                         "existing snort-2.3 rules.\n"; 
    157                 } 
    158             } else { 
    159                 print "[-] Could not download $download_rules_file\n", 
    160                     "    Defaulting to existing snort-2.3 rules.\n"; 
    161             } 
     135    if (&query_get_bleeding_snort()) { 
     136        chdir $local_rules_dir or die "[*] Could not chdir $local_rules_dir"; 
     137        if (-e 'bleeding-all.rules') { 
     138            move 'bleeding-all.rules', 'bleeding-all.rules.tmp' 
     139                or die "[*] Could not move bleeding-all.rules -> ", 
     140                "bleeding-all.rules.tmp"; 
     141        } 
     142        system "$cmds{'wget'} http://$bleeding_snort_website/bleeding-all.rules"; 
     143        if (-e 'bleeding-all.rules') {  ### successful download 
     144            unlink 'bleeding-all.rules.tmp'; 
    162145        } else { 
    163             print "[-] Could not connect to $snort_website on tcp/80.\n", 
    164                 "    Defaulting to existing snort-2.3 rules.\n"; 
    165         } 
     146            print "[-] Could not download bleeding-all.rules file.\n"; 
     147            if (-e 'bleeding-all.rules.tmp') { 
     148                ### move the original back 
     149                move 'bleeding-all.rules', 'bleeding-all.rules.tmp' 
     150                    or die "[*] Could not move bleeding-all.rules -> ", 
     151                    "bleeding-all.rules.tmp"; 
     152            } 
     153        } 
     154        chdir '..'; 
    166155    } 
    167156 
     
    175164        next unless $rfile =~ /\.rules$/; 
    176165        print "[+] Installing $rfile\n"; 
    177         copy "snort_rules/${rfile}", "${rules_dir}/${rfile}"; 
     166        copy "snort_rules/${rfile}", "${rules_dir}/${rfile}" or 
     167            die "[*] Could not copy snort_rules/${rfile} ", 
     168                "-> ${rules_dir}/${rfile}"; 
    178169    } 
    179170 
     
    274265} 
    275266 
    276 sub query_get_latest_snort_rules() { 
     267sub query_get_bleeding_snort() { 
    277268    my $ans = ''; 
    278     print "[+] Would you like to download the latest snort rules from \n", 
    279         "    http://$snort_website/?  If you not (or if you aren't connected\n", 
    280         "    to the Net, then the installation will default to using \n", 
    281         "    snort-2.3 signatures.\n"; 
     269    print "[+] Would you like to download the latest Snort rules from \n", 
     270        "    http://$bleeding_snort_website/?\n"; 
    282271    while ($ans ne 'y' && $ans ne 'n') { 
    283272        print "    ([y]/n)?  "; 
     
    287276    } 
    288277    if ($ans eq 'y') { 
    289         return 1; 
    290     } 
    291     return 0; 
    292 } 
    293  
    294 sub test_snort_website() { 
    295     my $sock = new IO::Socket::INET( 
    296         PeerAddr => $snort_website, 
    297         PeerPort => 80, 
    298         Proto    => 'tcp', 
    299         Timeout  => 7 
    300     ); 
    301     if (defined($sock)) { 
    302         close $sock; 
    303278        return 1; 
    304279    }