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

[cluster] Support encrypted connections #55

Merged
merged 1 commit into from
Feb 24, 2023
Merged

[cluster] Support encrypted connections #55

merged 1 commit into from
Feb 24, 2023

Conversation

slawlor
Copy link
Owner

@slawlor slawlor commented Feb 21, 2023

Encryption support is provided by

  1. tokio_rustls
  2. rustls

which allow for both the NodeServer received connections and outgoing client cluster connections to utilize TLS configuration.

Integration tests added, but code-coverage will likely be low as integration tests don't count in codecov

$ docker compose --env-file ./ractor_cluster_integration_tests/envs/encryption.env up --build --exit-code-from node-b
...
node-a  | [2023-02-21T16:58:39.401Z WARN  ractor_cluster_integration_tests::tests::encryption] CA Cert SUB=10U
                                                                                                              ponytown RSA CA
node-a  | [2023-02-21T16:58:39.402Z INFO  ractor_cluster_integration_tests::tests::encryption] Starting NodeServer on port 8199
node-a  | [2023-02-21T16:58:39.402Z INFO  ractor_cluster_integration_tests::tests::encryption] Waiting for NodeSession status updates
node-b  | [2023-02-21T16:58:39.621Z WARN  ractor_cluster_integration_tests::tests::encryption] CA Cert SUB=10U
                                                                                                              ponytown RSA CA
node-b  | [2023-02-21T16:58:39.621Z INFO  ractor_cluster_integration_tests::tests::encryption] Starting NodeServer on port 8198
node-b  | [2023-02-21T16:58:39.621Z INFO  ractor_cluster_integration_tests::tests::encryption] Connecting to remote NodeServer at node-a:8199
node-b  | [2023-02-21T16:58:39.623Z DEBUG rustls::client::hs] No cached session for DnsName(DnsName(DnsName("testserver.com")))
node-a  | [2023-02-21T16:58:39.623Z DEBUG rustls::server::hs] decided upon suite TLS13_AES_256_GCM_SHA384
node-b  | [2023-02-21T16:58:39.623Z DEBUG rustls::client::hs] Not resuming any session
[cluster] Support encrypted connections
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::hs] Using ciphersuite TLS13_AES_256_GCM_SHA384
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::tls13] Not resuming
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::tls13] TLS1.3 encrypted extensions: [ServerNameAck]
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::hs] ALPN protocol is None
node-b  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster::node::client] TCP Session opened for 172.18.0.2:8199
node-b  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster_integration_tests::tests::encryption] Client connected NodeServer b to NodeServer a
node-b  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster_integration_tests::tests::encryption] Waiting for NodeSession status updates
node-a  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster::net::listener] TCP Session opened for 172.18.0.3:34662
...
node-a exited with code 0

NOTE: This change includes importing rustls's test certificates so most of this PR can be ignored as it's just a copy from their repo. Anything under ractor_cluster_integration_tests/test-ca/... is imported from rustls (except for the README giving attribution).

@codecov
Copy link

codecov bot commented Feb 21, 2023

Codecov Report

Base: 77.50% // Head: 76.25% // Decreases project coverage by -1.26% ⚠️

Coverage data is based on head (428b789) compared to base (bcbda19).
Patch coverage: 1.23% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
- Coverage   77.50%   76.25%   -1.26%     
==========================================
  Files          46       47       +1     
  Lines        7799     7930     +131     
==========================================
+ Hits         6045     6047       +2     
- Misses       1754     1883     +129     
Impacted Files Coverage Δ
ractor_cluster/src/lib.rs 100.00% <ø> (ø)
ractor_cluster/src/net/listener.rs 0.00% <0.00%> (ø)
ractor_cluster/src/net/mod.rs 0.00% <0.00%> (ø)
ractor_cluster/src/net/session.rs 0.00% <0.00%> (ø)
ractor_cluster/src/node/client.rs 0.00% <0.00%> (ø)
ractor_cluster/src/node/mod.rs 3.50% <0.00%> (-0.32%) ⬇️
ractor_cluster/src/node/node_session/mod.rs 34.74% <0.00%> (ø)
ractor/src/actor/mod.rs 89.59% <33.33%> (-1.00%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@slawlor slawlor mentioned this pull request Feb 21, 2023
13 tasks
@slawlor slawlor marked this pull request as ready for review February 21, 2023 20:48
Encryption support is provided by

1. `tokio_rustls`
2. `rustls`

which allow for both the NodeServer received connections and outgoing client cluster connections to utilize TLS configuration.

Integration tests added, but code-coverage will likely be low as integration tests don't count in `codecov`

```bash
$ docker compose --env-file ./ractor_cluster_integration_tests/envs/encryption.env up --build --exit-code-from node-b
...
node-a  | [2023-02-21T16:58:39.401Z WARN  ractor_cluster_integration_tests::tests::encryption] CA Cert SUB=10U
                                                                                                              ponytown RSA CA
node-a  | [2023-02-21T16:58:39.402Z INFO  ractor_cluster_integration_tests::tests::encryption] Starting NodeServer on port 8199
node-a  | [2023-02-21T16:58:39.402Z INFO  ractor_cluster_integration_tests::tests::encryption] Waiting for NodeSession status updates
node-b  | [2023-02-21T16:58:39.621Z WARN  ractor_cluster_integration_tests::tests::encryption] CA Cert SUB=10U
                                                                                                              ponytown RSA CA
node-b  | [2023-02-21T16:58:39.621Z INFO  ractor_cluster_integration_tests::tests::encryption] Starting NodeServer on port 8198
node-b  | [2023-02-21T16:58:39.621Z INFO  ractor_cluster_integration_tests::tests::encryption] Connecting to remote NodeServer at node-a:8199
node-b  | [2023-02-21T16:58:39.623Z DEBUG rustls::client::hs] No cached session for DnsName(DnsName(DnsName("testserver.com")))
node-a  | [2023-02-21T16:58:39.623Z DEBUG rustls::server::hs] decided upon suite TLS13_AES_256_GCM_SHA384
node-b  | [2023-02-21T16:58:39.623Z DEBUG rustls::client::hs] Not resuming any session
[cluster] Support encrypted connections
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::hs] Using ciphersuite TLS13_AES_256_GCM_SHA384
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::tls13] Not resuming
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::tls13] TLS1.3 encrypted extensions: [ServerNameAck]
node-b  | [2023-02-21T16:58:39.624Z DEBUG rustls::client::hs] ALPN protocol is None
node-b  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster::node::client] TCP Session opened for 172.18.0.2:8199
node-b  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster_integration_tests::tests::encryption] Client connected NodeServer b to NodeServer a
node-b  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster_integration_tests::tests::encryption] Waiting for NodeSession status updates
node-a  | [2023-02-21T16:58:39.624Z INFO  ractor_cluster::net::listener] TCP Session opened for 172.18.0.3:34662
...
node-a exited with code 0
```
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.

1 participant