diff --git a/test/tests/basic_operations.pl b/test/tests/basic_operations.pl index a03447a5..dceeb07e 100644 --- a/test/tests/basic_operations.pl +++ b/test/tests/basic_operations.pl @@ -426,7 +426,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/HMAC\sType\:\s.*SHA1/], - 'rc_positive_output_matches' => [qw/USE_HMAC.*Y/], + 'rc_positive_output_matches' => [qr/USE_HMAC.*Y/], }, { 'category' => 'basic operations', @@ -438,7 +438,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/Username\:\ssomeuser/], - 'rc_positive_output_matches' => [qw/SPOOF_USER.*someuser/], + 'rc_positive_output_matches' => [qr/SPOOF_USER.*someuser/], }, { 'category' => 'basic operations', @@ -450,7 +450,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/HMAC\sType\:\s.*SHA1/], - 'rc_positive_output_matches' => [qw/SPOOF_SOURCE_IP.*3.3.3.3/], + 'rc_positive_output_matches' => [qr/SPOOF_SOURCE_IP.*3.3.3.3/], }, { 'category' => 'basic operations', @@ -462,7 +462,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/HMAC\sType\:\s.*SHA1/, qr/destination\sport\:\s(?!62201)/], - 'rc_positive_output_matches' => [qw/RAND_PORT.*Y/], + 'rc_positive_output_matches' => [qr/RAND_PORT.*Y/], }, { 'category' => 'basic operations', @@ -472,9 +472,9 @@ 'cmdline' => "$client_save_rc_args -n default --nat-local", 'save_rc_stanza' => [{'name' => 'default', 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', - 'HMAC_DIGEST_TYPE' => 'SHA1'}}], + 'HMAC_DIGEST_TYPE' => 'SHA1', 'NAT_LOCAL' => 'N'}}], 'positive_output_matches' => [qr/Nat\sAccess\:\s127.0.0.1\,22/], - 'rc_positive_output_matches' => [qw/NAT_LOCAL.*Y/], + 'rc_positive_output_matches' => [qr/NAT_LOCAL.*Y/], }, { 'category' => 'basic operations', @@ -486,7 +486,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/Nat\sAccess\:\s192.168.10.1\,12345/], - 'rc_positive_output_matches' => [qw/NAT_ACCESS.*192.168.10.1\:12345/], + 'rc_positive_output_matches' => [qr/NAT_ACCESS.*192.168.10.1\:12345/], }, { 'category' => 'basic operations', @@ -496,9 +496,10 @@ 'cmdline' => "$client_save_rc_args -n default -N 192.168.10.1:12345 --nat-rand-port", 'save_rc_stanza' => [{'name' => 'default', 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', - 'HMAC_DIGEST_TYPE' => 'SHA1'}}], + 'HMAC_DIGEST_TYPE' => 'SHA1', 'NAT_RAND_PORT' => 'N', + 'NAT_ACCESS' => '192.168.10.1:33333'}}], 'positive_output_matches' => [qr/Nat\sAccess\:\s192.168.10.1\,12345/], - 'rc_positive_output_matches' => [qw/NAT_ACCESS.*192.168.10.1\:12345/], + 'rc_positive_output_matches' => [qr/NAT_ACCESS.*192.168.10.1\:12345/, qr/NAT_RAND_PORT.*Y/], }, { 'category' => 'basic operations', @@ -508,9 +509,43 @@ 'cmdline' => "$client_save_rc_args -n default -N 192.168.10.1:12345 --nat-port 22211", 'save_rc_stanza' => [{'name' => 'default', 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', - 'HMAC_DIGEST_TYPE' => 'SHA1'}}], + 'HMAC_DIGEST_TYPE' => 'SHA1', 'NAT_PORT' => '11111'}}], 'positive_output_matches' => [qr/Nat\sAccess\:\s192.168.10.1\,12345/, qr/Message.*22211/], - 'rc_positive_output_matches' => [qw/NAT_ACCESS.*192.168.10.1\:12345/], + 'rc_positive_output_matches' => [qr/NAT_ACCESS.*192.168.10.1\:12345/, qr/NAT_PORT.*22211/], + }, + { + 'category' => 'basic operations', + 'subcategory' => 'client save rc file', + 'detail' => 'save pkt to file', + 'function' => \&client_rc_file, + 'cmdline' => "$client_save_rc_args -n default -s -B run/spa.pkt", + 'save_rc_stanza' => [{'name' => 'default', + 'vars' => {'KEY' => 'testtest', 'ALLOW_IP' => 'source'}}], + 'positive_output_matches' => [qr/Message.*0.0.0.0/], + 'rc_positive_output_matches' => [qr/ALLOW_IP.*0.0.0.0/], + }, + { + 'category' => 'basic operations', + 'subcategory' => 'client save rc file', + 'detail' => 'save pkt to file (append)', + 'function' => \&client_rc_file, + 'cmdline' => "$client_save_rc_args -n default -s -b -B run/spa.pkt", + 'save_rc_stanza' => [{'name' => 'default', + 'vars' => {'KEY' => 'testtest', 'ALLOW_IP' => 'source'}}], + 'positive_output_matches' => [qr/Message.*0.0.0.0/], + 'rc_positive_output_matches' => [qr/ALLOW_IP.*0.0.0.0/], + }, + + { + 'category' => 'basic operations', + 'subcategory' => 'client save rc file', + 'detail' => 'allow source', + 'function' => \&client_rc_file, + 'cmdline' => "$client_save_rc_args -n default -s", + 'save_rc_stanza' => [{'name' => 'default', + 'vars' => {'KEY' => 'testtest', 'ALLOW_IP' => 'source'}}], + 'positive_output_matches' => [qr/Message.*0.0.0.0/], + 'rc_positive_output_matches' => [qr/ALLOW_IP.*0.0.0.0/], }, { 'category' => 'basic operations', @@ -547,7 +582,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/HMAC\sType\:\s.*SHA1/], - 'rc_positive_output_matches' => [qw/KEY.*somefile/], + 'rc_positive_output_matches' => [qr/KEY.*somefile/], }, { 'category' => 'basic operations', @@ -559,7 +594,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/HMAC\sType\:\s.*SHA1/], - 'rc_positive_output_matches' => [qw/KEY.*somefile/], + 'rc_positive_output_matches' => [qr/KEY.*somefile/], }, { 'category' => 'basic operations', @@ -638,7 +673,7 @@ 'vars' => {'KEY' => 'testtest', 'HMAC_KEY' => 'hmactest', 'HMAC_DIGEST_TYPE' => 'SHA1'}}], 'positive_output_matches' => [qr/HMAC\sType\:\s.*MD5/], - 'rc_positive_output_matches' => [qr/HMAC_DIGEST_TYPE.*MD5/, qw/USE_HMAC.*Y/], + 'rc_positive_output_matches' => [qr/HMAC_DIGEST_TYPE.*MD5/, qr/USE_HMAC.*Y/], }, { 'category' => 'basic operations',