Commit graph

21 commits

Author SHA1 Message Date
Erik Boasson
1f8c4f2a4c Use Security instead of DDSSecurity in test config
The configuration was changed in b25f10ff to consider the DDSSecurity
tag deprecated (there is no other), which gave rise to warnings in test
output.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-07-06 11:40:56 +02:00
Erik Boasson
7cbf8b7a19 Make security tests fail less on matching timeouts
Some of the tests wait until reader/writing matching has completed in
multiple steps and/or interleave entity creation and waiting for
matching.  This commit moves the waiting to the end and uses a (mostly
arbitrary) absolute timeout rather than an arbitrary relative one that
could (but fortunately never -- or rarely -- did) add up to durations
that could easily cause the overall test to time out.

For the specific case of the access control permission expiry test (a
particularly problematic case), it uses the first expiry time and gives
a bit more time for the discovery.  This appears to significantly reduce
the number of failures.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-07-06 11:40:56 +02:00
Dennis Potman
cc8308819d Refactor access control test permissions_expiry_multiple to reduce timing issues in test runs on travis
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-20 15:59:15 +02:00
Erik Boasson
be7f7af741 Tweak timeout handling of authentication tests
* Compute the time at which the handshake must have completed from the
  initial timeout specification, rather than using it as a timeout for
  the individual steps of the handshake
* If the handshake fails because an expected message is not present,
  print this, including whether the timeout occured because the message
  queue was empty or because the expected message could not be found in
  a non-empty queue.
* Replace the 0.5s per-step timeout to a single 2s timeout.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Dennis Potman
a151c5f184 Processed review comments: added missing return topic_sec_attr in function is_topic_discovery_protected, moved returns-logging in access plugin to wrapper mode and removed specific test for this (as it will be tested in other access control tests now). Some cleanup in circular list usage in crypto and access control plugins
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
32bba389c8 Add test descriptions as code comment in security core tests
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
48e411bb76 Fix rd-wr synchronization in access control expiry_multiple test
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
24594f68fb Add access control test for testing that communication for an allowed topic keeps working when a writer for a denied topic is created
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
edcbe1b22e Add a test that checks if all tokens and attributes are returned to the access control plugin
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
6185a5ab2a Add a test to validate that a non-secure participant can connect with a secure participant that allows unauthenticated participants. The non-secure pp should only be able to read data for a topic that is not secured
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
155f8c059d Add read-write protection tests
Introduced a test that checks for the correct matching behavious for  combinations
of the read/write access control settings in the governance xml (enable read/write
access control in the topic rules) and in the permissions xml (the publish/subscribe
grants for a topic).

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
45adb6f0c7 Extend access-control tests with validate_local_permissions
Add validate_local_permissions to the set of access control plugin
hooks tests, and add discovery_protection_enabled as an additional
parameter for the access control hook tests.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
0348bb2741 Security liveliness protection tests
Add testing liveness protection to the existing discovery protection
test. The test checks if the P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER
is using the encode_decode_submessage function of the crypto plugin
to secure liveliness messages.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
231d820052 Add security encoding-mismatch test
A test that checks that the security handshake fails in case of non-matching
encoding settings in the governance xml. All combinations of values for
rtps, discovery and liveliness protection are checked. For meta-data and
payload encoding, this test checks that a reader and writer do not connect
in case of non-matching values.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
9f261423e3 Add tests for discovery protection
Adding a test that checks the effects of using different configuration settings
for discovery protection. This test set uses the cryptography wrapper to count
the number of invocations of the encode and decode functions during a session
and checks the counts with the expected values.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
19bc6f33cc Access control tests
Add test cases for the join_access_control governance setting and for
the access control plugin check_create_ and check_remote_ hooks,
using a wrapper plugin that simulates failure for each of these,
to test the DDSI integration with the access control plugin.
This commit also contains fixes for:
- an assert on DDS_RETCODE_OK in dds_create_reader and
dds_create_writer that cased the application to terminate in case
creation of a reader or writer is not allowed by security
- do not match a proxy reader that has the 'relay_only' set to
true, which is currently unsupported

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-22 17:41:27 +02:00
Dennis Potman
dae562c602 Improve delays/timing in permissions_expiry_multiple test
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +02:00
Dennis Potman
5e721c99e5 Change test timing and time-outs in access-control and authentication
expiry tests and add timestamps to test logging to get more stable
test results on Travis and enable analysing timeing issues.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +02:00
Dennis Potman
736d0a027a Add access control tests for permissions expiry and move some reused test
functions to common utils file.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +02:00
Dennis Potman
a6a9d1f7c1 Security core tests: new tests and refactoring
Refactoring security core tests and adding more tests:
- Dynamically generate ca and identity certificates in authentication tests, so that certificate expiry is tested.
Added writing/reading samples to these tests to ensure that nodes can (or cannot) communicate in a specific test case
- Secure communication tests: improved the validation of encryption in wrapper
- Added test for access control plugin settings
- Replaced the in-code test identities (and included ca private keys), added an additional identity

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +02:00
Dennis Potman
0a9d391c64 Fixed logging in find_own_ip
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-03-05 15:25:16 +01:00