Commit graph

1072 commits

Author SHA1 Message Date
Erik Boasson
ebdb3fc5cf Refactor storing and unregistering writers in RHC
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
6800887a74 Always add invalid sample if empty or latest read
Disposing an instance would only add an invalid sample if the instance
is empty, but it should also do so when the latest sample is read.
Otherwise reading all NOT_READ samples gives nothing or nonsensical
output.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
0be287b67b No auto-dispose in deadline test
Use of an auto-dispose writer meant the NO_WRITERS case did not actually
get tested.  The behaviour of the implementation was to generate
deadline missed notifications for such instances, but the test expected
otherwise.

There is a disagreement between different DDS implementations on the
desirability of generating deadline missed notifications for NOT_ALIVE
instances.  Deadline notifications on DISPOSED instances seems silly, as
it means end-of-life.  Deadline notifications on a NO_WRITERS instance
are certainly valuable for applications that don't pay attention to the
number of writers (otherwise one has to monitor both liveliness changed
and deadline missed notifications to be be sure to get some
notification).

Different usage patterns definitely affect what is desirable and I doubt
one-size-fits-all is the right approach.  This commit changes the test
and retains the behaviour, and if it errs, it at least errs on the side
of caution.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
347b6edf04 Default to doing expensive checks in rhc_torture
The entire point of this test program is to exercise the RHC while
checking its internal state.  The likelihood of (at least some)
forgetting to enable the "expensive" checks has been proven to be
significant.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
7f8f1d1a12 Auto-dispose when the instance goes to NO_WRITERS
This changes the behaviour of auto-dispose writers: instead of always
disposing when the writer disposes the data, it now only disposes the
data when the instance would otherwise go to the "no writers" state.
This only affects the behaviour when there are multiple writers for the
same instance.

In case the writers use a different value for the auto-dispose setting,
it now tracks whether an instance has ever been touched by an writer
with auto-dispose enabled, and treats auto-disposes the instance when
the last writer leaves if this is the case.  This way, if an instance is
registered by one auto-dispose and one non-auto-dispose writer, the
order of unregistering does not matter.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
c29a81b339 Track deadline registration, consolidate updates
Deadline registration, renewal and deregistration was somewhat spread
through the code and relied on the "isdisposed" flag as a proxy for
whether it was registered or not.  This consolidates the deadline
handling code in a final step of updating the instance and uses a
separate flag to track whether the instance is currently registered in
the deadline administration or not.

This also makes it possible to trivially change the rules for when
deadline notifications are required, and so allows for, e.g., adding a
mode in which instances in the "no writers" state do not trigger any
deadline missed notifications, or just once (both of which seem useful
modes).

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
ff591ae684 Null instance pointer after dropping instance
Do not pass a dangling pointer to update_conditions_locked after
dropping an instance.  The dangling pointer did not actually get
dereferenced because of the state changes caused by dropping the
samples, but that is cutting a bit fine.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
8b934a7ddd Remove a layer of wrapper functions in default RHC
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
0006e09566 Add a dds_readcdr analogous to dds_takecdr
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
9aef05542f Do not scan instances in dds_{read,take}_instance
Scanning all instances was never good for anything: the RHC is organised
as hash table on instance id (which is an alias for "instance handle")
and it was always designed to do this with a fast lookup.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Erik Boasson
5f829684ef Distinguish signed, float in type descriptor
* Add a flag to indicate signed integral values and one to indicate
  floating-point values
* Set these flags in the output of idlc
* Use them when printing sample contents to the trace

