Changeset 1283

Show
Ignore:
Timestamp:
10/05/08 13:51:58 (2 months ago)
Author:
mbr
Message:

- Added --Dump-conf to fwknopd (suggested by Franck Joncourt).
- Added execution of --Dump-conf to the test suite to collect the installed

version of the fwknop.conf and access.conf files.

- Added time stamps to MSG and TEST lines for each test (useful to see the

relative time if an alarm expires).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fwknop/trunk/fwknopd

    r1277 r1283  
    115115my $voluntary_exit_timestamp  = 0; 
    116116my $fw_data_file = '';  ### legacy port knocking mode 
     117my $dump_config = 0; 
    117118 
    118119my $cmdline_locale = ''; 
     
    37393740            "(review syslog for more info). Exiting."; 
    37403741    } 
     3742    &dump_config() if $debug; 
    37413743    if ($debug and $verbose) { 
    37423744        for (my $i=0; $i<=$#access; $i++) { 
     
    38013803        unless $ip_info; 
    38023804    return $ip_info; 
     3805} 
     3806 
     3807sub dump_config() { 
     3808    my $rv = 0; 
     3809    print STDERR "\n", localtime() . " [+] Dumping config from: $config_file\n"; 
     3810    for my $var (sort keys %config) { 
     3811        my $str = $config{$var}; 
     3812        ### sanitize sensitive information 
     3813        $str = '(removed)' if $var eq 'EMAIL_ADDRESSES'; 
     3814        $str = '(removed)' if $var eq 'HOSTNAME'; 
     3815        $str = '(removed)' if $var eq 'BLACKLIST'; 
     3816        $str = '(removed)' if $var eq 'GPG_DEFAULT_HOME_DIR'; 
     3817        printf STDERR "%-30s %s\n", $var, $str; 
     3818    } 
     3819    print STDERR "\n", localtime() . " [+] Command paths:\n\n"; 
     3820    for my $var (sort keys %cmds) { 
     3821        printf STDERR "%-30s %s\n", $var, $cmds{$var}; 
     3822    } 
     3823    return $rv; 
    38033824} 
    38043825 
     
    40744095        'no-LC_ALL'      => \$no_locale, 
    40754096        'no-locale'      => \$no_locale, 
     4097        'Dump-config'    => \$dump_config, 
    40764098        'verbose'        => \$verbose, 
    40774099        'Version'        => \$print_version, 
     
    43894411        ### import access directives 
    43904412        &import_access(); 
     4413 
     4414        if ($dump_config) { 
     4415            &dump_config(); 
     4416            print STDERR "\n", localtime() . " [+] Dumping access ", 
     4417                "config: $config{'ACCESS_CONF'}\n\n"; 
     4418            for (my $i=0; $i<=$#access; $i++) { 
     4419                &dump_access($access[$i], $i); 
     4420            } 
     4421            exit 0; 
     4422        } 
    43914423 
    43924424        unless ($debug) { 
  • fwknop/trunk/test/fwknop_test.pl

    r1277 r1283  
    750750    open C, ">> $current_test_file" 
    751751        or die "[*] Could not open $current_test_file: $!"; 
    752     print C "\nTEST: $msg, STATUS: $test_status\n"; 
     752    print C "\n" . localtime() . " TEST: $msg, STATUS: $test_status\n"; 
    753753    close C; 
    754754 
     
    913913    close F; 
    914914    system "$cmd >> $current_test_file 2>&1"; 
    915     for my $cmd ('uname -a', 
    916             'perl -V', 
    917             'gpg --version', 
    918             'ifconfig -a', 
    919             'ls -l /etc', 'if [ -e /etc/issue ]; then cat /etc/issue; fi', 
    920             'if [ -e /proc/cpuinfo ]; then cat /proc/cpuinfo; fi', 
    921             'if [ -e /proc/config.gz ]; then zcat /proc/config.gz; fi', 
    922             "$fwknopdCmd -S", 
    923             "$fwknopdCmd -V", 
    924             "$fwknopCmd -V", 
    925             'if [ -e /usr/bin/fwknop ]; then /usr/bin/fwknop -V; fi', 
    926             'if [ -e /usr/sbin/fwknopd ]; then /usr/sbin/fwknopd -V; fi', 
    927             "ldd $tcpdumpCmd", 
    928             'ls -l /usr/lib/*pcap*', 
    929             'ls -l /usr/local/lib/*pcap*', 
    930             'find /usr/lib/fwknop -type f' 
     915    for my $cmd ( 
     916        'uname -a', 
     917        'perl -V', 
     918        'gpg --version', 
     919        'ifconfig -a', 
     920        'ls -l /etc', 'if [ -e /etc/issue ]; then cat /etc/issue; fi', 
     921        'if [ -e /proc/cpuinfo ]; then cat /proc/cpuinfo; fi', 
     922        'if [ -e /proc/config.gz ]; then zcat /proc/config.gz; fi', 
     923        "$fwknopdCmd -S", 
     924        "$fwknopdCmd -V", 
     925        "$fwknopCmd -V", 
     926        "$fwknopdCmd --Dump-conf", 
     927        'if [ -e /usr/bin/fwknop ]; then /usr/bin/fwknop -V; fi', 
     928        'if [ -e /usr/sbin/fwknopd ]; then /usr/sbin/fwknopd -V; fi', 
     929        "ldd $tcpdumpCmd", 
     930        'ls -l /usr/lib/*pcap*', 
     931        'ls -l /usr/local/lib/*pcap*', 
     932        'find /usr/lib/fwknop -type f' 
    931933    ) { 
    932934        open F, ">> $current_test_file" or die $!; 
     
    30753077        open F, ">> $current_test_file" 
    30763078            or die "[*] Could not open $current_test_file: $!"; 
    3077         print F "MSG: $msg\n"; 
     3079        print F localtime() . " MSG: $msg\n"; 
    30783080        close F; 
    30793081    }