Skip to main content

rusthound_ce/modules/adcs/
mod.rs

1//! ADCS active modules, ESC8 web enrollment probe.
2//!
3//! Exposes `probe_enterpriseca_esc8`, called from `run_modules` after LDAP
4//! collection, once per EnterpriseCA, in parallel via rayon.
5
6pub mod esc8;
7
8use crate::modules::adcs::esc8::{check_esc8, Esc8Result};
9use crate::objects::enterpriseca::WebEnrollmentEndpoint;
10
11// Public result type
12
13/// ESC8 probe data ready to inject into EnterpriseCA.
14pub struct Esc8Data {
15    pub http_enrollment_endpoints: Vec<WebEnrollmentEndpoint>,
16}
17
18impl Default for Esc8Data {
19    fn default() -> Self {
20        Self { http_enrollment_endpoints: vec![] }
21    }
22}
23
24impl From<Esc8Result> for Esc8Data {
25    fn from(r: Esc8Result) -> Self {
26        Self { http_enrollment_endpoints: r.endpoints }
27    }
28}
29
30// Public API
31
32/// Probe web enrollment endpoints for a single Enterprise CA.
33/// Returns default (empty) if `dns_host` is empty or unreachable.
34/// DCOnly guard is handled by the caller (`run_modules`).
35pub fn probe_enterpriseca_esc8(dns_host: &str) -> Esc8Data {
36    if dns_host.is_empty() {
37        return Esc8Data::default();
38    }
39    match check_esc8(dns_host) {
40        Some(result) => Esc8Data::from(result),
41        None         => Esc8Data::default(),
42    }
43}