20260626_2 优化child证书缓存并修复远端发布
This commit is contained in:
@@ -57,8 +57,8 @@ use crate::validation::objects::{
|
||||
};
|
||||
use crate::validation::publication_point::PublicationPointSnapshot;
|
||||
use crate::validation::tree::{
|
||||
CaCertificateRef, CaInstanceHandle, DiscoveredChildCaInstance, PublicationPointRunResult,
|
||||
PublicationPointRunner,
|
||||
CaCertificateRef, CaInstanceHandle, DiscoveredChildCaInstance, DiscoveredChildEntryProjection,
|
||||
PublicationPointRunResult, PublicationPointRunner,
|
||||
};
|
||||
use sha2::Digest;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
@@ -2689,6 +2689,7 @@ fn discover_children_from_fresh_snapshot_with_audit_cached_with_issuer_der<
|
||||
match &projection.payload {
|
||||
ChildCertificateCachePayload::ChildCa {
|
||||
child_manifest_rsync_uri,
|
||||
child_ski,
|
||||
child_rsync_base_uri,
|
||||
child_publication_point_rsync_uri,
|
||||
child_rrdp_notification_uri,
|
||||
@@ -2735,6 +2736,11 @@ fn discover_children_from_fresh_snapshot_with_audit_cached_with_issuer_der<
|
||||
child_ca_certificate_sha256_hex:
|
||||
child_cert_sha256_hex.clone(),
|
||||
},
|
||||
child_entry_projection: Some(
|
||||
DiscoveredChildEntryProjection {
|
||||
child_ski: child_ski.clone(),
|
||||
},
|
||||
),
|
||||
});
|
||||
ca_ok = ca_ok.saturating_add(1);
|
||||
child_cert_cache_hit =
|
||||
@@ -3145,6 +3151,15 @@ fn discover_children_from_fresh_snapshot_with_audit_cached_with_issuer_der<
|
||||
child_ca_certificate_rsync_uri: f.rsync_uri.clone(),
|
||||
child_ca_certificate_sha256_hex: child_cert_sha256_hex.clone(),
|
||||
},
|
||||
child_entry_projection: validated
|
||||
.child_ca
|
||||
.tbs
|
||||
.extensions
|
||||
.subject_key_identifier
|
||||
.as_ref()
|
||||
.map(|child_ski| DiscoveredChildEntryProjection {
|
||||
child_ski: hex::encode(child_ski),
|
||||
}),
|
||||
});
|
||||
enqueue_nanos =
|
||||
enqueue_nanos.saturating_add(t3.elapsed().as_nanos().min(u128::from(u64::MAX)) as u64);
|
||||
@@ -4857,6 +4872,9 @@ fn restore_children_from_vcir(
|
||||
child_ca_certificate_rsync_uri: child.child_cert_rsync_uri.clone(),
|
||||
child_ca_certificate_sha256_hex: child.child_cert_hash.clone(),
|
||||
},
|
||||
child_entry_projection: Some(DiscoveredChildEntryProjection {
|
||||
child_ski: child.child_ski.clone(),
|
||||
}),
|
||||
});
|
||||
audits.push(ObjectAuditEntry {
|
||||
rsync_uri: child.child_cert_rsync_uri.clone(),
|
||||
@@ -5073,6 +5091,9 @@ fn publication_point_cache_discovered_child(
|
||||
child_ca_certificate_rsync_uri: child.child_cert_rsync_uri.clone(),
|
||||
child_ca_certificate_sha256_hex: child.child_cert_hash.clone(),
|
||||
},
|
||||
child_entry_projection: Some(DiscoveredChildEntryProjection {
|
||||
child_ski: child.child_ski.clone(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5713,15 +5734,21 @@ fn build_vcir_child_entries(
|
||||
) -> Result<Vec<VcirChildEntry>, String> {
|
||||
let mut out = Vec::with_capacity(discovered_children.len());
|
||||
for child in discovered_children {
|
||||
let child_der = child.handle.ca_certificate_der(store)?;
|
||||
let child_cert = ResourceCertificate::decode_der(child_der.as_ref())
|
||||
.map_err(|e| format!("decode child certificate for VCIR failed: {e}"))?;
|
||||
let child_ski = child_cert
|
||||
.tbs
|
||||
.extensions
|
||||
.subject_key_identifier
|
||||
.as_ref()
|
||||
.ok_or_else(|| "child certificate missing SubjectKeyIdentifier".to_string())?;
|
||||
let child_ski = match child.child_entry_projection.as_ref() {
|
||||
Some(projection) => projection.child_ski.clone(),
|
||||
None => {
|
||||
let child_der = child.handle.ca_certificate_der(store)?;
|
||||
let child_cert = ResourceCertificate::decode_der(child_der.as_ref())
|
||||
.map_err(|e| format!("decode child certificate for VCIR failed: {e}"))?;
|
||||
let child_ski = child_cert
|
||||
.tbs
|
||||
.extensions
|
||||
.subject_key_identifier
|
||||
.as_ref()
|
||||
.ok_or_else(|| "child certificate missing SubjectKeyIdentifier".to_string())?;
|
||||
hex::encode(child_ski)
|
||||
}
|
||||
};
|
||||
out.push(VcirChildEntry {
|
||||
child_manifest_rsync_uri: child.handle.manifest_rsync_uri.clone(),
|
||||
child_cert_rsync_uri: child.discovered_from.child_ca_certificate_rsync_uri.clone(),
|
||||
@@ -5729,7 +5756,7 @@ fn build_vcir_child_entries(
|
||||
.discovered_from
|
||||
.child_ca_certificate_sha256_hex
|
||||
.clone(),
|
||||
child_ski: hex::encode(child_ski),
|
||||
child_ski,
|
||||
child_rsync_base_uri: child.handle.rsync_base_uri.clone(),
|
||||
child_publication_point_rsync_uri: child.handle.publication_point_rsync_uri.clone(),
|
||||
child_rrdp_notification_uri: child.handle.rrdp_notification_uri.clone(),
|
||||
|
||||
Reference in New Issue
Block a user