add conf item for federation loopback prevention bypass

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-17 03:39:09 +00:00
parent 152ae705a0
commit 4d0fc41222
2 changed files with 5 additions and 1 deletions

View File

@ -144,6 +144,8 @@ pub struct Config {
#[serde(default = "true_fn")]
pub allow_federation: bool,
#[serde(default)]
pub federation_loopback: bool,
#[serde(default)]
pub allow_public_room_directory_over_federation: bool,
#[serde(default)]
pub allow_public_room_directory_without_auth: bool,
@ -563,6 +565,7 @@ impl fmt::Display for Config {
line("New user display name suffix", &self.new_user_displayname_suffix);
line("Allow encryption", &self.allow_encryption.to_string());
line("Allow federation", &self.allow_federation.to_string());
line("Federation loopback", &self.federation_loopback.to_string());
line(
"Allow incoming federated presence requests (updates)",
&self.allow_incoming_presence.to_string(),

View File

@ -312,7 +312,8 @@ impl super::Service {
}
fn validate_dest(&self, dest: &ServerName) -> Result<()> {
if dest == self.services.server.config.server_name {
let config = &self.services.server.config;
if dest == config.server_name && !config.federation_loopback {
return Err!("Won't send federation request to ourselves");
}