Commit graph

941 commits

Author SHA1 Message Date
eboasson
82af49172d
Merge pull request #511 from eboasson/security
Merge master into security
2020-05-12 19:00:52 +02:00
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
Michael Dodson
004932817e align buffer chunks to sizeof(void*) instead of hard coding 8 bytes
Signed-off-by:  Michael Gary Dodson <md403@cam.ac.uk>
2020-04-21 12:59:06 +02:00
Erik Boasson
080514d45a Remove redundant check for endpoint GUID in SEDP
The conversion of incoming discovery data (in "parameter list" format)
check for the presence of the entity GUID parameter for the particular
type of endpoint and use it as the key field in subsequent processing.
If the parameter is absent, deserialisation fails and the handlers are
never called and the old check is therefore no longer necessary.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-21 09:12:22 +02:00
Erik Boasson
d22032c946 Restore SEDP tracing format
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-21 09:12:22 +02:00
Dennis Potman
e8dfbabd0c Add locking when intializing remote key material
The initialization of remote participant's key material was not protected
by the remote_participant_crypto lock, which could result in using partially
initialized remote key material. This caused intermittent test failures
with assertions on key_size in crypto_cipher_decrypt_data. This commit fixes
this issue by adding locking for the remote key material.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 18:05:06 +02:00
Dennis Potman
c89f858b73 Fix memory leak that can occur when decoding rtps message with origin authentication being used
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +02:00
Dennis Potman
680c2ebf8c Call delete_proxy_participant_by_guid with implicit flag set when revoking permission or identity
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +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
bfb48e6e58 Address issues from review: replaced proxypp_pp_unrelate by deleting the (proxy)participant and added a code comment with the rationale for this approach
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
e3056402fc Implement on_revoke_identity_cb
Impement the revoke identity callback in ddsi that is called when
the identity certificate of a participant expires. In case the
identity handle that expires is from a local participant, all
proxy pp connections will be dropped for this participant. In case
the identity that expires is from a remote participant, the
corresponding proxy participant is deleted.

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
d53cdce8fe Access Control on_revoke_permissions implementation in DDSI
Implement handler for access control on_revoke_permissions. This callback
function disconnects and deletes all proxy participant that are using the
revoked permissions handle (in case of remote permissions expire) and
proxy participant that are connected with a participant for which the
permissions expire (local permissions expire).

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-16 15:30:08 +02:00
Dennis Potman
e6500b6528 Add domaingv pointer to security plugins, as a preparation for supporting the permissions_expiry callback (which needs the gv to enumerate participants.
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
Michael Dodson
b513eaac00 add freebsd support
Including FreeBSD in preprocessor conditionals for APPLE fixes issues with UDP make_socket, as described in issue #488.

Signed-off-by:  Michael Gary Dodson <md403@cam.ac.uk>
2020-04-16 09:06:08 +02:00
Marcel Jordense
534eac2a11 Remove temporarily stored crypto handles and tokens after entities are matched
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-04-12 09:24:44 +02:00
Dan Rose
b46bd7ffff Document previously undocumented changes from 0.5.1
Signed-off-by: Dan Rose <dan@digilabs.io>
2020-04-10 16:57:24 +02:00
Dan Rose
40549783d9 Add changelog file from content in github releases
Signed-off-by: Dan Rose <dan@digilabs.io>
2020-04-10 16:57:24 +02:00
Dennis Potman
829e33ac82 Remove unused field from struct ddsi_handshake
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-10 12:42:00 +02:00
Dennis Potman
1e484a3c6f Introduced a new state in handshake fsm that combines validate_remote_entity and begin_handshake_reply into a single step, which is used in case a auth_request message is received during the initial delay when starting the handshake process
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-10 12:42:00 +02:00
Dennis Potman
3a838f6912 Replace sleep in func_validate_remote_identity by an FSM wait-state before state_validate_remote_identity
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-10 12:42:00 +02:00
Dennis Potman
b2b9630c38 Prevent time-out in handshake
The security handshake is started when a node receives an SPDP message. The
SPDP receiver will reply with an SPDP, followed by a dds.sec.auth_request.
Because the initial SPDP sender will receive the auth_request immediately
after (or even before) the SPDP reply message, that node may not have finished
(or not even started) matching the remote writers and therefore it drops
the auth_request message. This results in a time-out in the handshake
process, and the auth_request has to be re-send. To avoid this, a short
(rather arbitrarily chosen, based on local testing) sleep is introduced
before the auth_request message is sent.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-04-10 12:42:00 +02:00
Erik Boasson
1fd4ab290f Do not build security tests if BUILD_IDLC=NO
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-10 09:51:35 +02:00
Erik Boasson
e88552123c Peers may have a secure announcer without using security
There exist implementations that advertise security-related
built-endpoints regardless of whether the participant has security
configured.  Therefore, the test whether security is enabled for the
participant cannot simply be the presence of such an endpoint, because
the absence of an IDENTITY_TOKEN in the data is then considered an
error.

This commit simply changes the check to requiring the presence of the
endpoint and the presence of the IDENTITY_TOKEN.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-10 09:51:35 +02:00
Erik Boasson
52edbe94e9 plist handling of invalid input and keyhashes
This fixes some issues with the new discovery data ("plist" topics)
discovered on interoperating with some other DDS implementations:

* The interpretation of a keyhash as if it were a valid sample was wrong
  in various ways: inconsistent endianness, incorrect encoding
  identifier and a missing sentinel.  As Cyclone follows the spec and
  always provides a well-formed payload, the problem only surfaces when
  interoperating with implementations that expect the recipient to make
  do with a keyhash.

* Various paths failed to check for failure causing potential null
  pointer dereferences.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-10 09:51:35 +02:00
Erik Boasson
45c0f432a9 Add dds_get_guid to get the GUID of a local entity
This is merely a more convenient way of obtaining it: otherwise one has
subscribe to the correct built-in topic, read the sample corresponding
to the entity's instance handle and get the "key" field.  That's a bit
of a detour to get the network-wide unique identifier.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-09 17:02:11 +02:00
Erik Boasson
b2cf6921da Define dds_guid_t as dds_builtintopic_guid_t
The former name should be less confusing.  Backwards compatibility is
preserved by only adding the sensible name as a typedef.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-09 17:02:11 +02:00
Erik Boasson
eb7e5e3a87 Disallow junk after optional terminator in string/binprop compare
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-07 11:40:14 +02:00
Erik Boasson
9c09eca2e9 Do not assume string in algo binary property
Interpretation of the c.dsign_algo and c.kagree_algo properties must not
assume the binary property to be a null-terminated string.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-07 11:40:14 +02:00
Marcel Jordense
cb1d06b442 Freeing the writer security attributes should be done by the gc
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-04-07 11:39:57 +02:00
Marcel Jordense
b6640d86b0 Correct length of encrypted submessage body
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-04-07 11:39:57 +02:00