Skip to content

Commit

Permalink
[test suite] added command cycle close NONE test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrash committed Nov 18, 2015
1 parent 0bf4993 commit f6829fe
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ EXTRA_DIST = \
test/conf/hmac_cmd_open_close_cycle_access3.conf \
test/conf/hmac_cmd_open_close_cycle_access4.conf \
test/conf/hmac_cmd_open_close_cycle_access5.conf \
test/conf/hmac_cmd_open_close_cycle_access6.conf \
test/conf/hmac_cmd_open_close_multi_cycle_access.conf \
test/conf/hmac_get_key_access.conf \
test/conf/hmac_no_b64_access.conf \
Expand Down
5 changes: 5 additions & 0 deletions test/conf/hmac_cmd_open_close_cycle_access6.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SOURCE ANY
KEY_BASE64 wzNP62oPPgEc+kXDPQLHPOayQBuNbYUTPP+QrErNDmg=
HMAC_KEY_BASE64 Yh+xizBnl6FotC5ec7FanVGClRMlsOAPh2u6eovnerfBVKwaVKzjGoblFMHMc593TNyi0dWn4opLoTIV9q/ttg==
CMD_CYCLE_OPEN /usr/bin/touch /tmp/$SRC
CMD_CYCLE_CLOSE NONE
11 changes: 8 additions & 3 deletions test/test-fwknop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
'hmac_cmd_open_close_cycle_access3' => "$conf_dir/hmac_cmd_open_close_cycle_access3.conf",
'hmac_cmd_open_close_cycle_access4' => "$conf_dir/hmac_cmd_open_close_cycle_access4.conf",
'hmac_cmd_open_close_cycle_access5' => "$conf_dir/hmac_cmd_open_close_cycle_access5.conf",
'hmac_cmd_open_close_cycle_access6' => "$conf_dir/hmac_cmd_open_close_cycle_access6.conf",
'hmac_cmd_open_close_multi_cycle_access' => "$conf_dir/hmac_cmd_open_close_multi_cycle_access.conf",
'spa_destination' => "$conf_dir/destination_rule_fwknopd.conf",
"${fw_conf_prefix}_spa_dst_snat" => "$conf_dir/${fw_conf_prefix}_spa_dst_snat_fwknopd.conf",
Expand Down Expand Up @@ -4862,6 +4863,7 @@ ()
unlink $file if -e $file;
}
for my $file (@{$test_hr->{'cmd_cycle_close_file'}}) {
next if $file eq 'NONE';
unlink $file if -e $file;
}

Expand All @@ -4872,9 +4874,11 @@ ()
$rv = 0;
}

unless (&file_check_and_remove('cycle close file',
$test_hr->{'cmd_cycle_close_file'})) {
$rv = 0;
unless ($test_hr->{'cmd_cycle_close_file'} eq 'NONE') {
unless (&file_check_and_remove('cycle close file',
$test_hr->{'cmd_cycle_close_file'})) {
$rv = 0;
}
}

return $rv;
Expand All @@ -4885,6 +4889,7 @@ ()
my $rv = 1;

for my $file (@$files_ar) {
next if $file eq 'NONE';
if (-e $file) {
&write_test_file(
"[+] $log_str $file exists after SPA cycle.\n",
Expand Down
16 changes: 16 additions & 0 deletions test/tests/rijndael_hmac_cmd_open_close.pl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@
qr/Running.*CLOSE.*in 2 seconds/,
],
},
{
'category' => 'Rijndael+HMAC',
'subcategory' => 'client+server',
'detail' => 'cmd open/close cycle close=NONE',
'function' => \&spa_cmd_open_close_exec_cycle,
'cmdline' => $default_client_hmac_args,
'fwknopd_cmdline' => "$fwknopdCmd -c $cf{'def'} -a $cf{'hmac_cmd_open_close_cycle_access6'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fw_rule_created' => $REQUIRE_NO_NEW_RULE,
'cmd_cycle_open_file' => ['/tmp/127.0.0.2'],
'cmd_cycle_close_file' => ['NONE'],
'key_file' => $cf{'rc_hmac_b64_key'},
'server_negative_output_matches' => [
qr/Timer expired/,
],
},

{
'category' => 'Rijndael+HMAC',
Expand Down

0 comments on commit f6829fe

Please sign in to comment.