HostServ: forbidden-vhost patterns + auto-vhost template

FORBID <regex> / FORBIDLIST / FORBIDDEL let operators block impersonating
user requests (e.g. (?i)(admin|staff)); REQUEST refuses a matching host.
Matching reuses the linear-time RegexSet, so untrusted patterns are safe.

TEMPLATE <$account...> sets a network auto-vhost pattern; DEFAULT gives a
user $account.users.example with their sanitised account name. HostServ's
node config (offers/forbidden/template) is consolidated into one HostConfig
threaded through the log replay.
This commit is contained in:
Jean Chevronnet 2026-07-13 22:42:25 +00:00
parent 2c32dcdc63
commit 6a8e02f004
No known key found for this signature in database
9 changed files with 302 additions and 22 deletions

View file

@ -606,6 +606,12 @@ pub trait Store {
fn vhost_offer_add(&mut self, host: &str) -> Result<bool, RegError>;
fn vhost_offer_del(&mut self, index: usize) -> Result<Option<String>, RegError>;
fn vhost_offers(&self) -> Vec<String>;
fn vhost_forbid_add(&mut self, pattern: &str) -> Result<bool, RegError>;
fn vhost_forbid_del(&mut self, index: usize) -> Result<Option<String>, RegError>;
fn vhost_forbidden(&self) -> Vec<String>;
fn vhost_is_forbidden(&self, host: &str) -> bool;
fn set_vhost_template(&mut self, template: Option<String>) -> Result<(), RegError>;
fn vhost_template(&self) -> Option<String>;
fn group_nick(&mut self, nick: &str, account: &str) -> Result<(), RegError>;
fn ungroup_nick(&mut self, nick: &str) -> Result<bool, RegError>;
fn drop_account(&mut self, account: &str) -> Result<bool, RegError>;