Changeset 2187

Show
Ignore:
Timestamp:
07/23/08 21:08:11 (4 months ago)
Author:
mbr
Message:

Bugfix to honor the IPT_SYSLOG_FILE variable in --Analyze-msgs mode (reported by j.bakshi)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • psad/trunk/CREDITS

    r2168 r2187  
    400400      to query the whois information associated with certain IP addresses. 
    401401      Updating to whois-4.7.26 solved the problem. 
     402 
     403j.bakshi 
     404    - Reported a bug where IPT_SYSLOG_FILE was not being honored in -A 
     405      (analyze) mode. 
  • psad/trunk/ChangeLog

    r2180 r2187  
     1psad-2.1.4 (08//2008): 
     2    - Bugfix to honor the IPT_SYSLOG_FILE variable in --Analyze-msgs mode. 
     3 
    14psad-2.1.3 (06/07/2008): 
    25    - Updated to enable IPT_SYSLOG_FILE by default.  This is a relatively 
  • psad/trunk/psad

    r2181 r2187  
    408408my $warn_msg         = ''; 
    409409my $die_msg          = ''; 
    410 my $messages_file    = '/var/log/messages'; 
    411410my $skip_first_loop  = 1; 
    412411my $cmdl_interface   = ''; 
     
    719718### All firewall drop/reject log messages are written to FW_DATA_FILE 
    720719### by kmsgsd (or by ulogd directly). 
     720print STDERR "[+] Opening iptables data file: $fw_data_file\n" if $debug; 
    721721open FWDATA, $fw_data_file or die '[*] Could not open ', 
    722722    "$fw_data_file: $!"; 
     
    27472747    ### SYSLOG_DAEMON is set to ulogd, or if ENABLE_SYSLOG_FILE is set 
    27482748    ### to 'Y' 
    2749     if ($config{'SYSLOG_DAEMON'} =~ /ulog/i) { 
    2750         $fw_data_file = $config{'ULOG_DATA_FILE'}; 
    2751     } elsif ($config{'ENABLE_SYSLOG_FILE'} eq 'Y') { 
    2752         $fw_data_file = $config{'IPT_SYSLOG_FILE'}; 
    2753     } else { 
    2754         $fw_data_file = $config{'FW_DATA_FILE'}; 
     2749    unless ($fw_data_file) { 
     2750        if ($config{'SYSLOG_DAEMON'} =~ /ulog/i) { 
     2751            $fw_data_file = $config{'ULOG_DATA_FILE'}; 
     2752        } elsif ($config{'ENABLE_SYSLOG_FILE'} eq 'Y') { 
     2753            $fw_data_file = $config{'IPT_SYSLOG_FILE'}; 
     2754        } else { 
     2755            $fw_data_file = $config{'FW_DATA_FILE'}; 
     2756        } 
    27552757    } 
    27562758 
     
    29532955 
    29542956    if ($analyze_mode or $gnuplot_mode or $csv_mode) { 
    2955         die "[*] iptables log file must point to a file (use -m)" 
    2956             if -d $messages_file; 
     2957        $fw_data_file = $config{'IPT_SYSLOG_FILE'} 
     2958            unless $fw_data_file; 
    29572959    } 
    29582960 
     
    66226624    $config{'PSAD_DIR'} = $config{'ANALYSIS_MODE_DIR'}; 
    66236625 
    6624     print "[+] Entering analysis mode.  Parsing $messages_file\n"; 
    6625     open MSGS, "< $messages_file" or die "[*] Could not open ", 
    6626         "$messages_file: $!"; 
     6626    print "[+] Entering analysis mode.  Parsing $fw_data_file\n"; 
     6627    open MSGS, "< $fw_data_file" or die "[*] Could not open ", 
     6628        "$fw_data_file: $!"; 
    66276629    my @lines = <MSGS>; 
    66286630    close MSGS; 
     
    67526754        $fh = *STDIN; 
    67536755    } else { 
    6754         print "[+] Parsing iptables log messages from file: $messages_file\n" 
     6756        print "[+] Parsing iptables log messages from file: $fw_data_file\n" 
    67556757            if $gnuplot_mode; 
    6756         open MSGS, "< $messages_file" or die "[*] Could not open ", 
    6757             "$messages_file: $!"; 
     6758        open MSGS, "< $fw_data_file" or die "[*] Could not open ", 
     6759            "$fw_data_file: $!"; 
    67586760        $fh = *MSGS; 
    67596761    } 
     
    96659667                                                  #   mode. 
    96669668        'email-analysis'    => \$analysis_emails, # Send analysis mode emails. 
    9667         'messages-file=s'   => \$messages_file,   # Specify the path to file containing 
     9669        'messages-file=s'   => \$fw_data_file,    # Specify the path to file containing 
    96689670                                                  #   old iptables messages (fwdata by 
    96699671                                                  #   default).