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

transports/tls: Add libp2p-tls as per spec #2945

Merged
merged 57 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
06a77c2
Add skeleton for libp2p-tls
thomaseizinger Sep 26, 2022
5364b43
Minor reformatting
thomaseizinger Sep 26, 2022
71b2fe8
Fix compile errors and remove `Error` type
thomaseizinger Sep 26, 2022
80c0d1c
Remove unnecessary `pub(crate)`
thomaseizinger Sep 26, 2022
03a2aed
Implement `Upgrade` traits to allow use of TLS as authentication
thomaseizinger Sep 26, 2022
c5b1558
Add changelog files
thomaseizinger Sep 26, 2022
2316505
Fix docs
thomaseizinger Sep 26, 2022
334544d
Minor doc and name adjustments
thomaseizinger Sep 26, 2022
4d6db82
Verify p2p extension as part of parsing certificate
thomaseizinger Sep 26, 2022
e4547a5
Fix compile error
thomaseizinger Sep 26, 2022
3267ccd
Extract private fn that allows to control the cert keypair
thomaseizinger Sep 26, 2022
9a9ac2b
fixup! Verify p2p extension as part of parsing certificate
thomaseizinger Sep 26, 2022
b810bcc
Add static test vectors
thomaseizinger Sep 26, 2022
7c6e6cf
Re-order items by importance
thomaseizinger Sep 26, 2022
a8d965f
Re-order functions in impl block and make private where possible
thomaseizinger Sep 26, 2022
6d68ffa
Tidy up manifest
thomaseizinger Sep 26, 2022
21b4319
Sort hex dependencies
thomaseizinger Sep 26, 2022
f0cac36
Fix clippy
thomaseizinger Sep 26, 2022
39fdf41
Remove `Stream` type
thomaseizinger Sep 26, 2022
3b76e39
Fmt
thomaseizinger Sep 26, 2022
3ddf442
Exclude `libp2p-tls` from wasm build
thomaseizinger Sep 26, 2022
d0bb3fa
Add license to libp2p-tls
thomaseizinger Sep 26, 2022
01ecdbc
Don't leak `rcgen` dependency in public API
thomaseizinger Sep 26, 2022
67eda94
Don't leak `webpki` dependency
thomaseizinger Sep 26, 2022
eedbefc
Add note about exposed dependency to manifest
thomaseizinger Sep 26, 2022
d9f1036
Upgraxe x509-parser to 0.14
thomaseizinger Sep 26, 2022
d74fe57
Remove comment
thomaseizinger Sep 26, 2022
eaa27f4
Exclude test assets from publishing
thomaseizinger Sep 27, 2022
f95e9d9
Move errors further down
thomaseizinger Sep 27, 2022
7acf98b
Inline `_generate` function
thomaseizinger Sep 27, 2022
4f15b3b
Extract `make_libp2p_extension` function
thomaseizinger Sep 27, 2022
e1f34ae
Use `rustls` types in signatures
thomaseizinger Sep 27, 2022
79a464a
libp2p-tls: Allow to specify remote peer ID we intend to connect to (…
kpp Sep 28, 2022
59ebdb2
Merge branch 'master' into libp2p-tls
thomaseizinger Sep 30, 2022
a1546be
Point to correct version of `libp2p-tls`
thomaseizinger Sep 30, 2022
f6ba989
Polish public API and expose via root crate
thomaseizinger Sep 30, 2022
4a5c4da
Add license headers
thomaseizinger Sep 30, 2022
d078a5e
Fix compile error in test
thomaseizinger Sep 30, 2022
d9c999a
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 4, 2022
d362aef
Make it more explicit which protocol versions we support
thomaseizinger Oct 5, 2022
10b4c82
Move config of supported cipher suits into `verifier` module
thomaseizinger Oct 5, 2022
e4e7bfd
Fix clippy lints
thomaseizinger Oct 5, 2022
6bb6ce7
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 5, 2022
2ac833e
Remove unnecessary `pub`
thomaseizinger Oct 5, 2022
6e03126
Clarify why we need `dangerous_configuration`
thomaseizinger Oct 5, 2022
1edc6f3
Fix link to signature scheme
thomaseizinger Oct 5, 2022
fbb0d3a
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 5, 2022
a3af017
Adapt to new `swarm` interface
thomaseizinger Oct 5, 2022
f11c54e
Restore original copy-right
thomaseizinger Oct 7, 2022
bf1b30a
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 11, 2022
59c43ce
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 18, 2022
3fe6386
Set `libp2p-tls` to `0.1.0-alpha`
thomaseizinger Oct 18, 2022
ed98810
Fix clippy error in latest rustls release
thomaseizinger Oct 18, 2022
f5bf544
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 20, 2022
eae9b5f
Merge branch 'master' into libp2p-tls
thomaseizinger Oct 23, 2022
27b58f7
Use `doc_auto_cfg` for libp2p-tls
thomaseizinger Oct 23, 2022
b01bff4
Merge branch 'libp2p-tls' of github.com:libp2p/rust-libp2p into libp2…
thomaseizinger Oct 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [`libp2p-uds` CHANGELOG](transports/uds/CHANGELOG.md)
- [`libp2p-wasm-ext` CHANGELOG](transports/wasm-ext/CHANGELOG.md)
- [`libp2p-websocket` CHANGELOG](transports/websocket/CHANGELOG.md)
- [`libp2p-tls` CHANGELOG](transports/tls/CHANGELOG.md)

## Multiplexers

Expand Down Expand Up @@ -77,6 +78,8 @@

- [PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918

- Introduce [`libp2p-tls` `v0.1.0`](transports/tls/CHANGELOG.md#010).

# 0.48.0

- Update to [`libp2p-core` `v0.36.0`](core/CHANGELOG.md#0360).
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ full = [
"serde",
"tcp-async-io",
"tcp-tokio",
"tls",
"uds",
"wasm-bindgen",
"wasm-ext",
Expand All @@ -54,6 +55,7 @@ floodsub = ["dep:libp2p-floodsub"]
identify = ["dep:libp2p-identify", "libp2p-metrics?/identify"]
kad = ["dep:libp2p-kad", "libp2p-metrics?/kad"]
gossipsub = ["dep:libp2p-gossipsub", "libp2p-metrics?/gossipsub"]
tls = ["dep:libp2p-tls"]
metrics = ["dep:libp2p-metrics"]
mdns-async-io = ["dep:libp2p-mdns", "libp2p-mdns?/async-io"]
mdns-tokio = ["dep:libp2p-mdns", "libp2p-mdns?/tokio"]
Expand Down Expand Up @@ -120,6 +122,7 @@ libp2p-dns = { version = "0.37.0", path = "transports/dns", optional = true }
libp2p-mdns = { version = "0.41.0", path = "protocols/mdns", optional = true }
libp2p-tcp = { version = "0.37.0", path = "transports/tcp", optional = true }
libp2p-websocket = { version = "0.39.0", path = "transports/websocket", optional = true }
libp2p-tls = { version = "0.1.0", path = "transports/tls", optional = true }

[target.'cfg(not(target_os = "unknown"))'.dependencies]
libp2p-gossipsub = { version = "0.42.1", path = "protocols/gossipsub", optional = true }
Expand Down Expand Up @@ -158,6 +161,7 @@ members = [
"transports/deflate",
"transports/dns",
"transports/noise",
"transports/tls",
"transports/plaintext",
"transports/pnet",
"transports/tcp",
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ pub use libp2p_swarm as swarm;
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)]
pub use libp2p_tcp as tcp;
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
#[doc(inline)]
pub use libp2p_tls as tls;
#[cfg(feature = "uds")]
#[cfg_attr(docsrs, doc(cfg(feature = "uds")))]
#[doc(inline)]
Expand Down
3 changes: 3 additions & 0 deletions transports/tls/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0 [unreleased]

Initial release.
24 changes: 24 additions & 0 deletions transports/tls/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
name = "libp2p-tls"
version = "0.1.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.1.0"
version = "0.1.0-alpha"

To the best of my knowledge, the code below has not run in any production systems.

To communicate expectations, I suggest releasing this as an alpha first.

See also same suggestion on QUIC pull request #2289 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On it!

Most users depend on libp2p though so they are not going to see this version. IMO we are effectively removing that "alpha" label again through the re-export.

Do you think we should perhaps not re-export the TLS implementation yet so users have to depend on it manually?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most users depend on libp2p though so they are not going to see this version. IMO we are effectively removing that "alpha" label again through the re-export.

That is true. Though I would explicitly call it out in the changelog.

Do you think we should perhaps not re-export the TLS implementation yet so users have to depend on it manually?

I don't have an opinion here. I think we should be consistent with libp2p-quic. Chatted with @elenaf9 quickly. She prefers not removing libp2p-quic from libp2p.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about annotating the re-export with the unstable attribute macro @thomaseizinger ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about annotating the re-export with the unstable attribute macro @thomaseizinger ?

That is specific to the Rust compiler from what I know, I don't think you can use that actually?

Copy link
Contributor

@elenaf9 elenaf9 Oct 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes you are right! Don't have a strong on opinion on whether to re-export tls and quic or not. I did not consider that when re-exporting we "hide" the alpha-flag, so maybe not re-exporting is the best solution after all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think not exporting it would be the better solution but I don't want to block this PR on it. We can always change that until the next release.

edition = "2021"
license = "MIT"
exclude = ["src/test_assets"]

[dependencies]
futures = { version = "0.3.24", default-features = false }
futures-rustls = "0.22.2"
libp2p-core = { version = "0.37.0", path = "../../core" }
rcgen = "0.9.2"
ring = "0.16.20"
rustls = { version = "0.20.2", default-features = false, features = ["dangerous_configuration"] } # Exposed dependency! Bump major version on any change.
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
thiserror = "1.0.36"
webpki = "0.22.0"
x509-parser = "0.14.0"
yasna = "0.5.0"

[dev-dependencies]
hex = "0.4.3"
hex-literal = "0.3.4"
libp2p = { path = "../..", features = ["yamux"], default-features = false }
tokio = { version = "1.21.1", features = ["full"] }
Loading