pub struct ConfigManager { /* private fields */ }Expand description
Centralized configuration manager that coordinates updates across all runtime managers.
Implementations§
Source§impl ConfigManager
impl ConfigManager
Sourcepub fn new(
config: Arc<RwLock<ConfigFile>>,
sites: Arc<RwLock<Vec<SiteConfig>>>,
vhost: Arc<RwLock<VhostMatcher>>,
waf: Arc<RwLock<SiteWafManager>>,
rate_limiter: Arc<RwLock<RateLimitManager>>,
access_lists: Arc<RwLock<AccessListManager>>,
) -> Self
pub fn new( config: Arc<RwLock<ConfigFile>>, sites: Arc<RwLock<Vec<SiteConfig>>>, vhost: Arc<RwLock<VhostMatcher>>, waf: Arc<RwLock<SiteWafManager>>, rate_limiter: Arc<RwLock<RateLimitManager>>, access_lists: Arc<RwLock<AccessListManager>>, ) -> Self
Creates a new ConfigManager with references to all runtime managers.
Sourcepub fn with_persistence(self, path: impl AsRef<Path>) -> Self
pub fn with_persistence(self, path: impl AsRef<Path>) -> Self
Enables configuration persistence to the specified file path.
Sourcepub fn with_rules(
self,
engine: Arc<RwLock<Synapse>>,
rules_path: Option<PathBuf>,
rules_hash: Option<Arc<RwLock<String>>>,
) -> Self
pub fn with_rules( self, engine: Arc<RwLock<Synapse>>, rules_path: Option<PathBuf>, rules_hash: Option<Arc<RwLock<String>>>, ) -> Self
Enable rule management with a shared Synapse engine and optional persistence.
Sourcepub fn create_site(
&self,
req: CreateSiteRequest,
) -> Result<MutationResult, ConfigManagerError>
pub fn create_site( &self, req: CreateSiteRequest, ) -> Result<MutationResult, ConfigManagerError>
Creates a new site configuration.
Sourcepub fn get_site(
&self,
hostname: &str,
) -> Result<SiteDetailResponse, ConfigManagerError>
pub fn get_site( &self, hostname: &str, ) -> Result<SiteDetailResponse, ConfigManagerError>
Retrieves detailed information about a site.
Sourcepub fn list_sites(&self) -> Vec<String>
pub fn list_sites(&self) -> Vec<String>
Lists all configured site hostnames.
Sourcepub fn get_sites_info(&self) -> Vec<SiteInfo>
pub fn get_sites_info(&self) -> Vec<SiteInfo>
Returns full site info for all sites (for API response).
Sourcepub fn update_site(
&self,
hostname: &str,
req: UpdateSiteRequest,
) -> Result<MutationResult, ConfigManagerError>
pub fn update_site( &self, hostname: &str, req: UpdateSiteRequest, ) -> Result<MutationResult, ConfigManagerError>
Updates an existing site configuration.
Sourcepub fn delete_site(
&self,
hostname: &str,
) -> Result<MutationResult, ConfigManagerError>
pub fn delete_site( &self, hostname: &str, ) -> Result<MutationResult, ConfigManagerError>
Deletes a site configuration.
Sourcepub fn get_full_config(&self) -> ConfigFile
pub fn get_full_config(&self) -> ConfigFile
Retrieves the full runtime configuration.
Sourcepub fn config_hash(&self) -> String
pub fn config_hash(&self) -> String
Computes a stable hash of the current configuration for diagnostics.
Sourcepub fn rules_hash(&self) -> String
pub fn rules_hash(&self) -> String
Returns the current rules hash (or computes one if not cached).
Sourcepub fn update_full_config(
&self,
new_config: ConfigFile,
) -> Result<MutationResult, ConfigManagerError>
pub fn update_full_config( &self, new_config: ConfigFile, ) -> Result<MutationResult, ConfigManagerError>
Updates the full configuration (hot reload).
This replaces the entire configuration state and triggers a rebuild of all dependent components (VHost, WAF, RateLimit, AccessList).
Sourcepub fn update_site_waf(
&self,
hostname: &str,
waf_req: SiteWafRequest,
) -> Result<MutationResult, ConfigManagerError>
pub fn update_site_waf( &self, hostname: &str, waf_req: SiteWafRequest, ) -> Result<MutationResult, ConfigManagerError>
Updates only the WAF configuration for a site.
Sourcepub fn update_site_rate_limit(
&self,
hostname: &str,
rate_limit: RateLimitRequest,
) -> Result<MutationResult, ConfigManagerError>
pub fn update_site_rate_limit( &self, hostname: &str, rate_limit: RateLimitRequest, ) -> Result<MutationResult, ConfigManagerError>
Updates only the rate limit configuration for a site.
Sourcepub fn update_site_access_list(
&self,
hostname: &str,
access_list: AccessListRequest,
) -> Result<MutationResult, ConfigManagerError>
pub fn update_site_access_list( &self, hostname: &str, access_list: AccessListRequest, ) -> Result<MutationResult, ConfigManagerError>
Updates only the access list configuration for a site.
Sourcepub fn list_rules(&self) -> Vec<StoredRule>
pub fn list_rules(&self) -> Vec<StoredRule>
List all rules currently stored on the sensor.
Sourcepub fn create_rule(
&self,
rule: StoredRule,
) -> Result<StoredRule, ConfigManagerError>
pub fn create_rule( &self, rule: StoredRule, ) -> Result<StoredRule, ConfigManagerError>
Create a new rule and apply it to the WAF engine.
Sourcepub fn update_rule(
&self,
rule_id: &str,
update: CustomRuleUpdate,
) -> Result<StoredRule, ConfigManagerError>
pub fn update_rule( &self, rule_id: &str, update: CustomRuleUpdate, ) -> Result<StoredRule, ConfigManagerError>
Update an existing rule and apply changes to the WAF engine.
Sourcepub fn delete_rule(&self, rule_id: &str) -> Result<(), ConfigManagerError>
pub fn delete_rule(&self, rule_id: &str) -> Result<(), ConfigManagerError>
Delete a rule by ID and apply changes to the WAF engine.
Sourcepub fn replace_rules(
&self,
rules: Vec<StoredRule>,
hash_override: Option<String>,
) -> Result<usize, ConfigManagerError>
pub fn replace_rules( &self, rules: Vec<StoredRule>, hash_override: Option<String>, ) -> Result<usize, ConfigManagerError>
Replace all rules with a new set and apply to the WAF engine.
Sourcepub fn update_waf_rules(
&self,
rules_json: &[u8],
hash_override: Option<&str>,
) -> Result<usize, ConfigManagerError>
pub fn update_waf_rules( &self, rules_json: &[u8], hash_override: Option<&str>, ) -> Result<usize, ConfigManagerError>
Updates WAF rules from JSON bytes received from Horizon Hub.
This method is called when the sensor receives a RulesUpdate or PushRules message from the Signal Horizon Hub via WebSocket. The rules are parsed and applied to the WAF engine.
§Arguments
rules_json- JSON bytes containing an array of rule definitionshash_override- Optional hash provided by Signal Horizon
§Returns
Ok(count)- Number of rules received (including disabled rules)Err- If rules parsing or application fails
Auto Trait Implementations§
impl Freeze for ConfigManager
impl !RefUnwindSafe for ConfigManager
impl Send for ConfigManager
impl Sync for ConfigManager
impl Unpin for ConfigManager
impl UnsafeUnpin for ConfigManager
impl !UnwindSafe for ConfigManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more