Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace console output by monitoring events for curve security issues #2645

Merged
merged 51 commits into from
Aug 3, 2017

Conversation

sigiesec
Copy link
Member

@sigiesec sigiesec commented Aug 3, 2017

Problem: libzmq writes on console in case of curve security issues (#2002)

Solution: refine defined ZMQ_EVENT_HANDSHAKE_FAILED event into several subtypes
replace console output by those refined events
added tests for ZMQ_EVENT_HANDSHAKE_FAILED_*

Vincent Tellier and others added 30 commits March 31, 2017 07:48
 * Mechanisms can implement a new method `error_detail()`
 * This error detail have three values for the moment: no_detail
 (default), protocol, encryption.
    + generic enough to make sense for all mechanisms.
    - low granularity level on information.
The ZMQ_EVENT_HANDSHAKE_FAILED event carries the error details
as value.
This was leading to compilation error under linux.
Removed ZMQ_EVENT_HANDSHAKE_FAILED and replaced it by:
- ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL,
- ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL,
- ZMQ_EVENT_HANDSHAKE_FAILED_ENCRYPTION

Adaptation of text case `security_curve`
This was introduced for the previous API model adaptation
`current_error_detail` was not set in every protocol error cases
The handshake failure due to mechanism mismatch in greeting is actually
a protocol error. The error handling method consider it like so and
send a protocol handshake failure monitoring event instead of no_detail.

Fixed the test_security_curve expectation as well.
The tests check the number of monitoring events received
Solution:
- properly use ZMQ_DRAFT_API conditional compilation
- use receive timeouts instead of Sleep
Solution: reduce timing dependency by using timeouts at more places
…third event

Solution: changed assertion to expect three events (needs to be checked)
Solution: removed include directive
Solution: add build configurations with libsodium and draft api
Solution: change assertion to reflect actual behaviour on CI (at least temporarily)
Solution: generalize assertion to match behavior on CI
Solution: removed inconsistent assertion on no monitor events before flushing
improved debuggability by converting function into macro
…age key

Solution: extract common code into function
Solution: introduce dummy variable
…ta in inbuffer

Solution: Skip tcp_read attempt in that case
Solution: use stream_engine_t::handshaking instead of mechanism_t::status() to determine whether still handshaking
sigiesec added 21 commits August 2, 2017 14:35
…_FAILED_ZMTP and ZMQ_EVENT_HANDSHAKE_FAILED_ZAP
Reverted erroneous change to handshaking condition
Renamed test_wrong_key to test_garbage_key
Generalized assumption in test_garbage_key to allow for ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL with error == EPIPE
@bluca bluca merged commit 5d4e30e into zeromq:master Aug 3, 2017
@bluca
Copy link
Member

bluca commented Aug 3, 2017

Great stuff, thanks @sigiesec and @vtellier !

@sigiesec sigiesec deleted the curve-events branch August 3, 2017 13:21
@vtellier
Copy link
Contributor

Thanks @sigiesec !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants