Граф коммитов

220 Коммитов

Автор SHA1 Сообщение Дата
Julien Maffre 544d99e841
Add 1tx to 2tx reconfiguration migration to LTS test (#3442) 2022-01-24 15:27:17 +00:00
Julien Maffre 2627cead1f
Remove `public:ccf.gov.nodes.network.configuration` KV table and simplify reconfiguration hook logic (#3421) 2022-01-21 14:11:48 +00:00
Julien Maffre 2c8eea791a
Remove retired nodes from store (#3409) 2022-01-20 10:10:37 +00:00
Christoph M. Wintersteiger 42b12921c1
Remove more mbedTLS leftovers (#3428) 2022-01-19 13:13:08 +00:00
Julien Maffre 42bc3c6a87
Service certificate validity period and renewal (#3363) 2022-01-19 10:35:38 +00:00
Christoph M. Wintersteiger 8666bbc96f
Remove mbedTLS (#3394)
Now that we use OpenSSL for TLS connections, we removed the remaining bits that relied on mbedTLS.
2022-01-18 17:43:53 +00:00
Eddy Ashton 135bfbe3cf
Add initial implementation of Indexing system (#3280) 2022-01-14 15:49:56 +00:00
Eddy Ashton 21cd9b9674
Move constitutions to samples directory (#3401) 2022-01-13 18:31:53 +00:00
Eddy Ashton 4b67651af3
Remove `proposal_generator.py` (#3400) 2022-01-13 17:14:37 +00:00
Renato Golin 4a364317cb
Implement TLS in OpenSSL, support TLS 1.3 (#3361)
* Implement TLS in OpenSSL, support TLS 1.3

This is a large commit, implementing the TLS layer in OpenSSL,
together with mbedTLS, and is part of a transition to eliminate
mbedTLS from the codebase.

The src/crypto part is done already and this is a similar effort
on src/tls. The last part is src/clients (used for testing) and
will be done as a future patch, with extensive testing separate
than this work.

This commit has a temporary structure, to allow a compiler flag
to switch between OpenSSL and mbedTLS. Unlike src/crypto, we want
the transition to be as short lived as possible, so we didn't try
to create common classes, just an include trick to use the right
library.

The main changes, in order from most generic to most specific, are:

1.  The CMake flag `TLS_PROVIDER_IS_MBEDTLS` was introduced, turned
    OFF by default, to build CCF with mbedTLS instead of OpenSSL. This
    is for testing, in case we find issues with the new implementation.
    This is in addition to `CRYPTO_PROVIDER_IS_MBEDTLS` so we can set
    each flag independently.
2.  The OpenSSL library (`libssl`) that we use is from the same place
    we pick the Crypto library (`libcrypto`). Either the system or
    OpenEnclave, decided elsewhere. No new libraries are needed.
3.  Some of the existing mbedTLS headers were moved to src/clients to
    isolate that migration from the server side. So far, it only
    needed `ca.h` and `cert.h`, which are self-conatined. Those
    will be removed with the mbedTLS cleanup.
4.  A number of `#ifdef TLS_PROVIDER_IS_MBEDTLS` were added where
    there was no other way to common up implementation. Most notably
    in the previous TLS headers (`src/tls/*.h`) that are now just
    wrappers to the actual headers (`src/tls/{mbedtls,openssl}/*.h`).
5.  All TLS errors on both mbedTLS and OpenSSL have been #defined
    to a common set of `TLS_ERR_` errors, to allow for common error
    handlind, including `WANT_READ` and `WANT_WRITE`. To keep the
    mbedTLS way, OpenSSL has a hack to return the negative
    counterparts of the error codes, so that we can treat them as
    errors, like mbedTLS.
6.  To keep the current CCF implementation intact, we had to keep
    the callback mechanism in OpenSSL. This isn't the most natural
    way of handling BIOs but it works. Both `tls_endpoint` and
    `tls_test` have a similar implementation, handling asynchronous
    I/O. This should disappear later (probably well after removing
    mbedTLS from the codebase), once we manage to get BIOs directly
    to the users, from the OpenSSL implementation.
7.  A number of mbedTLS functionality, most notably in `context.h`,
    has been adapted to allow a common implementation between the
    two libraries, for example `peer_cert()` and `get_verify_error`.
8.  A copy of `crypto::error_string()` is present in the TLS side
    so that we can more easily control each (crypto/tls) with the
    CMake flags.
9.  A number of log messages were added or changed to convey more
    information to help diagnose TLS issues. Not all development
    log messages survived into the production patch, but those that
    did can still convey most of the information and help at least
    zero in on where you need to add more logs later.
10. Removed two unused methods in `Context`: `available_bytes` and
    `set_require_auth`. Those were never called and had no easy
    equivalent in OpenSSL. Added exceptions for some unused parameters
    in OpenSSL's `CA` and `Cert` to make sure we never use them.
    If those never hit on any further testing or benchmarking, then
    we're safe to remove them when we clean up mbedTLS.
11. Added a number of `FIXME` comments, highlighting the assumptions
    from reading the mbedTLS code and what the tests have shown it
    does/needs. Some of them may be wrong, and if so, we need to
    fix them before we start with the mbedTLS cleanup.
12. Added a very large `get_verify_error` in `OpenSSL::Context`
    with all errors the `verify_result` can throw. This wasn't
    really necessary but was added as a debugging tool. Once we're
    happy none of those weird corner cases happen on our code, we
    should really remove all unused ones and common up in a
    `case default:`, where developers can add specific ones later
    for debugging purposes again.
13. Updated the `tls_test` to handle multi-part messages (past 16K),
    supporting large messages, like `tls_endpoint`. Also truncated
    the large messages to make it easier to read the test logs.
14. Changed the e2e_logging.py large message range from 2^10
    (instead of 2^14), to help developers see some messages pass
    before the 16K threshold, which helped me realise what the
    problem was.
15. Added a long README document with all core issues with the port,
    and discussions on how to clean up in the future.

* Trying to fix the ubsan error

* Remove unnecessary FIXMEs

* Add FIXME to check-todo.sh

* We don't need MbedTLS entropy for OpenSSL

The entropy source isn't a generic implementation, but one based on
mbedTLS, which we don't need for OpenSSL. This removes the last
FIXME.

* Restrict SSL cipher to TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

To improve security and keep the same behaviour, this commit forces
specific TLS1.2 and TLS1.3 ciphers that were used in the mbedTLS
implementation.

This fixes all problems in the tls_report but one:
Secure Client-Initiated Renegotiation
 -> VULNERABLE (NOT ok), DoS threat (6 attempts)

This will be looked at on the next patch.

* Disable renegotiation to avoid DoS attacks

This makes the tls_report identical to previous mbedTLS.

* Free temporary BIOs in CA/Cert c-tors

Detected by leak sanitizers, but I should have known better...

* Use Unique_BIO|X509 in peer_cert to avoid leaks

Following the C-style code in OpenSSL's documentation was a bad
idea. Using unique_ptr wrappers to guarantee nothing leaks.

* Simplify get_verify_error to avoid UB on memcpy

Same as previous UB, writing at the end of a string. Using std::string
to avoid any memory manipulation by hand.

* Fix typos
2022-01-09 15:16:46 +00:00
Amaury Chamayou a5476ef277
Application claims digest in ledger and receipts (#3292) 2022-01-09 12:33:35 +00:00
Julien Maffre eddf7bdb1b
Multiple RPC interfaces redirection (#3300) 2021-12-15 10:40:13 +00:00
Julien Maffre dff1187450
JSON configuration misc renames (#3290) 2021-12-09 15:38:36 +00:00
Julien Maffre e2017b80a3
JSON configuration: time strings (#3282) 2021-12-09 10:00:00 +00:00
Julien Maffre c63e7d6967
JSON configuration: size strings (#3272) 2021-12-06 16:56:05 +00:00
Eddy Ashton f0a7d405ec
Historical queries: Add support for fetching sets of seqnos (#3221) 2021-12-01 09:25:42 +00:00
Julien Maffre 40275162ab
Include start type in JSON configuration file and remove `cchost` subcommand (#3268) 2021-12-01 08:37:28 +00:00
Julien Maffre 4869eafcc7
Simplify representation of addresses (#3261) 2021-11-29 13:08:01 +00:00
Julien Maffre bb946237a6
JSON configuration for `cchost` (#3209) 2021-11-23 17:35:01 +00:00
Amaury Chamayou 83457ef588
Rename drop_requests to address #3105 (#3187) 2021-11-09 06:41:13 +00:00
Amaury Chamayou 61dabee469
Remove smallbank (#3135) 2021-10-27 08:26:56 +00:00
Maik Riechert 7725a0f6d4
js: fix historical query handle for nextLink (#3118) 2021-10-23 07:28:31 +00:00
Maik Riechert cb38ac3ca2
JS: historical range queries (#3044) 2021-10-20 13:33:58 +01:00
Eddy Ashton 74970ad420
Add perf test of historical query fetching (#3032) 2021-09-30 13:30:26 +01:00
Amaury Chamayou 41cadaf415
Get metrics v1 (#3025) 2021-09-27 13:20:32 +01:00
Amaury Chamayou 81d7ac077e
Node certs in receipts (#2991) 2021-09-21 15:42:05 +01:00
Maik Riechert 8de9f6dbf2
cmake: standalone samples (#2990) 2021-09-17 09:51:25 +01:00
Maik Riechert e93d2f0beb
JS FFI plugin building (#2978) 2021-09-15 11:25:16 +00:00
Amaury Chamayou c1f120aaad
Historical adapter v2 (#2977) 2021-09-14 19:18:53 +01:00
Amaury Chamayou 47edd48490
Remove root from receipts (#2975) 2021-09-10 19:55:41 +00:00
Maik Riechert 0d8aa4b834
remove forum sample app (#2860) 2021-08-03 13:04:32 +01:00
Amaury Chamayou a43fd55f38
Clang 10 toolchain & default compiler updates (#2739) 2021-08-02 20:09:32 +01:00
Amaury Chamayou ad8d65091e
Return receipts for signature transactions (#2785) 2021-07-14 19:22:47 +01:00
Amaury Chamayou 4a5894b028
Fix endpoint prefix inconsistency (#2778) 2021-07-09 22:40:31 +01:00
Amaury Chamayou 2eb5798847
Remove websockets support (#2746) 2021-06-29 19:30:15 +01:00
Maik Riechert b7bd7ed55c
JS module bytecode caching (#2643) 2021-06-18 18:09:55 +01:00
Alex 11ddc7919b
BFT recovery tests (#2663) 2021-06-18 10:24:44 +01:00
Amaury Chamayou bcd4797a26
Fix forwarding escaped urls (#2591) 2021-05-14 13:06:30 +01:00
Eddy Ashton 68a483e81c
Update doc versions of `/gov` and `/node` OpenAPI (#2589) 2021-05-13 20:04:24 +01:00
Eddy Ashton ce80a0c1ff
Add a minimal JS logging app for perf testing (#2585) 2021-05-12 13:47:32 +01:00
Eddy Ashton 0184c1fb92
Add `.size` and `.clear()` to JS maps (#2569) 2021-05-10 13:08:00 +01:00
Amaury Chamayou 494b294141
Appease this week's prettier (#2573) 2021-05-10 11:34:18 +01:00
Eddy Ashton b2d73d9112
Sample consistency pass (#2566) 2021-05-07 15:58:07 +01:00
Eddy Ashton 90648533ea
Modify sample historical range query endpoint to better handle subranges (#2556) 2021-05-07 11:20:23 +01:00
Amaury Chamayou 45db0a3b27
Do not lock packages in tests (#2564) 2021-05-07 09:07:24 +01:00
Julien Maffre df8d6928ea
Install `version.h` under `include/ccf` (#2562) 2021-05-06 19:47:00 +01:00
Amaury Chamayou 5d4da8e8c6
Mitigate tsoa directory creation race (#2558) 2021-05-06 16:43:34 +01:00
Eddy Ashton 8215d9f851
Add `get_quotes_for_all_trusted_nodes_v1` API (#2511) 2021-05-04 14:02:14 +01:00
Eddy Ashton 5aa666f7a1
Add C++ API to get untrusted host time (#2550) 2021-05-04 10:38:59 +01:00
Amaury Chamayou 55d4495c71
Rename debian packages containing tildes to underscores to avoid GitHub's auto-replace (#2539) 2021-04-29 15:03:27 +01:00