Changeset 1098

Show
Ignore:
Timestamp:
05/31/08 11:58:00 (6 months ago)
Author:
mbr
Message:

Added --time-offset-plus and --time-offset-minus options

Files:

Legend:

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

    r1082 r1098  
    2828      Now the fwknop client will select a random port to NAT the incoming 
    2929      connection.  So say it selects port 31001 (as indicated by the output of 
    30       fwknop on the command line) - then you would SSH to this port to access 
    31       the real SSH daemon on the system where fwknopd is running: 
     30      fwknop on the command line as displayed below) - then you would SSH to 
     31      this port to access the real SSH daemon on the system where fwknopd is 
     32      running: 
     33 
     34      [+] Sending 206 byte message to 127.0.0.1 over udp/46245... 
     35      Requesting NAT access to tcp/22 on 127.0.0.1 via port 31001 
    3236 
    3337      $ ssh -p 31001 <user>@11.1.1.1 
     
    5256      This allows fwknopd to ignore packets that are not at least this many 
    5357      bytes (including packet headers) before any decryption attempt is made. 
     58    - Added --time-offset-plus and --time-offset-minus args to the fwknop 
     59      client command line.  This allows the time stamp within an SPA packet to 
     60      be influenced without setting the system clock (which normal users 
     61      cannot usually do).  This is useful for when the client and server 
     62      systems have clocks that are out of sync. 
    5463    - Updated to version 5.47 of the Digest::SHA module. 
    5564    - Updated to version 0.7 of the IPTables::ChainMgr module (includes 
  • fwknop/trunk/fwknop

    r1092 r1098  
    7575my $show_last_host_cmd = ''; 
    7676my $show_last_cmd = 0; 
     77my $time_offset_plus = ''; 
     78my $time_offset_minus = ''; 
    7779my $use_md5       = 0; 
    7880my $use_sha1      = 0; 
     
    531533sub SPA_timestamp() { 
    532534    my $timestamp = time(); 
     535 
     536 
     537    if ($time_offset_plus) { 
     538        my $offset = &time_offset($time_offset_plus); 
     539        $timestamp += $offset; 
     540    } 
     541 
     542    if ($time_offset_minus) { 
     543        my $offset = &time_offset($time_offset_minus); 
     544        $timestamp -= $offset; 
     545    } 
     546 
    533547    print "        Timestamp:      $timestamp\n" unless $quiet; 
    534548    return ':' . $timestamp; 
     
    14431457        'knock-dst=s'    => \$knock_dst, 
    14441458        'Destination=s'  => \$knock_dst, 
     1459        'time-offset-plus=s'  => \$time_offset_plus, 
     1460        'time-offset-minus=s' => \$time_offset_minus, 
    14451461        'gpg-signing-key=s' => \$gpg_signing_key, 
    14461462        'gpg-recipient=s'   => \$gpg_recipient, 
     
    16201636    } 
    16211637    return; 
     1638} 
     1639 
     1640sub time_offset() { 
     1641    my $str = shift; 
     1642    my $offset = 0; 
     1643 
     1644    if ($str =~ /(\d+)/) { 
     1645        $offset = $1; 
     1646    } else { 
     1647        die "[*] Must specify a value like 60min"; 
     1648    } 
     1649    if ($str =~ /min/i) { 
     1650        $offset *= 60; 
     1651    } elsif ($str =~ /hour/i) { 
     1652        $offset *= 60 * 60; 
     1653    } elsif ($str =~ /day/i) { 
     1654        $offset *= 60 * 60 * 24; 
     1655    } elsif ($str =~ /sec/i) { 
     1656        ### no action 
     1657    } else { 
     1658        ### default to minutes 
     1659        $offset *= 60; 
     1660    } 
     1661    return $offset; 
    16221662} 
    16231663 
     
    17751815    --get-key <file>           - Get encryption key from <file> instead of 
    17761816                                 from STDIN. 
     1817    --Test-mode                - Build SPA packet data but do not send it 
     1818                                 over the network. 
     1819    --time-offset-plus <str>   - Add a time offset to the advertised time 
     1820                                 stamp in the SPA packet (e.g. "60sec" or 
     1821                                 "1day"). 
     1822    --time-offset-minus <str>  - Subtract a time offset from the advertised 
     1823                                 time stamp in the SPA packet (e.g. "60sec" 
     1824                                 or "1day"). 
    17771825    --TCP-sock                 - Send SPA packets over an established TCP 
    17781826                                 socket with the fwknopd server.  This 
     
    17901838    -H, --Home-dir <directory> - Specify the home directory of the current 
    17911839                                 user that is running fwknop. 
    1792     -t, --time-delay <seconds> - Introduce a time delay between each 
    1793                                  connection in a knock sequence.  This is 
    1794                                  mainly used in conjunction with the 
    1795                                  MIN_TIME_DIFF access control directive. 
     1840    --time-delay <seconds>     - (Legacy port knocking mode) Introduce a 
     1841                                 time delay between each connection in a 
     1842                                 knock sequence.  This is mainly used in 
     1843                                 conjunction with the MIN_TIME_DIFF access 
     1844                                 control directive. 
    17961845    -k, --knock-dst <IP>       - Connection destination IP address for port 
    17971846                                 knock sequence (synonym for -D). 
    1798     --Test-mode                - Build SPA packet data but do not send it 
    1799                                  over the network. 
    18001847    -d, --debug                - Run fwknop in debugging mode. 
    18011848    -v, --verbose              - Verbose mode.