Changeset 866

Show
Ignore:
Timestamp:
12/09/07 11:49:43 (1 year ago)
Author:
mbr
Message:

- Added --Save-dst argument to the fwknop client to add a priority file to

store client command line arguments (~/.fwknop.save). This file is only
overwritten when --Save-dst is used.

Files:

Legend:

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

    r854 r866  
    4242    - Bugfix in fwknopd to account for non-Ethernet link layer header over 
    4343      *BSD loopback interfaces. 
     44    - Added --Save-dst argument to the fwknop client to add a priority file to 
     45      store client command line arguments (~/.fwknop.save). This file is only 
     46      overwritten when --Save-dst is used. 
    4447 
    4548fwknop-1.8.3 (11/17/2007): 
  • fwknop/trunk/fwknop

    r862 r866  
    8989my $cmdline_pcap_cmd   = ''; 
    9090my $no_save_last_args  = 0; 
     91my $save_destination   = 0; 
    9192my $server_auth_method = ''; 
    9293my $spa_established_tcp  = 0; 
     
    9697my $knock_dst_pre_resolve = ''; 
    9798 
    98 ### User agent for contacting http://www.whatismyip.org/, we don't 
    99 ### advertise the fwknop client (can override with --User-agent) 
     99### User agent for contacting http://www.whatismyip.org/, (can 
     100### override with --User-agent) 
    100101my $ext_resolve_user_agent = "Fwknop/$version"; 
    101102$ext_resolve_user_agent =~ s|-pre\d+||; 
     
    12031204    close S; 
    12041205 
     1206    if ($save_destination) { 
     1207        open D, "> $homedir/.fwknop.save" 
     1208            or die "[*] Could not open $homedir/.fwknop.save"; 
     1209        print D "@args_cp\n"; 
     1210        close D; 
     1211    } 
     1212 
    12051213    my @host_lines = (); 
    12061214    my $matched_dst = 0; 
     
    12441252        'Save-packet'    => \$save_packet_mode, 
    12451253        'Save-packet-file=s'  => \$save_packet_file, 
     1254        'Save-dst'       => \$save_destination, 
    12461255        'user-rc=s'      => \$user_rc_file, 
    12471256        'knock-dst=s'    => \$knock_dst, 
     
    12841293 
    12851294sub run_last_cmdline() { 
    1286     my $save_file = "$homedir/.fwknop.run"; 
    1287     if (-e $save_file) { 
     1295 
     1296    my $found_file = 0; 
     1297 
     1298    for my $save_file ("$homedir/.fwknop.save", "$homedir/.fwknop.run") { 
     1299        next unless -e $save_file; 
     1300 
    12881301        open S, "< $save_file" or die "[*] Could not open $save_file: $!"; 
    12891302        my $arg_line = <S>; 
     
    12991312        @ARGV = split /\s+/, $arg_line; 
    13001313 
    1301         ### run GetOpt() to get comand line args 
     1314        ### run GetOpt() to get command line args 
    13021315        &handle_command_line(); 
    13031316 
    1304     } else { 
    1305         die "[*] fwknop argument save file $save_file does not exist."; 
     1317        $found_file = 1; 
     1318        last; 
     1319 
     1320    } 
     1321 
     1322    unless ($found_file) { 
     1323        die "[*] fwknop argument save files (~/.fwknop.save and ", 
     1324            "~/.fwknop.run) not found."; 
    13061325    } 
    13071326    return; 
     
    13101329sub run_last_host_cmdline() { 
    13111330    my $hosts_file = "$homedir/.fwknop.hosts"; 
    1312     if (-e $hosts_file) { 
     1331 
     1332    my $found_file = 0; 
     1333    my $found_host = 0; 
     1334    for my $file ("$homedir/.fwknop.save", "$homedir/.fwknop.hosts") { 
     1335        next unless -e $file; 
     1336 
    13131337        my $arg_line = ''; 
    13141338        open H, "< $hosts_file" or die "[*] Could not open $hosts_file: $!"; 
     
    13361360            &handle_command_line(); 
    13371361 
    1338         } else { 
    1339             print "[-] No matching destination host in $hosts_file\n"; 
    1340         } 
    1341     } else { 
    1342         die "[*] fwknop argument save file $hosts_file does not exist."; 
     1362            $found_host = 1; 
     1363            last; 
     1364        } 
     1365        $found_file = 1; 
     1366    } 
     1367 
     1368    unless ($found_file) { 
     1369        die "[*] fwknop argument save files (~/.fwknop.save and ", 
     1370            "~/.fwknop.hosts) not found."; 
     1371    } 
     1372 
     1373    unless ($found_host) { 
     1374        print "[-] No matching destination host in ~/.fwknop.save ", 
     1375            "or ~/.fwknop.hosts\n"; 
    13431376    } 
    13441377    return; 
     
    14231456                                 (requires the -R option). The default user 
    14241457                                 agent is: $ext_resolve_user_agent 
     1458    --Save-dst                 - Save the command line args for this 
     1459                                 invocation against the destination to the 
     1460                                 special file ~/.fwknop.save (this file 
     1461                                 provides a priority location that is only 
     1462                                 overwritten with --Save-dst and is useful 
     1463                                 for an fwknop client command that you want 
     1464                                 to always preserve). 
    14251465    --Save-packet              - Save a copy of an encrypted SPA packet to 
    1426                                  to a file (~/fwknop_save_packet.$$ by 
     1466                                 to a file (~/fwknop_save_packet.<pid> by 
    14271467                                 default). 
    14281468    --Save-packet-file         - Specify the path to the file where the