New-install privacy defaults, and expired bans purged daily
Personal-data catalog spec, defaults D2, D3, D4, D6 and D7 (settled 2026-09-28, new installs only): - D2: automatic IP bans expire after 30 days instead of never; D3: spam training samples, whole messages, are kept 90 days instead of 180; D4: Pyzor, which sends a digest of each message's text to a public server, is off; D6: delivery history is kept 14 days instead of 30. Written on the first boot of a new install only -- one with no roles yet, the same test the built-in roles use -- by reading each singleton, setting these fields and writing it back whole. A server with roles keeps its settings, saved or default. - D7: a webhook created from now on starts with the include policy and no events, so it sends nothing until events are chosen (Rust default and schema default, marked). The registry stores every field, so existing webhooks keep their policy. - Expired bans are also removed by the daily data clean-up. They already stopped blocking and were deleted when settings next loaded; a server that seldom reloads kept them. D1 (log retention) and D5 (the hashed-address blocklist off) are held, and the spec says why: x:TracerLog is stored inside x:Bootstrap with a field after it, so adding one changes that object's stored format; and the spam-rules loader D5 touches is being reworked by the v0.16.24 import. The spec also corrects finding 3: expired bans were deleted on settings load; bans were permanent only because no period is set. Tested: unit tests for the new-install values and that everything else in each singleton stays; the system suite, whose security test now purges an expired ban and checks its record is gone; the telemetry test; common's unit tests; fork checks.
This commit is contained in:
@@ -426,6 +426,37 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
impl Server {
|
||||
/// inbuxa: personal-data catalog, D2: removes bans whose period is over.
|
||||
/// They already stop blocking when they expire, and go when settings are
|
||||
/// next loaded; the daily clean-up makes sure a server that seldom
|
||||
/// reloads doesn't keep them.
|
||||
pub async fn purge_expired_blocked_ips(&self) -> trc::Result<()> {
|
||||
let now = now() as i64;
|
||||
let mut expired = Vec::new();
|
||||
for ip in self.registry().list::<BlockedIp>().await? {
|
||||
if ip.object.expires_at.as_ref().is_some_and(|at| at.timestamp() <= now) {
|
||||
let address = ip.object.address.clone();
|
||||
let object = Object {
|
||||
inner: ip.object.into(),
|
||||
revision: ip.revision,
|
||||
};
|
||||
self.registry()
|
||||
.write(RegistryWrite::delete_object(ip.id, &object))
|
||||
.await?;
|
||||
expired.push(trc::Value::from(address.into_inner().0));
|
||||
}
|
||||
}
|
||||
if !expired.is_empty() {
|
||||
trc::event!(
|
||||
Security(trc::SecurityEvent::IpBlockExpired),
|
||||
Details = expired
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockedIps {
|
||||
pub async fn parse(bp: &mut Bootstrap) -> Self {
|
||||
let mut ips = Self::default();
|
||||
|
||||
Reference in New Issue
Block a user