20260605 移除audit rule index和DB trace
This commit is contained in:
@@ -27,8 +27,8 @@ use crate::report::{RfcRef, Warning};
|
||||
use crate::storage::{
|
||||
PackFile, PackTime, RawByHashEntry, RocksStore, ValidatedCaInstanceResult, VcirArtifactKind,
|
||||
VcirArtifactRole, VcirArtifactValidationStatus, VcirAuditSummary, VcirCcrManifestProjection,
|
||||
VcirChildEntry, VcirInstanceGate, VcirLocalOutput, VcirOutputType, VcirRelatedArtifact,
|
||||
VcirSummary,
|
||||
VcirChildEntry, VcirInstanceGate, VcirLocalOutput, VcirLocalOutputPayload, VcirOutputType,
|
||||
VcirRelatedArtifact, VcirReplaceTimingBreakdown, VcirSourceObjectType, VcirSummary,
|
||||
};
|
||||
use crate::sync::repo::{
|
||||
sync_publication_point, sync_publication_point_replay, sync_publication_point_replay_delta,
|
||||
@@ -58,13 +58,17 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use base64::Engine as _;
|
||||
use serde::Deserialize;
|
||||
use serde_json::json;
|
||||
use x509_parser::prelude::FromDer;
|
||||
use x509_parser::x509::SubjectPublicKeyInfo;
|
||||
|
||||
use vcir_der::encode_access_description_der_for_vcir_ccr_projection;
|
||||
|
||||
fn sha256_hex_to_32(hex_value: &str) -> [u8; 32] {
|
||||
let mut out = [0u8; 32];
|
||||
hex::decode_to_slice(hex_value, &mut out).expect("internal sha256 hex should decode");
|
||||
out
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub(crate) struct BuildVcirTimingBreakdown {
|
||||
pub(crate) select_crl_ms: u64,
|
||||
@@ -80,9 +84,9 @@ pub(crate) struct PersistVcirTimingBreakdown {
|
||||
pub(crate) embedded_collect_ms: u64,
|
||||
pub(crate) embedded_store_ms: u64,
|
||||
pub(crate) build_vcir_ms: u64,
|
||||
pub(crate) previous_load_ms: u64,
|
||||
pub(crate) replace_vcir_ms: u64,
|
||||
pub(crate) build_vcir: BuildVcirTimingBreakdown,
|
||||
pub(crate) replace_vcir: VcirReplaceTimingBreakdown,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -311,7 +315,7 @@ impl<'a> Rpkiv1PublicationPointRunner<'a> {
|
||||
self.store,
|
||||
ca,
|
||||
&pack,
|
||||
&objects,
|
||||
&mut objects,
|
||||
&warnings,
|
||||
&child_audits,
|
||||
&discovered_children,
|
||||
@@ -666,7 +670,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
self.validation_time,
|
||||
self.timing.as_ref(),
|
||||
phase2_pool,
|
||||
self.persist_vcir,
|
||||
false,
|
||||
)
|
||||
} else if let Some(phase2_config) = self.parallel_phase2_config.as_ref() {
|
||||
process_publication_point_for_issuer_parallel_roa_with_options(
|
||||
@@ -679,7 +683,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
self.validation_time,
|
||||
self.timing.as_ref(),
|
||||
phase2_config,
|
||||
self.persist_vcir,
|
||||
false,
|
||||
)
|
||||
} else {
|
||||
crate::validation::objects::process_publication_point_for_issuer_with_options(
|
||||
@@ -691,7 +695,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
ca.effective_as_resources.as_ref(),
|
||||
self.validation_time,
|
||||
self.timing.as_ref(),
|
||||
self.persist_vcir,
|
||||
false,
|
||||
)
|
||||
}
|
||||
};
|
||||
@@ -747,7 +751,6 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
"persist_embedded_collect_ms": persist_vcir_timing.embedded_collect_ms,
|
||||
"persist_embedded_store_ms": persist_vcir_timing.embedded_store_ms,
|
||||
"persist_build_vcir_ms": persist_vcir_timing.build_vcir_ms,
|
||||
"persist_previous_load_ms": persist_vcir_timing.previous_load_ms,
|
||||
"persist_replace_vcir_ms": persist_vcir_timing.replace_vcir_ms,
|
||||
"persist_select_crl_ms": persist_vcir_timing.build_vcir.select_crl_ms,
|
||||
"persist_current_ca_decode_ms": persist_vcir_timing.build_vcir.current_ca_decode_ms,
|
||||
@@ -755,6 +758,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
"persist_child_entries_ms": persist_vcir_timing.build_vcir.child_entries_ms,
|
||||
"persist_related_artifacts_ms": persist_vcir_timing.build_vcir.related_artifacts_ms,
|
||||
"persist_vcir_struct_ms": persist_vcir_timing.build_vcir.struct_build_ms,
|
||||
"persist_replace_breakdown": &persist_vcir_timing.replace_vcir,
|
||||
"audit_build_ms": audit_build_ms,
|
||||
"warning_count": result.warnings.len(),
|
||||
"vrp_count": result.objects.vrps.len(),
|
||||
@@ -790,7 +794,6 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
"persist_embedded_collect_ms": persist_vcir_timing.embedded_collect_ms,
|
||||
"persist_embedded_store_ms": persist_vcir_timing.embedded_store_ms,
|
||||
"persist_build_vcir_ms": persist_vcir_timing.build_vcir_ms,
|
||||
"persist_previous_load_ms": persist_vcir_timing.previous_load_ms,
|
||||
"persist_replace_vcir_ms": persist_vcir_timing.replace_vcir_ms,
|
||||
"persist_select_crl_ms": persist_vcir_timing.build_vcir.select_crl_ms,
|
||||
"persist_current_ca_decode_ms": persist_vcir_timing.build_vcir.current_ca_decode_ms,
|
||||
@@ -798,6 +801,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
"persist_child_entries_ms": persist_vcir_timing.build_vcir.child_entries_ms,
|
||||
"persist_related_artifacts_ms": persist_vcir_timing.build_vcir.related_artifacts_ms,
|
||||
"persist_vcir_struct_ms": persist_vcir_timing.build_vcir.struct_build_ms,
|
||||
"persist_replace_breakdown": &persist_vcir_timing.replace_vcir,
|
||||
"audit_build_ms": audit_build_ms,
|
||||
}),
|
||||
);
|
||||
@@ -1012,26 +1016,6 @@ struct VcirReuseProjection {
|
||||
warnings: Vec<Warning>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct VcirVrpPayload {
|
||||
asn: u32,
|
||||
prefix: String,
|
||||
max_length: u16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct VcirAspaPayload {
|
||||
customer_as_id: u32,
|
||||
provider_as_ids: Vec<u32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct VcirRouterKeyPayload {
|
||||
as_id: u32,
|
||||
ski_hex: String,
|
||||
spki_der_base64: String,
|
||||
}
|
||||
|
||||
fn discover_children_from_fresh_snapshot_with_audit<P: PublicationPointData>(
|
||||
issuer: &CaInstanceHandle,
|
||||
publication_point: &P,
|
||||
@@ -2299,7 +2283,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: audit_kind_for_vcir_output_type(local.output_type),
|
||||
result: AuditObjectResult::Error,
|
||||
detail: Some(
|
||||
@@ -2315,7 +2299,7 @@ fn build_objects_output_from_vcir(
|
||||
.entry(local.source_object_uri.clone())
|
||||
.or_insert_with(|| ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: audit_kind_for_vcir_output_type(local.output_type),
|
||||
result: AuditObjectResult::Skipped,
|
||||
detail: Some("skipped: cached local output expired".to_string()),
|
||||
@@ -2332,7 +2316,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: AuditObjectKind::Roa,
|
||||
result: AuditObjectResult::Ok,
|
||||
detail: None,
|
||||
@@ -2348,7 +2332,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: AuditObjectKind::Roa,
|
||||
result: AuditObjectResult::Error,
|
||||
detail: Some(format!("cached ROA local output parse failed: {e}")),
|
||||
@@ -2364,7 +2348,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: AuditObjectKind::Aspa,
|
||||
result: AuditObjectResult::Ok,
|
||||
detail: None,
|
||||
@@ -2380,7 +2364,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: AuditObjectKind::Aspa,
|
||||
result: AuditObjectResult::Error,
|
||||
detail: Some(format!("cached ASPA local output parse failed: {e}")),
|
||||
@@ -2395,7 +2379,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: AuditObjectKind::RouterCertificate,
|
||||
result: AuditObjectResult::Ok,
|
||||
detail: Some("cached Router Key local output restored".to_string()),
|
||||
@@ -2411,7 +2395,7 @@ fn build_objects_output_from_vcir(
|
||||
local.source_object_uri.clone(),
|
||||
ObjectAuditEntry {
|
||||
rsync_uri: local.source_object_uri.clone(),
|
||||
sha256_hex: local.source_object_hash.clone(),
|
||||
sha256_hex: local.source_object_hash_hex(),
|
||||
kind: AuditObjectKind::RouterCertificate,
|
||||
result: AuditObjectResult::Error,
|
||||
detail: Some(format!(
|
||||
@@ -2435,68 +2419,55 @@ fn build_objects_output_from_vcir(
|
||||
}
|
||||
|
||||
fn parse_vcir_vrp_output(local: &VcirLocalOutput) -> Result<Vrp, String> {
|
||||
let payload: VcirVrpPayload = serde_json::from_str(&local.payload_json)
|
||||
.map_err(|e| format!("invalid VRP payload JSON: {e}"))?;
|
||||
Ok(Vrp {
|
||||
asn: payload.asn,
|
||||
prefix: parse_vcir_prefix(&payload.prefix)?,
|
||||
max_length: payload.max_length,
|
||||
})
|
||||
match &local.payload {
|
||||
VcirLocalOutputPayload::Vrp {
|
||||
asn,
|
||||
afi,
|
||||
prefix_len,
|
||||
addr,
|
||||
max_length,
|
||||
} => Ok(Vrp {
|
||||
asn: *asn,
|
||||
prefix: crate::data_model::roa::IpPrefix {
|
||||
afi: *afi,
|
||||
prefix_len: *prefix_len,
|
||||
addr: *addr,
|
||||
},
|
||||
max_length: *max_length,
|
||||
}),
|
||||
_ => Err("VCIR local output payload is not VRP".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_vcir_aspa_output(local: &VcirLocalOutput) -> Result<AspaAttestation, String> {
|
||||
let payload: VcirAspaPayload = serde_json::from_str(&local.payload_json)
|
||||
.map_err(|e| format!("invalid ASPA payload JSON: {e}"))?;
|
||||
Ok(AspaAttestation {
|
||||
customer_as_id: payload.customer_as_id,
|
||||
provider_as_ids: payload.provider_as_ids,
|
||||
})
|
||||
match &local.payload {
|
||||
VcirLocalOutputPayload::Aspa {
|
||||
customer_as_id,
|
||||
provider_as_ids,
|
||||
} => Ok(AspaAttestation {
|
||||
customer_as_id: *customer_as_id,
|
||||
provider_as_ids: provider_as_ids.clone(),
|
||||
}),
|
||||
_ => Err("VCIR local output payload is not ASPA".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_vcir_router_key_output(local: &VcirLocalOutput) -> Result<RouterKeyPayload, String> {
|
||||
let payload: VcirRouterKeyPayload = serde_json::from_str(&local.payload_json)
|
||||
.map_err(|e| format!("invalid Router Key payload JSON: {e}"))?;
|
||||
let ski =
|
||||
hex::decode(&payload.ski_hex).map_err(|e| format!("invalid Router Key SKI hex: {e}"))?;
|
||||
let spki_der = base64::engine::general_purpose::STANDARD
|
||||
.decode(&payload.spki_der_base64)
|
||||
.map_err(|e| format!("invalid Router Key SPKI base64: {e}"))?;
|
||||
Ok(RouterKeyPayload {
|
||||
as_id: payload.as_id,
|
||||
ski,
|
||||
spki_der,
|
||||
source_object_uri: local.source_object_uri.clone(),
|
||||
source_object_hash: local.source_object_hash.clone(),
|
||||
source_ee_cert_hash: local.source_ee_cert_hash.clone(),
|
||||
item_effective_until: local.item_effective_until.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
fn parse_vcir_prefix(prefix: &str) -> Result<crate::data_model::roa::IpPrefix, String> {
|
||||
let (addr, len) = prefix
|
||||
.split_once('/')
|
||||
.ok_or_else(|| format!("prefix missing '/': {prefix}"))?;
|
||||
let prefix_len = len
|
||||
.parse::<u16>()
|
||||
.map_err(|e| format!("invalid prefix length '{len}': {e}"))?;
|
||||
let ip = addr
|
||||
.parse::<std::net::IpAddr>()
|
||||
.map_err(|e| format!("invalid IP address '{addr}': {e}"))?;
|
||||
match ip {
|
||||
std::net::IpAddr::V4(v4) => Ok(crate::data_model::roa::IpPrefix {
|
||||
afi: RoaAfi::Ipv4,
|
||||
prefix_len,
|
||||
addr: {
|
||||
let mut addr = [0u8; 16];
|
||||
addr[..4].copy_from_slice(&v4.octets());
|
||||
addr
|
||||
},
|
||||
}),
|
||||
std::net::IpAddr::V6(v6) => Ok(crate::data_model::roa::IpPrefix {
|
||||
afi: RoaAfi::Ipv6,
|
||||
prefix_len,
|
||||
addr: v6.octets(),
|
||||
match &local.payload {
|
||||
VcirLocalOutputPayload::RouterKey {
|
||||
as_id,
|
||||
ski,
|
||||
spki_der,
|
||||
} => Ok(RouterKeyPayload {
|
||||
as_id: *as_id,
|
||||
ski: ski.clone(),
|
||||
spki_der: spki_der.clone(),
|
||||
source_object_uri: local.source_object_uri.clone(),
|
||||
source_object_hash: local.source_object_hash_hex(),
|
||||
source_ee_cert_hash: local.source_ee_cert_hash_hex(),
|
||||
item_effective_until: local.item_effective_until.clone(),
|
||||
}),
|
||||
_ => Err("VCIR local output payload is not Router Key".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2582,7 +2553,7 @@ fn persist_vcir_for_fresh_result(
|
||||
store: &RocksStore,
|
||||
ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
objects: &crate::validation::objects::ObjectsOutput,
|
||||
objects: &mut crate::validation::objects::ObjectsOutput,
|
||||
warnings: &[Warning],
|
||||
child_audits: &[ObjectAuditEntry],
|
||||
discovered_children: &[DiscoveredChildCaInstance],
|
||||
@@ -2605,7 +2576,7 @@ fn persist_vcir_for_fresh_result_with_timing(
|
||||
store: &RocksStore,
|
||||
ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
objects: &crate::validation::objects::ObjectsOutput,
|
||||
objects: &mut crate::validation::objects::ObjectsOutput,
|
||||
warnings: &[Warning],
|
||||
child_audits: &[ObjectAuditEntry],
|
||||
discovered_children: &[DiscoveredChildCaInstance],
|
||||
@@ -2635,17 +2606,12 @@ fn persist_vcir_for_fresh_result_with_timing(
|
||||
timing.build_vcir_ms = build_vcir_started.elapsed().as_millis() as u64;
|
||||
timing.build_vcir = build_vcir_timing;
|
||||
|
||||
let previous_load_started = std::time::Instant::now();
|
||||
let previous = store
|
||||
.get_vcir(&pack.manifest_rsync_uri)
|
||||
.map_err(|e| format!("load existing VCIR failed: {e}"))?;
|
||||
timing.previous_load_ms = previous_load_started.elapsed().as_millis() as u64;
|
||||
|
||||
let replace_vcir_started = std::time::Instant::now();
|
||||
store
|
||||
.replace_vcir_and_audit_rule_indexes(previous.as_ref(), &vcir)
|
||||
.map_err(|e| format!("store VCIR and audit rule index failed: {e}"))?;
|
||||
let replace_timing = store
|
||||
.replace_vcir_and_manifest_replay_meta(&vcir)
|
||||
.map_err(|e| format!("store VCIR and manifest replay meta failed: {e}"))?;
|
||||
timing.replace_vcir_ms = replace_vcir_started.elapsed().as_millis() as u64;
|
||||
timing.replace_vcir = replace_timing;
|
||||
|
||||
Ok(timing)
|
||||
}
|
||||
@@ -2653,7 +2619,7 @@ fn persist_vcir_for_fresh_result_with_timing(
|
||||
fn build_vcir_from_fresh_result(
|
||||
ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
objects: &crate::validation::objects::ObjectsOutput,
|
||||
objects: &mut crate::validation::objects::ObjectsOutput,
|
||||
warnings: &[Warning],
|
||||
child_audits: &[ObjectAuditEntry],
|
||||
discovered_children: &[DiscoveredChildCaInstance],
|
||||
@@ -2674,7 +2640,7 @@ fn build_vcir_from_fresh_result(
|
||||
fn build_vcir_from_fresh_result_with_timing(
|
||||
ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
objects: &crate::validation::objects::ObjectsOutput,
|
||||
objects: &mut crate::validation::objects::ObjectsOutput,
|
||||
warnings: &[Warning],
|
||||
child_audits: &[ObjectAuditEntry],
|
||||
discovered_children: &[DiscoveredChildCaInstance],
|
||||
@@ -2692,7 +2658,7 @@ fn build_vcir_from_fresh_result_with_timing(
|
||||
timing.current_ca_decode_ms = current_ca_decode_started.elapsed().as_millis() as u64;
|
||||
|
||||
let local_outputs_started = std::time::Instant::now();
|
||||
let local_outputs = build_vcir_local_outputs(ca, pack, objects)?;
|
||||
let local_outputs = take_or_build_vcir_local_outputs(ca, pack, objects)?;
|
||||
timing.local_outputs_ms = local_outputs_started.elapsed().as_millis() as u64;
|
||||
|
||||
let child_entries_started = std::time::Instant::now();
|
||||
@@ -2710,6 +2676,18 @@ fn build_vcir_from_fresh_result_with_timing(
|
||||
timing.related_artifacts_ms = related_artifacts_started.elapsed().as_millis() as u64;
|
||||
let ccr_manifest_projection =
|
||||
build_vcir_ccr_manifest_projection_from_fresh(ca, pack, &child_entries)?;
|
||||
let local_vrp_count = local_outputs
|
||||
.iter()
|
||||
.filter(|output| output.output_type == VcirOutputType::Vrp)
|
||||
.count() as u32;
|
||||
let local_aspa_count = local_outputs
|
||||
.iter()
|
||||
.filter(|output| output.output_type == VcirOutputType::Aspa)
|
||||
.count() as u32;
|
||||
let local_router_key_count = local_outputs
|
||||
.iter()
|
||||
.filter(|output| output.output_type == VcirOutputType::RouterKey)
|
||||
.count() as u32;
|
||||
let accepted_object_count = related_artifacts
|
||||
.iter()
|
||||
.filter(|artifact| artifact.validation_status == VcirArtifactValidationStatus::Accepted)
|
||||
@@ -2768,21 +2746,12 @@ fn build_vcir_from_fresh_result_with_timing(
|
||||
),
|
||||
},
|
||||
child_entries,
|
||||
local_outputs: local_outputs.clone(),
|
||||
related_artifacts: related_artifacts.clone(),
|
||||
local_outputs,
|
||||
related_artifacts,
|
||||
summary: VcirSummary {
|
||||
local_vrp_count: local_outputs
|
||||
.iter()
|
||||
.filter(|output| output.output_type == VcirOutputType::Vrp)
|
||||
.count() as u32,
|
||||
local_aspa_count: local_outputs
|
||||
.iter()
|
||||
.filter(|output| output.output_type == VcirOutputType::Aspa)
|
||||
.count() as u32,
|
||||
local_router_key_count: local_outputs
|
||||
.iter()
|
||||
.filter(|output| output.output_type == VcirOutputType::RouterKey)
|
||||
.count() as u32,
|
||||
local_vrp_count,
|
||||
local_aspa_count,
|
||||
local_router_key_count,
|
||||
child_count: discovered_children.len() as u32,
|
||||
accepted_object_count,
|
||||
rejected_object_count,
|
||||
@@ -2799,6 +2768,17 @@ fn build_vcir_from_fresh_result_with_timing(
|
||||
Ok((vcir, timing))
|
||||
}
|
||||
|
||||
fn take_or_build_vcir_local_outputs(
|
||||
ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
objects: &mut crate::validation::objects::ObjectsOutput,
|
||||
) -> Result<Vec<VcirLocalOutput>, String> {
|
||||
if !objects.local_outputs_cache.is_empty() {
|
||||
return Ok(std::mem::take(&mut objects.local_outputs_cache));
|
||||
}
|
||||
build_vcir_local_outputs(ca, pack, objects)
|
||||
}
|
||||
|
||||
fn build_vcir_ccr_manifest_projection_from_fresh(
|
||||
ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
@@ -2892,7 +2872,7 @@ fn select_manifest_current_crl_from_snapshot(
|
||||
}
|
||||
|
||||
fn build_vcir_local_outputs(
|
||||
ca: &CaInstanceHandle,
|
||||
_ca: &CaInstanceHandle,
|
||||
pack: &PublicationPointSnapshot,
|
||||
objects: &crate::validation::objects::ObjectsOutput,
|
||||
) -> Result<Vec<VcirLocalOutput>, String> {
|
||||
@@ -2930,12 +2910,6 @@ fn build_vcir_local_outputs(
|
||||
PackTime::from_utc_offset_datetime(ee.resource_cert.tbs.validity_not_after);
|
||||
for vrp in roa_to_vrps_for_vcir(&roa) {
|
||||
let prefix = vrp_prefix_to_string(&vrp);
|
||||
let payload_json = json!({
|
||||
"asn": vrp.asn,
|
||||
"prefix": prefix,
|
||||
"max_length": vrp.max_length,
|
||||
})
|
||||
.to_string();
|
||||
let rule_hash = sha256_hex(
|
||||
format!(
|
||||
"roa-rule:{}:{}:{}:{}",
|
||||
@@ -2944,20 +2918,20 @@ fn build_vcir_local_outputs(
|
||||
.as_bytes(),
|
||||
);
|
||||
out.push(VcirLocalOutput {
|
||||
output_id: rule_hash.clone(),
|
||||
output_type: VcirOutputType::Vrp,
|
||||
item_effective_until: item_effective_until.clone(),
|
||||
source_object_uri: file.rsync_uri.clone(),
|
||||
source_object_type: "roa".to_string(),
|
||||
source_object_hash: source_object_hash.clone(),
|
||||
source_ee_cert_hash: source_ee_cert_hash.clone(),
|
||||
payload_json,
|
||||
rule_hash,
|
||||
validation_path_hint: vec![
|
||||
ca.manifest_rsync_uri.clone(),
|
||||
file.rsync_uri.clone(),
|
||||
source_object_hash.clone(),
|
||||
],
|
||||
source_object_type: VcirSourceObjectType::Roa,
|
||||
source_object_hash: file.sha256,
|
||||
source_ee_cert_hash: sha256_hex_to_32(&source_ee_cert_hash),
|
||||
payload: VcirLocalOutputPayload::Vrp {
|
||||
asn: vrp.asn,
|
||||
afi: vrp.prefix.afi,
|
||||
prefix_len: vrp.prefix.prefix_len,
|
||||
addr: vrp.prefix.addr,
|
||||
max_length: vrp.max_length,
|
||||
},
|
||||
rule_hash: sha256_hex_to_32(&rule_hash),
|
||||
});
|
||||
}
|
||||
} else if accepted_aspa_uris.contains(file.rsync_uri.as_str()) {
|
||||
@@ -2970,11 +2944,6 @@ fn build_vcir_local_outputs(
|
||||
let source_ee_cert_hash = sha256_hex(ee.raw_der.as_slice());
|
||||
let item_effective_until =
|
||||
PackTime::from_utc_offset_datetime(ee.resource_cert.tbs.validity_not_after);
|
||||
let payload_json = json!({
|
||||
"customer_as_id": aspa.aspa.customer_as_id,
|
||||
"provider_as_ids": aspa.aspa.provider_as_ids,
|
||||
})
|
||||
.to_string();
|
||||
let providers = aspa
|
||||
.aspa
|
||||
.provider_as_ids
|
||||
@@ -2990,20 +2959,17 @@ fn build_vcir_local_outputs(
|
||||
.as_bytes(),
|
||||
);
|
||||
out.push(VcirLocalOutput {
|
||||
output_id: rule_hash.clone(),
|
||||
output_type: VcirOutputType::Aspa,
|
||||
item_effective_until,
|
||||
source_object_uri: file.rsync_uri.clone(),
|
||||
source_object_type: "aspa".to_string(),
|
||||
source_object_hash: source_object_hash.clone(),
|
||||
source_ee_cert_hash,
|
||||
payload_json,
|
||||
rule_hash,
|
||||
validation_path_hint: vec![
|
||||
ca.manifest_rsync_uri.clone(),
|
||||
file.rsync_uri.clone(),
|
||||
source_object_hash,
|
||||
],
|
||||
source_object_type: VcirSourceObjectType::Aspa,
|
||||
source_object_hash: file.sha256,
|
||||
source_ee_cert_hash: sha256_hex_to_32(&source_ee_cert_hash),
|
||||
payload: VcirLocalOutputPayload::Aspa {
|
||||
customer_as_id: aspa.aspa.customer_as_id,
|
||||
provider_as_ids: aspa.aspa.provider_as_ids.clone(),
|
||||
},
|
||||
rule_hash: sha256_hex_to_32(&rule_hash),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3011,7 +2977,7 @@ fn build_vcir_local_outputs(
|
||||
}
|
||||
|
||||
pub(crate) fn build_router_key_local_outputs(
|
||||
ca: &CaInstanceHandle,
|
||||
_ca: &CaInstanceHandle,
|
||||
router_keys: &[RouterKeyPayload],
|
||||
) -> Vec<VcirLocalOutput> {
|
||||
router_keys
|
||||
@@ -3028,25 +2994,18 @@ pub(crate) fn build_router_key_local_outputs(
|
||||
.as_bytes(),
|
||||
);
|
||||
VcirLocalOutput {
|
||||
output_id: rule_hash.clone(),
|
||||
output_type: VcirOutputType::RouterKey,
|
||||
item_effective_until: router_key.item_effective_until.clone(),
|
||||
source_object_uri: router_key.source_object_uri.clone(),
|
||||
source_object_type: "router_key".to_string(),
|
||||
source_object_hash: router_key.source_object_hash.clone(),
|
||||
source_ee_cert_hash: router_key.source_ee_cert_hash.clone(),
|
||||
payload_json: json!({
|
||||
"as_id": router_key.as_id,
|
||||
"ski_hex": ski_hex,
|
||||
"spki_der_base64": spki_der_base64,
|
||||
})
|
||||
.to_string(),
|
||||
rule_hash,
|
||||
validation_path_hint: vec![
|
||||
ca.manifest_rsync_uri.clone(),
|
||||
router_key.source_object_uri.clone(),
|
||||
router_key.source_object_hash.clone(),
|
||||
],
|
||||
source_object_type: VcirSourceObjectType::RouterKey,
|
||||
source_object_hash: sha256_hex_to_32(&router_key.source_object_hash),
|
||||
source_ee_cert_hash: sha256_hex_to_32(&router_key.source_ee_cert_hash),
|
||||
payload: VcirLocalOutputPayload::RouterKey {
|
||||
as_id: router_key.as_id,
|
||||
ski: router_key.ski.clone(),
|
||||
spki_der: router_key.spki_der.clone(),
|
||||
},
|
||||
rule_hash: sha256_hex_to_32(&rule_hash),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user