diff --git a/doc/bin/relay/auth.md b/doc/bin/relay/auth.md index c51b5f6f034..5b349af46b9 100644 --- a/doc/bin/relay/auth.md +++ b/doc/bin/relay/auth.md @@ -442,9 +442,9 @@ security boundary: approximate across relay crashes and server restarts, and they gate admission without revoking. `--listen unix:/run/moq-auth.sock` serves a socket. Binding anything but a -loopback address needs `--listen-public`, which needs `--listen-secret FILE`: -every request must then carry the file's secret as its HTTP Basic password, so -only relays can record sessions and fill the session limits. A relay sends it +loopback address needs `--listen-secret FILE`: every request must then carry +the file's secret as its HTTP Basic password, so only relays can record +sessions and fill the session limits. A relay sends it from its URL, `--auth-url https://relay:@auth.example.com/` (percent-encode reserved characters), through the TLS proxy in front of the server. `--listen-secret` also guards a loopback listener. See `moq auth serve --help` for the rest. diff --git a/quest/m2/auth-listen-public.md b/quest/m2/auth-listen-public.md deleted file mode 100644 index c674ba5f7a8..00000000000 --- a/quest/m2/auth-listen-public.md +++ /dev/null @@ -1,22 +0,0 @@ -# [XS] moq auth serve exposes a listener by its secret, not an allow flag - -## Goal - -`moq auth serve` accepts a non-loopback `--listen` address whenever -`--listen-secret` is set, and `--listen-public` is gone. - -## Plan - -Found 2026-11-14 by the [feature review](/quest/m3/release/feature-review.md). -`rs/moq-cli/src/auth.rs` already refuses `--listen-public` without -`--listen-secret` and a non-loopback address without `--listen-public`; its -other use is the mesh guard, which -[moq-dev/moq#8756](https://github.com/moq-dev/moq/pull/8756) removes. After -that the flag carries nothing the address and the secret do not, and AGENTS.md -says not to add `allow-*` opt-out flags. Start once #8756 merges: delete the -flag and its setting, refuse a non-loopback address without a secret, update -`doc/bin/relay/auth.md`, and add a `MIGRATE.md` note, since `release` ships the -flag. - -Public API: removes `moq auth serve --listen-public` and its config key. -Wire: none. diff --git a/rs/moq-cli/src/auth.rs b/rs/moq-cli/src/auth.rs index c2c47eab3e0..23666e8da16 100644 --- a/rs/moq-cli/src/auth.rs +++ b/rs/moq-cli/src/auth.rs @@ -396,13 +396,9 @@ pub struct Serve { #[usage(long, default = "127.0.0.1:4440", setting = "listen")] listen: String, - /// Allow a bind on a non-loopback address. Needs `--listen-secret`. - #[usage(long, setting = "listen_public")] - #[serde(default)] - listen_public: bool, - /// A file holding the secret every request must carry as its HTTP Basic password; - /// relays send it from `--auth-url https://relay:@host/`. + /// relays send it from `--auth-url https://relay:@host/`. A non-loopback + /// `--listen` address needs it. #[usage(long, value_hint = usage_rs::ValueHint::FilePath, setting = "listen_secret")] #[serde(default, skip_serializing_if = "Option::is_none")] listen_secret: Option, @@ -520,8 +516,6 @@ struct SessionLimits { struct ServeSettings { #[usage(cli("--listen"))] listen: Option, - #[usage(cli("--listen-public"))] - listen_public: Option, #[usage(cli("--listen-secret"))] listen_secret: Option, #[usage(cli("--key"))] @@ -694,14 +688,8 @@ impl Serve { Ok(policy) } - /// Where to listen, refusing a non-loopback address without `--listen-public`, and - /// that without `--listen-secret`. + /// Where to listen, refusing a non-loopback address without `--listen-secret`. fn listener(&self) -> anyhow::Result { - if self.listen_public && self.listen_secret.is_none() { - anyhow::bail!( - "--listen-public needs --listen-secret, so only relays can record sessions and fill the session limits" - ); - } if let Some(path) = self.listen.strip_prefix("unix:") { // A unix URL carries no userinfo for a client to send the secret from. if self.listen_secret.is_some() { @@ -715,9 +703,9 @@ impl Serve { .listen .parse() .with_context(|| format!("--listen expects a socket address or unix:, got {}", self.listen))?; - if !addr.ip().is_loopback() && !self.listen_public { + if !addr.ip().is_loopback() && self.listen_secret.is_none() { anyhow::bail!( - "--listen {addr} is not a loopback address; pass --listen-public with --listen-secret to expose it on purpose" + "--listen {addr} is not a loopback address; pass --listen-secret, so only relays can record sessions and fill the session limits" ); } Ok(Listen::Tcp(addr)) @@ -737,8 +725,8 @@ impl Serve { } /// The settings only a restart applies: the listener and its secret. - fn restart_only(&self) -> (&str, bool, Option<&PathBuf>) { - (&self.listen, self.listen_public, self.listen_secret.as_ref()) + fn restart_only(&self) -> (&str, Option<&PathBuf>) { + (&self.listen, self.listen_secret.as_ref()) } /// The secret in [`listen_secret`](Self::listen_secret), without its trailing newline. @@ -1018,14 +1006,9 @@ mod tests { } #[test] - fn serve_refuses_a_public_bind_without_saying_so() { - let err = serve(&["moq", "auth", "serve", "--listen", "0.0.0.0:4440"]) - .listener() - .unwrap_err(); - assert!(err.to_string().contains("--listen-public"), "{err}"); - + fn serve_refuses_a_public_bind_without_a_secret() { // Public, anyone could record sessions under a victim's address. - let err = serve(&["moq", "auth", "serve", "--listen", "0.0.0.0:4440", "--listen-public"]) + let err = serve(&["moq", "auth", "serve", "--listen", "0.0.0.0:4440"]) .listener() .unwrap_err(); assert!(err.to_string().contains("--listen-secret"), "{err}"); @@ -1036,7 +1019,6 @@ mod tests { "serve", "--listen", "0.0.0.0:4440", - "--listen-public", "--listen-secret", "secret.txt" ]) @@ -1165,7 +1147,6 @@ mod tests { format!( r#" listen = "0.0.0.0:4440" -listen_public = true listen_secret = "/etc/moq/auth.secret" tier = "from-file" revalidate = "30s"