By encoding the information as flags in reserved bits the actual
serialization and deserialization is unaffected.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-16 11:38:05 +02:00
Dan Rose
761ffa6db2 Add EDL 1.0 license to package.xml
This package is dual-licensed under both EPL 2.0 and EDL 1.0. The latter was omitted from package.xml by mistake.
Signed-off-by: Dan Rose <dan@digilabs.io>
2020-05-16 11:37:44 +02:00
Dennis Potman
2e6ea36fda Fix a race condition in delete_participant, that could occur on security permissions or identity expiry, which triggers a delete of the local participant
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +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
cf75263d1d Add a test that validates that a plain message is not read by a remote reader in case payload/submsg/rtps encryption or signing is enabled
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
Dennis Potman
9ba54c70e7 Don't accept plain payload in case payload encryption or payload signing is enabled in the security settings. And fixed a typo in writer not allowed message
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
2fc2cdc225 Enable matching local non-secure participants with remote secure participants that allow unauthenticated participants
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
fd27604a26 Add crypto token exchange test
Introduced a test that checks if all crypto tokens send by a node are
received correctly by the remote node. To support this test, the crypto
wrapper plugin is extended with a token_log mode, that stores all tokens
that are exchanged after the security handshake is finished.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-05-15 15:35:31 +02:00
eboasson
82af49172d
Merge pull request #511 from eboasson/security
Merge master into security
2020-05-12 19:00:52 +02:00
Prasanna Bhat
9df768b0f3 Fix PR comments
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
2020-05-12 06:49:42 +05:30
Prasanna Bhat
8776c3213b Add README.md, which describes the usage of docker scripts
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
2020-05-12 06:49:34 +05:30
Prasanna Bhat
8fc3f4bc71 Add build scripts & docker scripts
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
2020-05-12 06:48:09 +05:30
Erik Boasson
364f1ce39c Bump version number to 0.7.0
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-11 15:06:40 +02:00
Erik Boasson
2da100a3c7 Merge remote-tracking branch 'upstream/master' into security 2020-05-11 15:05:46 +02:00
Marcel Jordense
e1899df62d Fix incorrect type of include_optional_fields config parameter
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-05-11 15:03:20 +02:00
Marcel Jordense
860f261dc6 Correct generation of the crypto key
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-05-11 15:03:20 +02:00
Marcel Jordense
720c8f8fbf Correct security (de)serialization of QosProperty contained in c.data field of handshake token
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-05-11 15:03:20 +02:00
Marcel Jordense
623a5c02bd Correct handshake tokens verification w.r.t. optional fields
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-05-11 15:03:20 +02:00
Erik Boasson
96248d1e6d Bump version number in preparation for 0.6.0
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-08 10:09:11 +02:00
Erik Boasson
3c1b14e6cb Fix paths in documentation generation
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-08 10:09:11 +02:00
Erik Boasson
f8ed1f4adf Minor README updates
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-05-08 10:09:11 +02:00
Jeroen Koekkoek
45a5030683
Add instructions for Android (#506)
* Add instructions for Android

Co-authored-by: eboasson <eb@ilities.com>
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2020-05-06 12:53:56 +02:00
Erik Boasson
209edf0efb Fix config typos in source and regenerate
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-28 18:44:54 +02:00
Oliver Kellogg
1890322d4e Fix some typos in files:
README.md
docs/dev/{modules,logging,debugging}.md
docs/manual/{config,options,GettingStartedGuide/helloworld_indepth}.rst
src/idlc/src/org/eclipse/cyclonedds/compilers/IdlcCmdOptions.java

Signed-off-by: Oliver Kellogg <okellogg@users.sourceforge.net>
2020-04-28 18:44:54 +02:00
Dennis Potman
4ac06895f0 Fix format strings for handle_not_allowed calls and add format attribute check
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-22 17:41:27 +02:00
Dennis Potman
2aa0195d53 Log category for not-allowed message depends on topic discovery protection state
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-22 17:41:27 +02:00
Dennis Potman
b86e8ce0d3 Refactoring logic in q_omg_security_check_remote_reader_permissions
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-22 17:41:27 +02:00
Dennis Potman
7e6039763b Replace pp null check by assert in dds_create_writer and dds_create_reader, and rewrite logic in q_omg_security_check_remote_writer_permissions
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-22 17:41:27 +02:00
Dennis Potman
e8c349f96d Fix condition for setting identity subject in remote rights
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-22 17:41:27 +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