Skip to content

Commit

Permalink
cert-manager (#132)
Browse files Browse the repository at this point in the history
* Make cert-manager a sub-crate

* Update rcgen
  • Loading branch information
richardpringle authored Feb 8, 2024
1 parent f6192ba commit b900f5c
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"avalanchego-conformance-sdk",
"core/cert-manager",
"core/network",
"core/server",
"crates/avalanche-consensus",
Expand Down
29 changes: 29 additions & 0 deletions core/cert-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "cert-manager"
version = "0.0.11" # https://crates.io/crates/cert-manager

edition = "2021"
rust-version = "1.69"
publish = true
description = "Cert manager in Rust"
# copied-from:
repository = "https://github.com/gyuho/cert-manager"
readme = "README.md"
license = "Apache-2.0"

[dependencies]
log = "0.4.20"
rand = "0.8.5"
random-manager = "0.0.5" # https://crates.io/crates/random-manager/versions
rcgen = { version = "0.12.1", features = ["pem", "x509-parser"] }
rsa = { version = "0.9.2", features = ["pem"] } # https://crates.io/crates/rsa
rustls = "0.21.8"
rustls-pemfile = "1.0.3"
x509-parser = "0.15.1"

[dev-dependencies]
env_logger = "0.10.0"
tempfile = "3.5.0"

[package.metadata.cargo-udeps.ignore]
normal = ["rsa"]
1 change: 1 addition & 0 deletions core/cert-manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod x509;
File renamed without changes.
1 change: 1 addition & 0 deletions core/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rustls-pemfile = "1.0.3"
x509-parser = "0.15.1"
# for feature "pem"
pem = { version = "3.0.0", optional = true } # https://github.com/jcreekmore/pem-rs
cert-manager = { path = "../../core/cert-manager" }

[dev-dependencies]
env_logger = "0.11.1"
Expand Down
2 changes: 1 addition & 1 deletion core/network/examples/peer_outbound_ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
};

use avalanche_types::{ids::Id, message};
use network::{cert_manager, peer::outbound};
use network::peer::outbound;

/// cargo run --example peer_outbound_ping -- [PEER IP] [STAKING PORT]
/// cargo run --example peer_outbound_ping -- 34.222.2.60 9651
Expand Down
2 changes: 0 additions & 2 deletions core/network/src/cert_manager/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion core/network/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
//! A library for building p2p inbound and outbound connections.
pub mod cert_manager;
pub mod peer;
1 change: 0 additions & 1 deletion core/network/src/peer/inbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::{
sync::Arc,
};

use crate::cert_manager;
use hyper::server::conn::AddrIncoming;
use rustls::server::NoClientAuth;
use tokio_rustls::rustls::ServerConfig;
Expand Down
4 changes: 1 addition & 3 deletions core/network/src/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl Peer {
/// Error is Os { code: 61, kind: ConnectionRefused, message: "Connection refused" } when connecting client to server.
#[cfg(test)]
mod test {
use crate::peer::outbound;
use rcgen::CertificateParams;
use rustls::ServerConfig;
use std::{
Expand All @@ -36,9 +37,6 @@ mod test {
use tokio::net::TcpListener;
use tokio_rustls::TlsAcceptor;

use crate::cert_manager;
use crate::peer::outbound;

#[tokio::test]
#[ignore]
async fn test_listener() -> io::Result<()> {
Expand Down
1 change: 0 additions & 1 deletion core/network/src/peer/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::{

use avalanche_types::ids::node;

use crate::cert_manager;
use log::info;
use pem::Pem;
use rustls::Certificate;
Expand Down
2 changes: 1 addition & 1 deletion crates/avalanche-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bech32 = "0.9.1"
blst = "0.3.10" # https://github.com/supranational/blst/tree/master/bindings/rust, for "BLS
bs58 = { version = "0.5.0", features = ["cb58"] }
bytes = "1.4.0"
cert-manager = "0.0.11" # https://github.com/gyuho/cert-manager
cert-manager = { path = "../../core/cert-manager" }
chrono = "0.4.26"
cmp-manager = "0.0.1"
ecdsa = { version = "0.16.7", features = ["rfc6979", "verifying"] } # https://github.com/RustCrypto/elliptic-curves/tree/master/k256
Expand Down
2 changes: 1 addition & 1 deletion tests/avalanchego-byzantine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ homepage = "https://avax.network"
avalanche-installer = "0.0.77"
avalanche-network-runner-sdk = "0.3.3" # https://crates.io/crates/avalanche-network-runner-sdk
avalanche-types = { path = "../../crates/avalanche-types", features = ["jsonrpc_client"] } # https://crates.io/crates/avalanche-types
cert-manager = "0.0.11" # https://github.com/gyuho/cert-manager
cert-manager = { path = "../../core/cert-manager" }
env_logger = "0.11.1"
hex = "0.4.3"
log = "0.4.20"
Expand Down
2 changes: 1 addition & 1 deletion tests/avalanchego-conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ homepage = "https://avax.network"
[dev-dependencies]
avalanche-types = { path = "../../crates/avalanche-types", features = ["libsecp256k1", "message"] }
avalanchego-conformance-sdk = { path = "../../avalanchego-conformance-sdk" }
cert-manager = "0.0.11" # https://github.com/gyuho/cert-manager
cert-manager = { path = "../../core/cert-manager" }
env_logger = "0.11.1"
log = "0.4.20"
random-manager = "0.0.5"
Expand Down

0 comments on commit b900f5c

Please sign in to comment.