Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/browser/relay.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ listen = "127.0.0.1:4460"

[auth]
# Allow anonymous access to everything.
public = "**"
public = ""
2 changes: 1 addition & 1 deletion bench/relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ relay_config() {
"${stream_config[@]}" \
'' \
'[auth]' \
'public = "**"' \
'public = ""' \
"${runtime_config[@]}" >"$path"
if [[ $PROFILE == heap ]]; then
# Its /sessions list shows when the relay has dropped every session after the load.
Expand Down
4 changes: 2 additions & 2 deletions dart/moq/test/moq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ void main() {

// Generated records compare by identity, so compare the fields.
void expectEverything(Grant? grant) {
expect(grant?.publish, ['**']);
expect(grant?.subscribe, ['**']);
expect(grant?.publish, ['']);
expect(grant?.subscribe, ['']);
expect(grant?.expires, isNull);
}

Expand Down
4 changes: 2 additions & 2 deletions demo/carla/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ checkout.
just carla venv
just carla service-install

# The units read this. MOQ_URL carries a token allowed to publish `carla/**`
# and subscribe `viewer/carla/**`, where drivers publish; keeping it here keeps
# The units read this. MOQ_URL carries a token allowed to publish `carla`
# and subscribe `viewer/carla`, where drivers publish; keeping it here keeps
# it off the command line. CARLA_IMAGE is the tag the moq-dev/carla build printed, since the worker
# refuses a stock simulator.
cat >~/.config/moq/carla.env <<'EOF'
Expand Down
4 changes: 2 additions & 2 deletions demo/carla/sim/systemd/install-user-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Before starting, write the relay settings to:
MOQ_URL=https://cdn.moq.dev/demo?jwt=<token>
CARLA_IMAGE=localhost/moq-carla:<tag printed by the moq-dev/carla build>

The token is a demo-project JWT scoped to publish carla/** and subscribe
viewer/carla/**. For local development, MOQ_URL=http://localhost:4443 needs
The token is a demo-project JWT scoped to publish carla and subscribe
viewer/carla. For local development, MOQ_URL=http://localhost:4443 needs
no token.

Then run:
Expand Down
4 changes: 2 additions & 2 deletions demo/carla/sim/systemd/install-user-service.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ CARLA_SYSTEMD_USER_DIR="$tmp/units" \
# hosted relay, the locally built image, and the tokenless local relay.
grep -Fxq ' MOQ_URL=https://cdn.moq.dev/demo?jwt=<token>' "$tmp/install.out"
grep -Fxq ' CARLA_IMAGE=localhost/moq-carla:<tag printed by the moq-dev/carla build>' "$tmp/install.out"
grep -Fq 'scoped to publish carla/** and subscribe' "$tmp/install.out"
grep -Fq 'viewer/carla/**. For local development, MOQ_URL=http://localhost:4443 needs' "$tmp/install.out"
grep -Fq 'scoped to publish carla and subscribe' "$tmp/install.out"
grep -Fq 'viewer/carla. For local development, MOQ_URL=http://localhost:4443 needs' "$tmp/install.out"
test "$(stat -c %a "$tmp/units")" = 700
test "$(stat -c %a "$tmp/config")" = 700
test "$(stat -c %a "$tmp/units/carla-sim.service")" = 600
Expand Down
2 changes: 1 addition & 1 deletion demo/pub/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ h264 name url="http://localhost:4443" *args:
serve name *args:
just download "{{ name }}"
cargo build --bin moq
just ffmpeg-ts "media/{{ name }}.mp4" | cargo run --bin moq -- "${@:2}" --listen "[::]:4443" --listen-tls-generate "localhost" --auth-public "**" --broadcast "{{ name }}.hang" import ts
just ffmpeg-ts "media/{{ name }}.mp4" | cargo run --bin moq -- "${@:2}" --listen "[::]:4443" --listen-tls-generate "localhost" --auth-public "" --broadcast "{{ name }}.hang" import ts

# Generate and serve an HLS stream from a video for testing.
[positional-arguments]
Expand Down
6 changes: 3 additions & 3 deletions demo/relay/leaf0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ connect = ["https://localhost:4443/"]

[auth]
# Local development: anonymous access to everything, so no JWT is needed.
public = "**"
public = ""

# To exercise JWT + public-pattern auth instead, drop `public` above, run
# `moq auth serve --key root.jwk --public-subscribe 'anon/**' --public-subscribe 'demo/**' --public-publish 'anon/**' --mtls-publish '**' --mtls-subscribe '**' --mtls-link peer`,
# To exercise JWT + public-prefix auth instead, drop `public` above, run
# `moq auth serve --key root.jwk --public-subscribe 'anon' --public-subscribe 'demo' --public-publish 'anon' --mtls-publish '' --mtls-subscribe '' --mtls-link peer`,
# point the relay at it, and uncomment `listen.tls.root` above:
# url = "http://127.0.0.1:4440/"

Expand Down
6 changes: 3 additions & 3 deletions demo/relay/leaf1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ connect = ["https://localhost:4443/", "https://localhost:4444/"]

[auth]
# Local development: anonymous access to everything, so no JWT is needed.
public = "**"
public = ""

# To exercise JWT + public-pattern auth instead, drop `public` above, run
# `moq auth serve --key root.jwk --public-subscribe 'anon/**' --public-subscribe 'demo/**' --public-publish 'anon/**' --mtls-publish '**' --mtls-subscribe '**' --mtls-link peer`,
# To exercise JWT + public-prefix auth instead, drop `public` above, run
# `moq auth serve --key root.jwk --public-subscribe 'anon' --public-subscribe 'demo' --public-publish 'anon' --mtls-publish '' --mtls-subscribe '' --mtls-link peer`,
# point the relay at it, and uncomment `listen.tls.root` above:
# url = "http://127.0.0.1:4440/"

Expand Down
2 changes: 1 addition & 1 deletion demo/relay/localhost.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ listen = "[::]:4443"
# See root.toml and leaf.toml for auth and clustering examples.
[auth]
# Allow anonymous access to everything.
public = "**"
public = ""

# Publish a single per-node stats broadcast on the cluster origin:
#
Expand Down
8 changes: 4 additions & 4 deletions demo/relay/prod.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ key = "key.pem"
# The auth server asked once per session event. The policy lives there:
#
# moq auth serve --listen 127.0.0.1:4440 --key root.jwk \
# --public-subscribe 'anon/**' --public-subscribe 'demo/**' \
# --public-publish 'anon/**' --public-publish 'demo/viewer/**' \
# --mtls-publish '**' --mtls-subscribe '**' --mtls-link peer
# --public-subscribe 'anon' --public-subscribe 'demo' \
# --public-publish 'anon' --public-publish 'demo/viewer' \
# --mtls-publish '' --mtls-subscribe '' --mtls-link peer
#
# Anonymous MoQ Boy viewers publish their commands under `demo/viewer/`, while only the
# emulator, which signs in with a token, publishes games under `demo/boy/`. Anyone may
# publish under another viewer's id; the emulator trusts nothing in a command beyond a
# button state.
#
# Anonymous CARLA drivers share the same `demo/viewer/**`, under which each one publishes
# Anonymous CARLA drivers share the same `demo/viewer`, under which each one publishes
# its controls: a truck's broadcasts stay under `demo/carla/`, its worker's, which signs in
# with a token.
#
Expand Down
6 changes: 3 additions & 3 deletions demo/relay/root.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ listen = "[::]:4443"

[auth]
# Local development: anonymous access to everything, so no JWT is needed.
public = "**"
public = ""

# To exercise JWT + public-pattern auth instead, drop `public` above, run
# `moq auth serve --key root.jwk --public-subscribe 'anon/**' --public-subscribe 'demo/**' --public-publish 'anon/**' --mtls-publish '**' --mtls-subscribe '**' --mtls-link peer`,
# To exercise JWT + public-prefix auth instead, drop `public` above, run
# `moq auth serve --key root.jwk --public-subscribe 'anon' --public-subscribe 'demo' --public-publish 'anon' --mtls-publish '' --mtls-subscribe '' --mtls-link peer`,
# point the relay at it, and uncomment `listen.tls.root` above:
# url = "http://127.0.0.1:4440/"
9 changes: 5 additions & 4 deletions doc/bin/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,14 @@ both `--connect` and a WAN cluster peer is refused at startup: use port 0, or dr

```bash
moq auth generate --algorithm ES256 --out private.jwk --public public.jwk
moq auth sign --key private.jwk --root rooms/123 --publish 'alice/**' --subscribe '**' > alice.jwt
moq auth sign --key private.jwk --root rooms/123 --publish alice --subscribe '' > alice.jwt
moq auth verify --key public.jwk --in alice.jwt
moq auth serve --listen 127.0.0.1:4440 --key-dir keys/ --public-subscribe 'anon/**'
moq auth serve --listen 127.0.0.1:4440 --key-dir keys/ --public-subscribe anon
```

`--publish` and `--subscribe` take patterns: `alice` is one broadcast,
`alice/**` is a subtree, `**` is everything under `--root`. `moq auth serve`
`--publish` and `--subscribe` take prefixes: `alice` covers `alice` and
everything beneath it, and `''` is everything under `--root`. A wildcard such as
`alice/**` is refused. `moq auth serve`
answers a relay's auth requests with the same keys (see [Auth
server](/bin/relay/auth#auth-server)). It also reads every setting from an
optional TOML file (`moq auth serve auth.toml`), where flags win and
Expand Down
Loading