20260914 完善OSS日志与daemon部署
Some checks failed
ci / rust (push) Has been cancelled
ci / docker (push) Has been cancelled
ci / audit (push) Has been cancelled

This commit is contained in:
2026-09-14 10:23:41 +08:00
parent 591bed90a8
commit 6383e2c12c
34 changed files with 1754 additions and 81 deletions

View File

@@ -207,6 +207,19 @@ pub enum ManifestFreshError {
IssuerCaLoadFailed { detail: String },
}
impl ManifestFreshError {
pub(crate) fn warning_category(&self) -> crate::output::report::WarningCategory {
use crate::output::report::WarningCategory;
match self {
Self::Storage(_) | Self::RepoSyncFailed { .. } => WarningCategory::Unclassified,
Self::IssuerCaLoadFailed { .. } | Self::EeCertPath(_) | Self::EeResources(_) => WarningCategory::Certificate,
Self::ManifestOutsidePublicationPoint { .. } | Self::ManifestNumberNotIncreasing { .. }
| Self::ThisUpdateNotIncreasing { .. } | Self::HashMismatch { .. } => WarningCategory::SecurityPolicy,
_ => WarningCategory::ManifestCrl,
}
}
}
#[derive(Debug, thiserror::Error)]
pub enum ManifestProcessError {
#[error("manifest processing failed: {0}")]

View File

@@ -145,6 +145,7 @@ pub(crate) fn prepare_publication_point_for_parallel_roa_and_ta_constraints<
stats.publication_point_dropped = true;
warnings.push(
Warning::new("dropping publication point: no CRL files in validated publication point")
.with_category(WarningCategory::ManifestCrl)
.with_rfc_refs(&[RfcRef("RFC 6487 §4.8.6"), RfcRef("RFC 9286 §7")])
.with_context(manifest_uri),
);
@@ -246,6 +247,7 @@ pub(crate) fn reduce_parallel_roa_stage(
refs.extend_from_slice(extra_rfc_refs_for_crl_selection(&error));
warnings.push(
Warning::new(format!("dropping invalid ROA: {}: {error}", file.rsync_uri))
.with_category(WarningCategory::ObjectValidation)
.with_rfc_refs(&refs)
.with_context(&file.rsync_uri),
);
@@ -296,6 +298,7 @@ pub(crate) fn reduce_parallel_roa_stage(
"dropping invalid ASPA: {}: {error}",
file.rsync_uri
))
.with_category(WarningCategory::ObjectValidation)
.with_context(&file.rsync_uri),
);
}

View File

@@ -142,6 +142,7 @@ pub fn process_publication_point_for_issuer_with_ta_constraints<P: PublicationPo
stats.publication_point_dropped = true;
warnings.push(
Warning::new("dropping publication point: no CRL files in validated publication point")
.with_category(WarningCategory::ManifestCrl)
.with_rfc_refs(&[RfcRef("RFC 6487 §4.8.6"), RfcRef("RFC 9286 §7")])
.with_context(manifest_uri),
);

View File

@@ -271,7 +271,9 @@ fn discover_multiple_roots_from_tal_inputs(
strict_name: bool,
) -> Result<Vec<TalRootDiscovery>, RunTreeFromTalError> {
let mut roots = Vec::with_capacity(tal_inputs.len());
crate::logging::observer::phase("trust_anchor_discovery");
for tal_input in tal_inputs {
crate::logging::emit(crate::logging::Level::Info, "trust_anchor_started", || serde_json::json!({"tal_id": tal_input.tal_id}));
let discovery = match root_discovery_from_tal_input(
tal_input,
http_fetcher,
@@ -292,7 +294,10 @@ fn discover_multiple_roots_from_tal_inputs(
);
continue;
}
Err(error) => return Err(error.into()),
Err(error) => {
crate::logging::emit(crate::logging::Level::Error, "trust_anchor_failed", || serde_json::json!({"tal_id": tal_input.tal_id, "error": error.to_string()}));
return Err(error.into());
}
};
let root_handle = root_handle_from_trust_anchor(
&discovery.trust_anchor,
@@ -305,6 +310,7 @@ fn discover_multiple_roots_from_tal_inputs(
discovery,
root_handle,
});
crate::logging::emit(crate::logging::Level::Info, "trust_anchor_completed", || serde_json::json!({"tal_id": tal_input.tal_id}));
}
if roots.is_empty() {
return Err(RunTreeFromTalError::Setup(
@@ -312,6 +318,7 @@ fn discover_multiple_roots_from_tal_inputs(
.to_string(),
));
}
crate::logging::observer::phase("online_validation");
Ok(roots)
}

View File

@@ -308,6 +308,12 @@ pub fn run_tree_serial_audit_multi_root(
};
instances_processed += 1;
crate::logging::observer::update(instances_processed as u64, || {
serde_json::json!({
"publication_points_completed": instances_processed,
"publication_points_failed": instances_failed,
})
});
warnings.extend(res.warnings);
warnings.extend(res.objects.warnings);
vrps.extend(res.objects.vrps);

View File

@@ -164,6 +164,17 @@ pub fn run_tree_parallel_phase2_audit_multi_root(
config,
);
crate::logging::observer::update(finished.len() as u64, || serde_json::json!({
"publication_points_completed": finished.len(),
"publication_points_started": instances_started,
"ca_queue": ca_queue.len(), "ready_queue": ready_queue.len(),
"waiting_repository_identities": ca_waiting_repo_by_identity.len(),
"publication_points_inflight": inflight_publication_points.len(),
"pending_object_dispatch": pending_roa_dispatch.len(),
"pending_finalization": pending_finalization.len(),
"finalization_inflight": finalize_inflight,
"staging_inflight": staging_inflight,
}));
let repo_poll_timeout = event_poll_timeout(
&ca_queue,
&ready_queue,

View File

@@ -127,7 +127,7 @@ fn build_publication_point_audit_from_failed_fetch(
.map(AuditWarning::from)
.collect::<Vec<_>>();
warnings.push(AuditWarning::from(
&Warning::new(fresh_error.to_string()).with_context(&ca.manifest_rsync_uri),
&Warning::new(fresh_error.to_string()).with_category(fresh_error.warning_category()).with_context(&ca.manifest_rsync_uri),
));
PublicationPointAudit {
node_id: None,

View File

@@ -160,6 +160,7 @@ impl<'a> Rpkiv1PublicationPointRunner<'a> {
Vec::new(),
vec![
Warning::new(format!("child CA discovery failed: {e}"))
.with_category(crate::output::report::WarningCategory::Certificate)
.with_rfc_refs(&[RfcRef("RFC 6487 §7.2")])
.with_context(&ca.manifest_rsync_uri),
],

View File

@@ -103,6 +103,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
"publication point processing failed: {}",
stage_error.error
))
.with_category(stage_error.error.warning_category())
.with_rfc_refs(&[RfcRef("RFC 9286 §6.6")])
.with_context(&ca.manifest_rsync_uri),
);