Changeset 1266

Show
Ignore:
Timestamp:
09/29/08 23:36:50 (2 months ago)
Author:
mbr
Message:

- Bugfix to make sure that neither fwknop nor fwknopd reference any
options file in GnuPG mode, and this is now the default (which overrides
the now unnecessary --gpg-no-options arg). There is a new option
--gpg-use-options to restore the usage of an options file by GnuPG (not
normally needed).

Files:

Legend:

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

    r1264 r1266  
    1414      /usr/bin/gpg), and another SOURCE stanza to apply to another gpg binary 
    1515      (say /usr/bin/gpg2). 
     16    - Bugfix to make sure that neither fwknop nor fwknopd reference any 
     17      options file in GnuPG mode, and this is now the default (which overrides 
     18      the now unnecessary --gpg-no-options arg).  There is a new option 
     19      --gpg-use-options to restore the usage of an options file by GnuPG (not 
     20      normally needed). 
    1621    - Added '--gpg-prefix <bytes>' to the fwknop client so that the 
    1722      predictable prefix for GnuPG encrypted data can be changed.  Normally 
     
    5257 
    5358      http://www.cipherdyne.org/blog/2008/09/visualizing-spa-packet-randomness.html 
     59 
    5460    - (Test suite) Added tests for GPG_NO_REQUIRE_PREFIX functionality and for 
    5561      the expected GnuPG prefix. 
  • fwknop/trunk/fwknop

    r1262 r1266  
    9797my $client_src_port = 0; 
    9898my $gpg_default_key = 0; 
     99my $gpg_use_options = 0; 
    99100my $err_wait_timer  = 30;  ### seconds 
    100101my $resolve_ip_url  = 'http://www.whatismyip.org/'; 
     
    721722    my %gnupg_options = ( 
    722723        'batch' => 1, 
    723         'homedir' => $gpg_home_dir 
     724        'homedir' => $gpg_home_dir, 
     725        'no_options' => 1 
    724726    ); 
    725727 
    726728    delete $gnupg_options{'batch'} if $gpg_verbose; 
     729    delete $gnupg_options{'no_options'} if $gpg_use_options; 
    727730 
    728731    $gnupg->options->hash_init(%gnupg_options); 
    729  
    730     $gnupg->options->no_options() if $gpg_no_options; 
    731732 
    732733    ### if --gpg-default-key is given, then we trust that the user has 
    733734    ### set the default key with the default-key variable in ~/.gnupg/options 
    734     ### and --no-gpg-options is not used on the fwknop command line. 
    735     $gnupg->options->default_key($gpg_signing_key) unless $gpg_default_key; 
     735    ### and we need to enable options 
     736    if ($gpg_default_key) { 
     737        delete $gnupg_options{'no_options'} 
     738            if defined delete $gnupg_options{'no_options'}; 
     739    } else { 
     740        $gnupg->options->default_key($gpg_signing_key); 
     741    } 
    736742 
    737743    $gnupg->options->push_recipients($gpg_recipient); 
     
    16361642        'gpg-agent-info=s'  => \$gpg_agent_info, 
    16371643        'gpg-no-options'    => \$gpg_no_options, 
     1644        'gpg-use-options'   => \$gpg_use_options, 
    16381645        'gpg-prefix=s'      => \$gpg_prefix, 
    16391646        'gpg-path=s'        => \$gpg_path, 
     
    19051912        if (($gpg_default_key or $gpg_signing_key) and not $gpg_recipient); 
    19061913 
    1907     die "[*] Cannot assume a default key when --gpg-no-options is used." 
    1908         if ($gpg_default_key and $gpg_no_options); 
    1909  
    19101914    die "[*] Cannot spoof source address for a real TCP socket." 
    19111915        if ($spoof_src and $spa_established_tcp); 
     
    19171921        die "[*] $gpg_path does not exist." unless -e $gpg_path; 
    19181922        die "[*] $gpg_path not executable." unless -x $gpg_path; 
     1923    } 
     1924 
     1925    if ($gpg_no_options) { 
     1926        print "[-] Options are disabled by default, so --gpg-no-options ", 
     1927            "is not used.\n"; 
    19191928    } 
    19201929    return; 
     
    19591968                                 'gpg-agent --daemon'. 
    19601969    --gpg-verbose              - Display all output from GnuPG process. 
    1961     --gpg-no-options           - In GnuPG mode, instruct GnuPG to not us
    1962                                  the local ~/.gnupg/options file for config 
    1963                                  parameters
     1970    --gpg-use-options          - In GnuPG mode, instruct GnuPG to use th
     1971                                 local ~/.gnupg/options file for config 
     1972                                 parameters (this is disabled by default)
    19641973    --gpg-prefix <bytes>       - Change the bytes for the expected GnuPG 
    19651974                                 prefix from 'hQ' to the specified string. 
  • fwknop/trunk/fwknop.8

    r1250 r1266  
    277277purposes if it appears that the GnuPG encrypt/decrypt is not performing correctly. 
    278278.TP 
    279 .BR \-\^\-gpg-no-options 
    280 Instruct 
    281 .B fwknop 
    282 to not have 
    283 .B gpg 
    284 reference any options file when creating SPA packets in GnuPG mode. 
     279.BR \-\^\-gpg-use-options 
     280By default the 
     281.B fwknop 
     282client instructs gpg to not reference any options file in gpg mode, but this 
     283command line argument can be used to re-enable them. 
    285284.TP 
    286285.BR \-\^\-Home-dir\ \<dir> 
  • fwknop/trunk/fwknopd

    r1265 r1266  
    105105my $gpg_agent_info = ''; 
    106106my $gpg_no_options = 0; 
     107my $gpg_use_options = 0; 
    107108my $gpg_default_prefix = 'hQ';  ### base64 encoded 0x8502 
    108109my $build_ipt_config = 0; 
     
    229230    'GPG_HOME_DIR'   => '', 
    230231    'GPG_NO_OPTIONS' => 0, 
     232    'GPG_USE_OPTIONS' => 0, 
    231233    'GPG_NO_REQUIRE_PREFIX' => 0, 
    232234    'GPG_PREFIX' => '', 
     
    23412343    my %gnupg_options = ( 
    23422344        'batch'   => 1, 
    2343         'homedir' => $access_hr->{'GPG_HOME_DIR'} 
     2345        'homedir' => $access_hr->{'GPG_HOME_DIR'}, 
     2346        'no_options' => 1 
    23442347    ); 
    23452348 
    23462349    delete $gnupg_options{'batch'} if ($debug and $verbose and not $test_mode); 
     2350    delete $gnupg_options{'batch'} if $access_hr->{'GPG_USE_OPTIONS'}; 
    23472351 
    23482352    $gnupg->options->hash_init(%gnupg_options); 
    2349  
    2350     $gnupg->options->no_options() 
    2351         if $gpg_no_options or $access_hr->{'GPG_NO_OPTIONS'}; 
    23522353 
    23532354    if ($access_hr->{'GPG_PATH'}) { 
     
    35513552                    } else { 
    35523553                        $access_hsh{'GPG_NO_OPTIONS'} = 0; 
     3554                    } 
     3555                } elsif ($line =~ /^\s*GPG_USE_OPTIONS:\s*(\S+);/) { 
     3556                    my $val = $1; 
     3557                    if ($val =~ /y/i) { 
     3558                        $access_hsh{'GPG_USE_OPTIONS'} = 1; 
     3559                    } else { 
     3560                        $access_hsh{'GPG_USE_OPTIONS'} = 0; 
    35533561                    } 
    35543562                } elsif ($line =~ /^\s*GPG_NO_REQUIRE_PREFIX:\s*(\S+);/) { 
     
    39503958            $access_hr->{'GPG_PATH'} = '' 
    39513959                unless defined $access_hr->{'GPG_PATH'}; 
     3960            $access_hr->{'GPG_NO_OPTIONS'} = 0 
     3961                unless defined $access_hr->{'GPG_NO_OPTIONS'}; 
     3962            $access_hr->{'GPG_USE_OPTIONS'} = 0 
     3963                unless defined $access_hr->{'GPG_USE_OPTIONS'}; 
    39523964            unless ($access_hr->{'GPG_PATH'}) { 
    39533965                &check_commands({'gpg' => ''}, {}); 
     
    40484060        'gpg-agent-info=s' => \$gpg_agent_info, 
    40494061        'gpg-no-options'   => \$gpg_no_options, 
     4062        'gpg-use-options'  => \$gpg_use_options, 
    40504063        'debug'          => \$debug, 
    40514064        'Kill'           => \$kill, 
  • fwknop/trunk/fwknopd.8

    r1255 r1266  
    214214then fwknopd will default to using the /root/.gnupg directory for the server key(s). 
    215215.TP 
    216 .B GPG_NO_OPTIONS 
    217 Make sure that GnuPG does not reference any options file when decrypting incoming 
    218 SPA packets that have been encrypted with GnuPG by the fwknop client. 
     216.B GPG_USE_OPTIONS 
     217By default, 
     218.B fwknopd 
     219instructs gpg to not reference any options file when decrypting incoming 
     220SPA packets that have been encrypted with GnuPG by the fwknop client.  This argument 
     221re-enables options in gpg. 
    219222.TP 
    220223.B GPG_NO_REQUIRE_PREFIX 
  • fwknop/trunk/test/fwknop_test.pl

    r1264 r1266  
    182182    'loopback-intf=s'   => \$loopback_intf, 
    183183    'test-include=s'    => \$test_include, 
     184    'include=s'         => \$test_include,  ### synonym 
    184185    'test-exclude=s'    => \$test_exclude, 
     186    'exclude=s'         => \$test_exclude,  ### synonym 
    185187    'test-system-fwknop' => \$test_system_installed_fwknop, 
    186188    'help'              => \$help 
     
    23672369    return &get_access_packet("$default_fwknop_args " . 
    23682370        "--gpg-home conf/client-gpg --gpg-recip $gpg_server_key " . 
    2369         "--gpg-sign $gpg_client_key --gpg-no-options", $NO_QUIET); 
     2371        "--gpg-sign $gpg_client_key", $NO_QUIET); 
    23702372} 
    23712373 
     
    23732375    return &get_access_packet("$default_fwknop_args " . 
    23742376        "--gpg-home conf/client-gpg --gpg-recip $gpg_server_key " . 
    2375         "--gpg-sign $gpg_client_key --gpg-no-options " . 
    2376         "--Include-gpg-prefix", 
     2377        "--gpg-sign $gpg_client_key --Include-gpg-prefix", 
    23772378        $NO_QUIET); 
    23782379} 
     
    23812382    return &get_access_packet("$default_fwknop_args " . 
    23822383        "--gpg-home conf/client-gpg --gpg-recip $gpg_server_key " . 
    2383         "--gpg-sign $gpg_client_key --gpg-no-options " . 
    2384         "--gpg-path $gpg2Cmd", $NO_QUIET); 
     2384        "--gpg-sign $gpg_client_key --gpg-path $gpg2Cmd", 
     2385        $NO_QUIET); 
    23852386} 
    23862387