Skip to content

Commit 0bc310a

Browse files
authored
Rustls v0.21 support (#480)
1 parent 6ce8307 commit 0bc310a

File tree

19 files changed

+504
-75
lines changed

19 files changed

+504
-75
lines changed

.cargo/config.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ ci-check-linux = "hack --workspace --feature-powerset check --tests --examples"
1515

1616
# tests avoiding io-uring feature
1717
ci-test = "hack --feature-powerset --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
18+
ci-test-rustls-020 = "hack --feature-powerset --exclude-features=io-uring,rustls-0_21 test --lib --tests --no-fail-fast -- --nocapture"
19+
ci-test-rustls-021 = "hack --feature-powerset --exclude-features=io-uring,rustls-0_20 test --lib --tests --no-fail-fast -- --nocapture"
1820

1921
# tests avoiding io-uring feature on Windows
20-
ci-test-win = "hack --feature-powerset --depth 2 --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
22+
ci-test-win = "hack --feature-powerset --depth=2 --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
2123

2224
# test with io-uring feature
23-
ci-test-linux = "hack --feature-powerset test --lib --tests --no-fail-fast -- --nocapture"
25+
ci-test-linux = "hack --feature-powerset --exclude-features=rustls-0_20 test --lib --tests --no-fail-fast -- --nocapture"

.github/workflows/ci-post-merge.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19+
# prettier-ignore
1920
target:
2021
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
2122
- { name: macOS, os: macos-latest, triple: x86_64-apple-darwin }
@@ -37,6 +38,10 @@ jobs:
3738

3839
- uses: actions/checkout@v3
3940

41+
- name: Free Disk Space
42+
if: matrix.target.os == 'ubuntu-latest'
43+
run: ./scripts/free-disk-space.sh
44+
4045
- name: Install OpenSSL
4146
if: matrix.target.os == 'windows-latest'
4247
run: choco install openssl -y --forcex64 --no-progress
@@ -83,8 +88,15 @@ jobs:
8388
run: cargo ci-test
8489
- name: tests
8590
if: matrix.target.os == 'ubuntu-latest'
86-
run: |
87-
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-linux"
91+
run: >-
92+
sudo bash -c "
93+
ulimit -Sl 512
94+
&& ulimit -Hl 512
95+
&& PATH=$PATH:/usr/share/rust/.cargo/bin
96+
&& RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rustls-020
97+
&& RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rustls-021
98+
&& RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-linux
99+
"
88100
89101
- name: Clear the cargo caches
90102
run: |

.github/workflows/ci.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on:
3+
on:
44
pull_request: {}
55
push: { branches: [master] }
66

@@ -16,6 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19+
# prettier-ignore
1920
target:
2021
- { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
2122
- { name: macOS, os: macos-latest, triple: x86_64-apple-darwin }
@@ -37,7 +38,7 @@ jobs:
3738
run: sudo ifconfig lo0 alias 127.0.0.3
3839

3940
- uses: actions/checkout@v3
40-
41+
4142
- name: Free Disk Space
4243
if: matrix.target.os == 'ubuntu-latest'
4344
run: ./scripts/free-disk-space.sh
@@ -99,8 +100,15 @@ jobs:
99100
run: cargo ci-test-win
100101
- name: tests
101102
if: matrix.target.os == 'ubuntu-latest'
102-
run: |
103-
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-linux"
103+
run: >-
104+
sudo bash -c "
105+
ulimit -Sl 512
106+
&& ulimit -Hl 512
107+
&& PATH=$PATH:/usr/share/rust/.cargo/bin
108+
&& RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rustls-020
109+
&& RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rustls-021
110+
&& RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-linux
111+
"
104112
105113
- name: Clear the cargo caches
106114
run: |

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ members = [
1515
resolver = "2"
1616

1717
[workspace.package]
18+
license = "MIT OR Apache-2.0"
1819
edition = "2021"
1920
rust-version = "1.65"
2021

actix-server/src/worker.rs

+3
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ impl Future for ServerWorker {
625625
self.poll(cx)
626626
}
627627
},
628+
628629
WorkerState::Restarting(ref mut restart) => {
629630
let factory_id = restart.factory_id;
630631
let token = restart.token;
@@ -649,6 +650,7 @@ impl Future for ServerWorker {
649650

650651
self.poll(cx)
651652
}
653+
652654
WorkerState::Shutdown(ref mut shutdown) => {
653655
// drop all pending connections in rx channel.
654656
while let Poll::Ready(Some(conn)) = this.conn_rx.poll_recv(cx) {
@@ -682,6 +684,7 @@ impl Future for ServerWorker {
682684
shutdown.timer.as_mut().poll(cx)
683685
}
684686
}
687+
685688
// actively poll stream and handle worker command
686689
WorkerState::Available => loop {
687690
match this.check_readiness(cx) {

actix-tls/CHANGES.md

+26-23
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
# Changes
22

3-
## Unreleased - 2023-xx-xx
3+
## Unreleased
44

5+
- Support Rustls v0.21.
6+
- Added `{accept, connect}::rustls_0_21` modules.
7+
- Added `{accept, connect}::rustls_0_20` alias for `{accept, connect}::rustls` modules.
58
- Minimum supported Rust version (MSRV) is now 1.65.
69

7-
## 3.0.4 - 2022-03-15
10+
## 3.0.4
811

912
- Logs emitted now use the `tracing` crate with `log` compatibility. [#451]
1013

1114
[#451]: https://github.com/actix/actix-net/pull/451
1215

13-
## 3.0.3 - 2022-02-15
16+
## 3.0.3
1417

1518
- No significant changes since `3.0.2`.
1619

17-
## 3.0.2 - 2022-01-28
20+
## 3.0.2
1821

1922
- Expose `connect::Connection::new`. [#439]
2023

2124
[#439]: https://github.com/actix/actix-net/pull/439
2225

23-
## 3.0.1 - 2022-01-11
26+
## 3.0.1
2427

2528
- No significant changes since `3.0.0`.
2629

27-
## 3.0.0 - 2021-12-26
30+
## 3.0.0
2831

2932
- No significant changes since `3.0.0-rc.2`.
3033

31-
## 3.0.0-rc.2 - 2021-12-10
34+
## 3.0.0-rc.2
3235

3336
- Re-export `openssl::SslConnectorBuilder` in `connect::openssl::reexports`. [#429]
3437

3538
[#429]: https://github.com/actix/actix-net/pull/429
3639

37-
## 3.0.0-rc.1 - 2021-11-29
40+
## 3.0.0-rc.1
3841

3942
### Added
4043

@@ -72,7 +75,7 @@
7275
[#422]: https://github.com/actix/actix-net/pull/422
7376
[#423]: https://github.com/actix/actix-net/pull/423
7477

75-
## 3.0.0-beta.9 - 2021-11-22
78+
## 3.0.0-beta.9
7679

7780
- Add configurable timeout for accepting TLS connection. [#393]
7881
- Added `TlsError::Timeout` variant. [#393]
@@ -82,28 +85,28 @@
8285
[#393]: https://github.com/actix/actix-net/pull/393
8386
[#420]: https://github.com/actix/actix-net/pull/420
8487

85-
## 3.0.0-beta.8 - 2021-11-15
88+
## 3.0.0-beta.8
8689

8790
- Add `Connect::request` for getting a reference to the connection request. [#415]
8891

8992
[#415]: https://github.com/actix/actix-net/pull/415
9093

91-
## 3.0.0-beta.7 - 2021-10-20
94+
## 3.0.0-beta.7
9295

9396
- Add `webpki_roots_cert_store()` to get rustls compatible webpki roots cert store. [#401]
9497
- Alias `connect::ssl` to `connect::tls`. [#401]
9598

9699
[#401]: https://github.com/actix/actix-net/pull/401
97100

98-
## 3.0.0-beta.6 - 2021-10-19
101+
## 3.0.0-beta.6
99102

100103
- Update `tokio-rustls` to `0.23` which uses `rustls` `0.20`. [#396]
101104
- Removed a re-export of `Session` from `rustls` as it no longer exist. [#396]
102105
- Minimum supported Rust version (MSRV) is now 1.52.
103106

104107
[#396]: https://github.com/actix/actix-net/pull/396
105108

106-
## 3.0.0-beta.5 - 2021-03-29
109+
## 3.0.0-beta.5
107110

108111
- Changed `connect::ssl::rustls::RustlsConnectorService` to return error when `DNSNameRef` generation failed instead of panic. [#296]
109112
- Remove `connect::ssl::openssl::OpensslConnectServiceFactory`. [#297]
@@ -117,15 +120,15 @@
117120
[#297]: https://github.com/actix/actix-net/pull/297
118121
[#299]: https://github.com/actix/actix-net/pull/299
119122

120-
## 3.0.0-beta.4 - 2021-02-24
123+
## 3.0.0-beta.4
121124

122125
- Rename `accept::openssl::{SslStream => TlsStream}`.
123126
- Add `connect::Connect::set_local_addr` to attach local `IpAddr`. [#282]
124127
- `connector::TcpConnector` service will try to bind to local_addr of `IpAddr` when given. [#282]
125128

126129
[#282]: https://github.com/actix/actix-net/pull/282
127130

128-
## 3.0.0-beta.3 - 2021-02-06
131+
## 3.0.0-beta.3
129132

130133
- Remove `trust-dns-proto` and `trust-dns-resolver`. [#248]
131134
- Use `std::net::ToSocketAddrs` as simple and basic default resolver. [#248]
@@ -139,50 +142,50 @@
139142
[#248]: https://github.com/actix/actix-net/pull/248
140143
[#273]: https://github.com/actix/actix-net/pull/273
141144

142-
## 3.0.0-beta.2 - 2022-xx-xx
145+
## 3.0.0-beta.2
143146

144147
- Depend on stable trust-dns packages. [#204]
145148

146149
[#204]: https://github.com/actix/actix-net/pull/204
147150

148-
## 3.0.0-beta.1 - 2020-12-29
151+
## 3.0.0-beta.1
149152

150153
- Move acceptors under `accept` module. [#238]
151154
- Merge `actix-connect` crate under `connect` module. [#238]
152155
- Add feature flags to enable acceptors and/or connectors individually. [#238]
153156

154157
[#238]: https://github.com/actix/actix-net/pull/238
155158

156-
## 2.0.0 - 2020-09-03
159+
## 2.0.0
157160

158161
- `nativetls::NativeTlsAcceptor` is renamed to `nativetls::Acceptor`.
159162
- Where possible, "SSL" terminology is replaced with "TLS".
160163
- `SslError` is renamed to `TlsError`.
161164
- `TlsError::Ssl` enum variant is renamed to `TlsError::Tls`.
162165
- `max_concurrent_ssl_connect` is renamed to `max_concurrent_tls_connect`.
163166

164-
## 2.0.0-alpha.2 - 2020-08-17
167+
## 2.0.0-alpha.2
165168

166169
- Update `rustls` dependency to 0.18
167170
- Update `tokio-rustls` dependency to 0.14
168171
- Update `webpki-roots` dependency to 0.20
169172

170-
## [2.0.0-alpha.1] - 2020-03-03
173+
## [2.0.0-alpha.1]
171174

172175
- Update `rustls` dependency to 0.17
173176
- Update `tokio-rustls` dependency to 0.13
174177
- Update `webpki-roots` dependency to 0.19
175178

176-
## [1.0.0] - 2019-12-11
179+
## [1.0.0]
177180

178181
- 1.0.0 release
179182

180-
## [1.0.0-alpha.3] - 2019-12-07
183+
## [1.0.0-alpha.3]
181184

182185
- Migrate to tokio 0.2
183186
- Enable rustls acceptor service
184187
- Enable native-tls acceptor service
185188

186-
## [1.0.0-alpha.1] - 2019-12-02
189+
## [1.0.0-alpha.1]
187190

188191
- Split openssl acceptor from actix-server package

actix-tls/Cargo.toml

+20-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "TLS acceptor and connector services for Actix ecosystem"
99
keywords = ["network", "tls", "ssl", "async", "transport"]
1010
repository = "https://github.com/actix/actix-net.git"
1111
categories = ["network-programming", "asynchronous", "cryptography"]
12-
license = "MIT OR Apache-2.0"
12+
license.workspace = true
1313
edition.workspace = true
1414
rust-version.workspace = true
1515

@@ -29,8 +29,14 @@ connect = []
2929
# use openssl impls
3030
openssl = ["tls-openssl", "tokio-openssl"]
3131

32-
# use rustls impls
33-
rustls = ["tokio-rustls", "webpki-roots"]
32+
# alias for backwards compat
33+
rustls = ["rustls-0_20"]
34+
35+
# use rustls v0.20 impls
36+
rustls-0_20 = ["tokio-rustls-023", "webpki-roots-022"]
37+
38+
# use rustls v0.21 impls
39+
rustls-0_21 = ["tokio-rustls-024", "webpki-roots-025"]
3440

3541
# use native-tls impls
3642
native-tls = ["tokio-native-tls"]
@@ -57,9 +63,13 @@ http = { version = "0.2.3", optional = true }
5763
tls-openssl = { package = "openssl", version = "0.10.48", optional = true }
5864
tokio-openssl = { version = "0.6", optional = true }
5965

60-
# rustls
61-
tokio-rustls = { version = "0.23", optional = true }
62-
webpki-roots = { version = "0.22", optional = true }
66+
# rustls v0.20
67+
tokio-rustls-023 = { package = "tokio-rustls", version = "0.23", optional = true }
68+
webpki-roots-022 = { package = "webpki-roots", version = "0.22", optional = true }
69+
70+
# rustls v0.21
71+
tokio-rustls-024 = { package = "tokio-rustls", version = "0.24", optional = true }
72+
webpki-roots-025 = { package = "webpki-roots", version = "0.25", optional = true }
6373

6474
# native-tls
6575
tokio-native-tls = { version = "0.3", optional = true }
@@ -72,11 +82,11 @@ bytes = "1"
7282
env_logger = "0.10"
7383
futures-util = { version = "0.3.17", default-features = false, features = ["sink"] }
7484
log = "0.4"
75-
rcgen = "0.10"
85+
rcgen = "0.11"
7686
rustls-pemfile = "1"
77-
tokio-rustls = { version = "0.23", features = ["dangerous_configuration"] }
78-
trust-dns-resolver = "0.22"
87+
tokio-rustls-024 = { package = "tokio-rustls", version = "0.24", features = ["dangerous_configuration"] }
88+
trust-dns-resolver = "0.23"
7989

8090
[[example]]
8191
name = "accept-rustls"
82-
required-features = ["accept", "rustls"]
92+
required-features = ["accept", "rustls-0_21"]

0 commit comments

Comments
 (0)