|
@@ -5,7 +5,6 @@ use {
|
|
|
DEFAULT_MAX_STREAMS_PER_MS, DEFAULT_WAIT_FOR_CHUNK_TIMEOUT,
|
|
DEFAULT_MAX_STREAMS_PER_MS, DEFAULT_WAIT_FOR_CHUNK_TIMEOUT,
|
|
|
},
|
|
},
|
|
|
streamer::StakedNodes,
|
|
streamer::StakedNodes,
|
|
|
- tls_certificates::new_dummy_x509_certificate,
|
|
|
|
|
},
|
|
},
|
|
|
crossbeam_channel::Sender,
|
|
crossbeam_channel::Sender,
|
|
|
pem::Pem,
|
|
pem::Pem,
|
|
@@ -13,17 +12,14 @@ use {
|
|
|
crypto::rustls::{NoInitialCipherSuite, QuicServerConfig},
|
|
crypto::rustls::{NoInitialCipherSuite, QuicServerConfig},
|
|
|
Endpoint, IdleTimeout, ServerConfig,
|
|
Endpoint, IdleTimeout, ServerConfig,
|
|
|
},
|
|
},
|
|
|
- rustls::{
|
|
|
|
|
- pki_types::{CertificateDer, UnixTime},
|
|
|
|
|
- server::danger::ClientCertVerified,
|
|
|
|
|
- DistinguishedName, KeyLogFile,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ rustls::KeyLogFile,
|
|
|
solana_keypair::Keypair,
|
|
solana_keypair::Keypair,
|
|
|
solana_packet::PACKET_DATA_SIZE,
|
|
solana_packet::PACKET_DATA_SIZE,
|
|
|
solana_perf::packet::PacketBatch,
|
|
solana_perf::packet::PacketBatch,
|
|
|
solana_quic_definitions::{
|
|
solana_quic_definitions::{
|
|
|
NotifyKeyUpdate, QUIC_MAX_TIMEOUT, QUIC_MAX_UNSTAKED_CONCURRENT_STREAMS,
|
|
NotifyKeyUpdate, QUIC_MAX_TIMEOUT, QUIC_MAX_UNSTAKED_CONCURRENT_STREAMS,
|
|
|
},
|
|
},
|
|
|
|
|
+ solana_tls_utils::{new_dummy_x509_certificate, SkipClientVerification},
|
|
|
std::{
|
|
std::{
|
|
|
net::UdpSocket,
|
|
net::UdpSocket,
|
|
|
sync::{
|
|
sync::{
|
|
@@ -44,76 +40,12 @@ pub const DEFAULT_QUIC_ENDPOINTS: usize = 1;
|
|
|
// inlined to avoid solana-sdk dep
|
|
// inlined to avoid solana-sdk dep
|
|
|
pub(crate) const DEFAULT_TPU_COALESCE: Duration = Duration::from_millis(5);
|
|
pub(crate) const DEFAULT_TPU_COALESCE: Duration = Duration::from_millis(5);
|
|
|
|
|
|
|
|
-#[derive(Debug)]
|
|
|
|
|
-pub struct SkipClientVerification(Arc<rustls::crypto::CryptoProvider>);
|
|
|
|
|
-
|
|
|
|
|
-impl SkipClientVerification {
|
|
|
|
|
- pub fn new() -> Arc<Self> {
|
|
|
|
|
- Arc::new(Self(Arc::new(rustls::crypto::ring::default_provider())))
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
pub struct SpawnServerResult {
|
|
pub struct SpawnServerResult {
|
|
|
pub endpoints: Vec<Endpoint>,
|
|
pub endpoints: Vec<Endpoint>,
|
|
|
pub thread: thread::JoinHandle<()>,
|
|
pub thread: thread::JoinHandle<()>,
|
|
|
pub key_updater: Arc<EndpointKeyUpdater>,
|
|
pub key_updater: Arc<EndpointKeyUpdater>,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-impl rustls::server::danger::ClientCertVerifier for SkipClientVerification {
|
|
|
|
|
- fn verify_client_cert(
|
|
|
|
|
- &self,
|
|
|
|
|
- _end_entity: &CertificateDer,
|
|
|
|
|
- _intermediates: &[CertificateDer],
|
|
|
|
|
- _now: UnixTime,
|
|
|
|
|
- ) -> Result<ClientCertVerified, rustls::Error> {
|
|
|
|
|
- Ok(rustls::server::danger::ClientCertVerified::assertion())
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fn root_hint_subjects(&self) -> &[DistinguishedName] {
|
|
|
|
|
- &[]
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fn verify_tls12_signature(
|
|
|
|
|
- &self,
|
|
|
|
|
- message: &[u8],
|
|
|
|
|
- cert: &rustls::pki_types::CertificateDer<'_>,
|
|
|
|
|
- dss: &rustls::DigitallySignedStruct,
|
|
|
|
|
- ) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error> {
|
|
|
|
|
- rustls::crypto::verify_tls12_signature(
|
|
|
|
|
- message,
|
|
|
|
|
- cert,
|
|
|
|
|
- dss,
|
|
|
|
|
- &self.0.signature_verification_algorithms,
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fn verify_tls13_signature(
|
|
|
|
|
- &self,
|
|
|
|
|
- message: &[u8],
|
|
|
|
|
- cert: &rustls::pki_types::CertificateDer<'_>,
|
|
|
|
|
- dss: &rustls::DigitallySignedStruct,
|
|
|
|
|
- ) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error> {
|
|
|
|
|
- rustls::crypto::verify_tls13_signature(
|
|
|
|
|
- message,
|
|
|
|
|
- cert,
|
|
|
|
|
- dss,
|
|
|
|
|
- &self.0.signature_verification_algorithms,
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fn supported_verify_schemes(&self) -> Vec<rustls::SignatureScheme> {
|
|
|
|
|
- self.0.signature_verification_algorithms.supported_schemes()
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fn offer_client_auth(&self) -> bool {
|
|
|
|
|
- true
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fn client_auth_mandatory(&self) -> bool {
|
|
|
|
|
- self.offer_client_auth()
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/// Returns default server configuration along with its PEM certificate chain.
|
|
/// Returns default server configuration along with its PEM certificate chain.
|
|
|
#[allow(clippy::field_reassign_with_default)] // https://github.com/rust-lang/rust-clippy/issues/6527
|
|
#[allow(clippy::field_reassign_with_default)] // https://github.com/rust-lang/rust-clippy/issues/6527
|
|
|
pub(crate) fn configure_server(
|
|
pub(crate) fn configure_server(
|