20260427 拆分独立repo-bytes.db数据库文件,cir materialize 移除旧兼容
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::analysis::timing::TimingHandle;
|
||||
use crate::audit::{
|
||||
sha256_hex, sha256_hex_from_32, AuditObjectKind, AuditObjectResult, AuditWarning,
|
||||
ObjectAuditEntry, PublicationPointAudit,
|
||||
AuditObjectKind, AuditObjectResult, AuditWarning, ObjectAuditEntry, PublicationPointAudit,
|
||||
sha256_hex, sha256_hex_from_32,
|
||||
};
|
||||
use crate::audit_downloads::DownloadLogHandle;
|
||||
use crate::ccr::CcrAccumulator;
|
||||
@@ -34,18 +34,18 @@ use crate::sync::repo::{
|
||||
use crate::sync::rrdp::Fetcher;
|
||||
use crate::validation::ca_instance::ca_instance_uris_from_ca_certificate;
|
||||
use crate::validation::ca_path::{
|
||||
validate_subordinate_ca_cert_with_prevalidated_issuer_and_resources, CaPathError,
|
||||
IssuerEffectiveResourcesIndex, ValidatedSubordinateCaLite,
|
||||
CaPathError, IssuerEffectiveResourcesIndex, ValidatedSubordinateCaLite,
|
||||
validate_subordinate_ca_cert_with_prevalidated_issuer_and_resources,
|
||||
};
|
||||
use crate::validation::manifest::{
|
||||
process_manifest_publication_point_fresh_after_repo_sync_with_timing,
|
||||
FreshPublicationPointTimingBreakdown, FreshValidatedPublicationPoint, ManifestFreshError,
|
||||
PublicationPointData, PublicationPointSource,
|
||||
process_manifest_publication_point_fresh_after_repo_sync_with_timing,
|
||||
};
|
||||
use crate::validation::objects::{
|
||||
AspaAttestation, ParallelRoaWorkerPool, RouterKeyPayload, Vrp,
|
||||
process_publication_point_for_issuer, process_publication_point_for_issuer_parallel_roa,
|
||||
process_publication_point_for_issuer_parallel_roa_with_pool, AspaAttestation,
|
||||
ParallelRoaWorkerPool, RouterKeyPayload, Vrp,
|
||||
process_publication_point_for_issuer_parallel_roa_with_pool,
|
||||
};
|
||||
use crate::validation::publication_point::PublicationPointSnapshot;
|
||||
use crate::validation::tree::{
|
||||
@@ -228,9 +228,11 @@ impl<'a> Rpkiv1PublicationPointRunner<'a> {
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
vec![Warning::new(format!("child CA discovery failed: {e}"))
|
||||
.with_rfc_refs(&[RfcRef("RFC 6487 §7.2")])
|
||||
.with_context(&ca.manifest_rsync_uri)],
|
||||
vec![
|
||||
Warning::new(format!("child CA discovery failed: {e}"))
|
||||
.with_rfc_refs(&[RfcRef("RFC 6487 §7.2")])
|
||||
.with_context(&ca.manifest_rsync_uri),
|
||||
],
|
||||
),
|
||||
};
|
||||
let child_discovery_ms = child_discovery_started.elapsed().as_millis() as u64;
|
||||
@@ -1946,9 +1948,11 @@ fn project_current_instance_vcir_on_failed_fetch(
|
||||
fresh_err: &ManifestFreshError,
|
||||
validation_time: time::OffsetDateTime,
|
||||
) -> Result<VcirReuseProjection, String> {
|
||||
let mut warnings = vec![Warning::new(format!("manifest failed fetch: {fresh_err}"))
|
||||
.with_rfc_refs(&[RfcRef("RFC 9286 §6.6")])
|
||||
.with_context(&ca.manifest_rsync_uri)];
|
||||
let mut warnings = vec![
|
||||
Warning::new(format!("manifest failed fetch: {fresh_err}"))
|
||||
.with_rfc_refs(&[RfcRef("RFC 9286 §6.6")])
|
||||
.with_context(&ca.manifest_rsync_uri),
|
||||
];
|
||||
|
||||
let Some(vcir) = store
|
||||
.get_vcir(&ca.manifest_rsync_uri)
|
||||
@@ -3236,8 +3240,8 @@ mod tests {
|
||||
use crate::validation::tree::PublicationPointRunner;
|
||||
|
||||
use std::process::Command;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
struct NeverHttpFetcher;
|
||||
impl Fetcher for NeverHttpFetcher {
|
||||
@@ -3666,8 +3670,8 @@ authorityKeyIdentifier = keyid:always
|
||||
}
|
||||
}
|
||||
|
||||
fn cernet_publication_point_snapshot_for_vcir_tests(
|
||||
) -> (PublicationPointSnapshot, Vec<u8>, time::OffsetDateTime) {
|
||||
fn cernet_publication_point_snapshot_for_vcir_tests()
|
||||
-> (PublicationPointSnapshot, Vec<u8>, time::OffsetDateTime) {
|
||||
let dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("tests/fixtures/repository/rpki.cernet.net/repo/cernet/0");
|
||||
let rsync_base_uri = "rsync://rpki.cernet.net/repo/cernet/0/";
|
||||
@@ -4013,18 +4017,22 @@ authorityKeyIdentifier = keyid:always
|
||||
.get_raw_by_hash_entry(&issuer_hash)
|
||||
.expect("load issuer raw entry")
|
||||
.expect("issuer raw entry present");
|
||||
assert!(issuer_entry
|
||||
.origin_uris
|
||||
.iter()
|
||||
.any(|uri| uri.ends_with("BfycW4hQb3wNP4YsiJW-1n6fjro.cer")));
|
||||
assert!(
|
||||
issuer_entry
|
||||
.origin_uris
|
||||
.iter()
|
||||
.any(|uri| uri.ends_with("BfycW4hQb3wNP4YsiJW-1n6fjro.cer"))
|
||||
);
|
||||
let first_output = objects
|
||||
.local_outputs_cache
|
||||
.first()
|
||||
.expect("first local output");
|
||||
assert!(store
|
||||
.get_raw_by_hash_entry(&first_output.source_ee_cert_hash)
|
||||
.expect("load source ee raw")
|
||||
.is_none());
|
||||
assert!(
|
||||
store
|
||||
.get_raw_by_hash_entry(&first_output.source_ee_cert_hash)
|
||||
.expect("load source ee raw")
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4100,9 +4108,11 @@ authorityKeyIdentifier = keyid:always
|
||||
.expect("rebuild vcir local outputs");
|
||||
assert!(!local_outputs.is_empty());
|
||||
assert_eq!(local_outputs.len(), objects.vrps.len());
|
||||
assert!(local_outputs
|
||||
.iter()
|
||||
.all(|output| output.output_type == VcirOutputType::Vrp));
|
||||
assert!(
|
||||
local_outputs
|
||||
.iter()
|
||||
.all(|output| output.output_type == VcirOutputType::Vrp)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4275,10 +4285,15 @@ authorityKeyIdentifier = keyid:always
|
||||
pack.manifest_bytes.len() as u64
|
||||
);
|
||||
let first_output = vcir.local_outputs.first().expect("local outputs stored");
|
||||
assert!(store
|
||||
.get_audit_rule_index_entry(crate::storage::AuditRuleKind::Roa, &first_output.rule_hash)
|
||||
.expect("get audit rule index entry")
|
||||
.is_some());
|
||||
assert!(
|
||||
store
|
||||
.get_audit_rule_index_entry(
|
||||
crate::storage::AuditRuleKind::Roa,
|
||||
&first_output.rule_hash
|
||||
)
|
||||
.expect("get audit rule index entry")
|
||||
.is_some()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4454,12 +4469,16 @@ authorityKeyIdentifier = keyid:always
|
||||
&objects,
|
||||
&[],
|
||||
);
|
||||
assert!(artifacts
|
||||
.iter()
|
||||
.any(|artifact| artifact.artifact_role == VcirArtifactRole::Manifest));
|
||||
assert!(artifacts
|
||||
.iter()
|
||||
.any(|artifact| artifact.artifact_role == VcirArtifactRole::TrustAnchorCert));
|
||||
assert!(
|
||||
artifacts
|
||||
.iter()
|
||||
.any(|artifact| artifact.artifact_role == VcirArtifactRole::Manifest)
|
||||
);
|
||||
assert!(
|
||||
artifacts
|
||||
.iter()
|
||||
.any(|artifact| artifact.artifact_role == VcirArtifactRole::TrustAnchorCert)
|
||||
);
|
||||
assert!(artifacts.iter().any(|artifact| artifact.uri.as_deref()
|
||||
== Some("rsync://example.test/repo/issuer/issuer.crl")
|
||||
&& artifact.artifact_role == VcirArtifactRole::CurrentCrl));
|
||||
@@ -5402,11 +5421,13 @@ authorityKeyIdentifier = keyid:always
|
||||
assert!(out.children.is_empty());
|
||||
assert_eq!(out.audits.len(), 1);
|
||||
assert!(matches!(out.audits[0].result, AuditObjectResult::Ok));
|
||||
assert!(out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("validated BGPsec router certificate"));
|
||||
assert!(
|
||||
out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("validated BGPsec router certificate")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -5450,11 +5471,13 @@ authorityKeyIdentifier = keyid:always
|
||||
assert!(out.children.is_empty());
|
||||
assert_eq!(out.audits.len(), 1);
|
||||
assert!(matches!(out.audits[0].result, AuditObjectResult::Skipped));
|
||||
assert!(out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("not a CA resource certificate or BGPsec router certificate"));
|
||||
assert!(
|
||||
out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("not a CA resource certificate or BGPsec router certificate")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -5498,11 +5521,13 @@ authorityKeyIdentifier = keyid:always
|
||||
assert!(out.children.is_empty());
|
||||
assert_eq!(out.audits.len(), 1);
|
||||
assert!(matches!(out.audits[0].result, AuditObjectResult::Error));
|
||||
assert!(out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("router certificate validation failed"));
|
||||
assert!(
|
||||
out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("router certificate validation failed")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -5637,11 +5662,13 @@ authorityKeyIdentifier = keyid:always
|
||||
assert!(out.children.is_empty());
|
||||
assert_eq!(out.audits.len(), 1);
|
||||
assert!(matches!(out.audits[0].result, AuditObjectResult::Error));
|
||||
assert!(out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("issuer CA decode failed"));
|
||||
assert!(
|
||||
out.audits[0]
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.contains("issuer CA decode failed")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -6187,8 +6214,8 @@ authorityKeyIdentifier = keyid:always
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_publication_point_audit_from_vcir_uses_vcir_metadata_and_overlays_child_and_object_audits(
|
||||
) {
|
||||
fn build_publication_point_audit_from_vcir_uses_vcir_metadata_and_overlays_child_and_object_audits()
|
||||
{
|
||||
let now = time::OffsetDateTime::now_utc();
|
||||
let child_cert_hash = sha256_hex(b"child-cert");
|
||||
let mut vcir = sample_vcir_for_projection(now, &child_cert_hash);
|
||||
@@ -6434,22 +6461,27 @@ authorityKeyIdentifier = keyid:always
|
||||
.expect("reconstruct pack with partial related artifacts");
|
||||
assert_eq!(pack.manifest_bytes, manifest_bytes);
|
||||
assert_eq!(pack.files.len(), 3, "crl + child cert + roa only");
|
||||
assert!(pack
|
||||
.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("issuer.crl")));
|
||||
assert!(pack
|
||||
.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("child.cer")));
|
||||
assert!(pack
|
||||
.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("a.roa")));
|
||||
assert!(!pack
|
||||
.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("issuer.cer")));
|
||||
assert!(
|
||||
pack.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("issuer.crl"))
|
||||
);
|
||||
assert!(
|
||||
pack.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("child.cer"))
|
||||
);
|
||||
assert!(
|
||||
pack.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("a.roa"))
|
||||
);
|
||||
assert!(
|
||||
!pack
|
||||
.files
|
||||
.iter()
|
||||
.any(|file| file.rsync_uri.ends_with("issuer.cer"))
|
||||
);
|
||||
assert!(warnings.iter().any(|warning| {
|
||||
warning
|
||||
.message
|
||||
|
||||
Reference in New Issue
Block a user