Changeset 1260
- Timestamp:
- 09/28/08 22:02:10 (2 months ago)
- Files:
-
- fwknop/trunk/ChangeLog (modified) (1 diff)
- fwknop/trunk/fwknopd (modified) (6 diffs)
- fwknop/trunk/test/conf/gpg2_access.conf (added)
- fwknop/trunk/test/conf/gpg2_fwknop.conf (added)
- fwknop/trunk/test/fwknop_test.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fwknop/trunk/ChangeLog
r1256 r1260 50 50 - (Test suite) Added tests for GPG_NO_REQUIRE_PREFIX functionality and for 51 51 the expected GnuPG prefix. 52 - (Test suite) Added tests for GnuPG version 2 (a check is made to see if 53 it is installed before these tests are run). 52 54 53 55 fwknop-1.9.7 (08/24/2008): fwknop/trunk/fwknopd
r1259 r1260 3478 3478 } elsif ($line =~ /^\s*GPG_REMOTE_ID:\s*(.*)\s*;/) { 3479 3479 unless ($imported_gpg) { 3480 &check_commands({'gpg' => ''}, {});3481 3480 require GnuPG::Interface; 3482 3481 print STDERR "[+] GnuPG::Interface::VERSION ", … … 3490 3489 } elsif ($line =~ /^\s*GPG_DECRYPT_ID:\s*(.*)\s*;/) { 3491 3490 unless ($imported_gpg) { 3492 &check_commands({'gpg' => ''}, {});3493 3491 require GnuPG::Interface; 3494 3492 print STDERR "[+] GnuPG::Interface::VERSION ", … … 3499 3497 } elsif ($line =~ /^\s*GPG_DECRYPT_PW:\s*(.*)\s*;/) { 3500 3498 unless ($imported_gpg) { 3501 &check_commands({'gpg' => ''}, {});3502 3499 require GnuPG::Interface; 3503 3500 print STDERR "[+] GnuPG::Interface::VERSION ", … … 3508 3505 } elsif ($line =~ /^\s*GPG_HOME_DIR:\s*(\S+)\s*;/) { 3509 3506 unless ($imported_gpg) { 3510 &check_commands({'gpg' => ''}, {});3511 3507 require GnuPG::Interface; 3512 3508 print STDERR "[+] GnuPG::Interface::VERSION ", … … 3920 3916 $access_hr->{'GPG_PATH'} = '' 3921 3917 unless defined $access_hr->{'GPG_PATH'}; 3918 unless ($access_hr->{'GPG_PATH'}) { 3919 &check_commands({'gpg' => ''}, {}); 3920 } 3922 3921 } 3923 3922 if (defined ($access_hr->{'REQUIRE_AUTH_METHOD'})) { … … 4233 4232 4234 4233 ### make sure command paths are correct 4235 &check_commands({}, {'gpg' => '' }) unless $os_fprint_only;4234 &check_commands({}, {'gpg' => '', 'gpg2' => ''}) unless $os_fprint_only; 4236 4235 4237 4236 if ($fw_del_ip) { fwknop/trunk/test/fwknop_test.pl
r1257 r1260 41 41 my $tcpdumpCmd = '/usr/sbin/tcpdump'; 42 42 my $gpgCmd = '/usr/bin/gpg'; 43 my $gpg2Cmd = '/usr/bin/gpg2'; 43 44 44 45 my $conf_dir = 'conf'; … … 49 50 my $default_access_conf = "$conf_dir/default_access.conf"; 50 51 my $default_fwknop_conf = "$conf_dir/default_fwknop.conf"; 52 my $gpg2_fwknop_conf = "$conf_dir/gpg2_fwknop.conf"; 51 53 my $fwknop_62203_conf = "$conf_dir/filter_62203_fwknop.conf"; 52 54 my $sha256_fwknop_conf = "$conf_dir/sha256_fwknop.conf"; … … 62 64 my $rand_port_fwknop_conf = "$conf_dir/rand_port_fwknop.conf"; 63 65 my $gpg_access_conf = "$conf_dir/gpg_access.conf"; 66 my $gpg2_access_conf = "$conf_dir/gpg2_access.conf"; 64 67 my $gpg_access_no_prefix_conf = "$conf_dir/gpg_access_no_prefix.conf"; 65 68 my $no_promisc_fwknop_conf = "$conf_dir/no_promisc_fwknop.conf"; … … 503 506 } 504 507 508 if (-e $gpg2Cmd and -x $gpg2Cmd) { 509 &test_driver('(GnuPG v2) Generating SPA access packet', 510 \&SPA_gpg2_access_packet); 511 &test_driver('(GnuPG v2) Sniffing SPA access packet to acquire access', 512 \&gpg2_sniff_decrypt); 513 &test_driver('(GnuPG v2) Verifying sniffed SPA access packet format', 514 \&spa_access_format); 515 &test_driver('(GnuPG v2) Firewall access rules exist', \&fw_rules_exist); 516 &fw_sleep('(GnuPG v2)'); 517 &test_driver('(GnuPG v2) Firewall access rules removed', 518 \&fw_rules_removed); 519 &test_driver('(GnuPG v2) Stopping all running fwknopd processes', 520 \&stop_fwknopd); 521 } 522 505 523 ### test SPA command execution instead of access requests 506 524 &test_driver('(Command execution) Generating SPA command packet', … … 1519 1537 } 1520 1538 1539 sub gpg2_sniff_decrypt() { 1540 1541 if (&run_fwknopd($cache_encrypted_spa_packet, 1542 $gpg2_fwknop_conf, $gpg2_access_conf)) { 1543 1544 ### now that fwknopd has exited, see if the SPA packet was valid 1545 open SE, "< $current_test_file" 1546 or die "[*] Could not open $current_test_file: $!"; 1547 while (<SE>) { 1548 if (/\[\-\]\s+Key\s+mis\-?match/i) { 1549 ### [-] Key mis-match or broken message checksum for SOURCE \ 1550 ### ANY (# 1 in access.conf) 1551 close SE; 1552 return &print_errors("[-] Key mis-match"); 1553 } elsif (/\[\-\]\s+Decrypted.*not\s+conform/i) { 1554 ### [-] Decrypted message does not conform to a valid SPA packet 1555 close SE; 1556 return &print_errors("[-] Invalid SPA packet"); 1557 } 1558 } 1559 close SE; 1560 return 1; 1561 } 1562 return &print_errors("[-] Sniff alarm ($sniff_alarm seconds) expired"); 1563 } 1564 1521 1565 sub SPA_sniff_decrypt() { 1522 1566 return &sniff_decrypt($default_fwknop_conf); … … 2312 2356 "--Include-gpg-prefix", 2313 2357 $NO_QUIET); 2358 } 2359 2360 sub SPA_gpg2_access_packet() { 2361 return &get_access_packet("$default_fwknop_args " . 2362 "--gpg-home conf/client-gpg --gpg-recip $gpg_server_key " . 2363 "--gpg-sign $gpg_client_key --gpg-no-options " . 2364 "--gpg-path $gpg2Cmd", $NO_QUIET); 2314 2365 } 2315 2366
