Skip to content

Commit 4cde428

Browse files
committed
feat: add scoped bridge diagnostics and state monitoring
1 parent 990feca commit 4cde428

31 files changed

Lines changed: 1833 additions & 204 deletions

docs/getting-started/first-server.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Have these ready before you start:
44

55
- Whether the server runs **Bedrock or Java**.
66
- The address Admincraft should reach, and the port.
7-
- The bridge's `SECRET_KEY`, or the `rcon.password` if you are connecting straight to a Java server.
7+
- A bridge access key (`ADMIN_SECRET_KEY`, `COMMAND_SECRET_KEY`,
8+
`READ_ONLY_SECRET_KEY`, or legacy `SECRET_KEY`), or the `rcon.password` if you
9+
are connecting straight to a Java server.
810
- For a self-signed endpoint, the server's `.crt` file.
911

1012
If any of that is unfamiliar, [what each connection field means](../guides/connection-fields.md) explains where the values come from.
@@ -17,7 +19,7 @@ On a fresh install Admincraft opens on a welcome screen: choose **Add your first
1719
2. Choose the **Minecraft edition**. It must match the bridge's `SERVER_TYPE`.
1820
3. Choose the **Connection type**. Do this before the fields below, because the address and port labels change to match it.
1921
4. Fill in the address and port. What they refer to depends on the connection type: the bridge for every type except direct RCON, where it is the Minecraft server itself.
20-
5. Enter the **Bridge secret key**, or the RCON password for a direct connection.
22+
5. Enter the **Bridge access key**, or the RCON password for a direct connection.
2123
6. For a self-signed endpoint, load the certificate.
2224
7. Select **Save changes**.
2325

docs/getting-started/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This section is for the person running the Minecraft server or its Admincraft
44
bridge. If that infrastructure already exists and you only need to use the
55
app, start with [Install Admincraft](install.md) instead.
66

7-
Admincraft is built around [itzg's Minecraft containers](https://github.com/itzg/docker-minecraft-bedrock-server), which is where it does the most: a live console, world controls and a restart button, on Bedrock and Java alike. It also speaks plain RCON, so an existing Java server can be managed without changing anything about how it runs.
7+
Admincraft is built around [itzg's Minecraft containers](https://github.com/itzg/docker-minecraft-bedrock-server), which is where it does the most: a live console, world controls and start, stop, and restart buttons, on Bedrock and Java alike. It also speaks plain RCON, so an existing Java server can be managed without changing anything about how it runs.
88

99
Two arrangements are therefore possible, and the difference matters enough to choose deliberately.
1010

@@ -20,7 +20,7 @@ Two arrangements are therefore possible, and the difference matters enough to ch
2020
| Live server console ||| ❌ RCON cannot stream it |
2121
| Time, weather, game rules ||| ✅ on refresh |
2222
| Player list | ✅ live | ✅ live | ✅ on refresh |
23-
| Restart the server ||| ❌ no container control |
23+
| Start, stop, or restart the server ||| ❌ no container control |
2424
| Works in the browser ||| ❌ no raw sockets |
2525
| Can be encrypted without a VPN | ✅ TLS | ✅ TLS | ❌ never |
2626
| Extra container needed | yes | yes | no |

docs/guides/connection-fields.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Admincraft. A direct RCON profile is intentionally different.
2020
| **Minecraft edition** | Which kind of server the bridge should drive. Bedrock uses the container console; Java uses RCON. | Match your server. |
2121
| **Address** | The machine running the `websocket` container. The label changes with the connection type, and names the Minecraft server instead for direct RCON. | Tailscale address, `ts.net` hostname, or public IP. |
2222
| **Bridge port** | The port the bridge listens on. | `8080` normally, `443` behind Tailscale Funnel. |
23-
| **Bridge secret key** | The bridge's own key, used to sign the token Admincraft sends. | `SECRET_KEY` in the bridge's `docker-compose.yml`. |
23+
| **Bridge access key** | The bridge key used to sign the token Admincraft sends. Its configured scope determines available controls. | `ADMIN_SECRET_KEY`, `COMMAND_SECRET_KEY`, `READ_ONLY_SECRET_KEY`, or legacy `SECRET_KEY` in the bridge environment. |
2424
| **Connection type** | Which setup you have. The address and port fields relabel themselves to match. | See [connection security](connection-security.md), or [direct RCON](#direct-rcon-with-no-bridge). |
2525

2626
## Why Java does not ask for RCON details
@@ -30,7 +30,7 @@ Choosing **Java Edition** changes which backend the *bridge* uses, not where Adm
3030
```yaml
3131
websocket:
3232
environment:
33-
SECRET_KEY: YOUR_SECRET_KEY_HERE # ← this is the "Bridge secret key"
33+
SECRET_KEY: YOUR_SECRET_KEY_HERE # legacy full-access bridge key
3434
RCON_HOST: minecraft
3535
RCON_PORT: "25575"
3636
RCON_PASSWORD: CHANGE_THIS_RCON_PASSWORD
@@ -91,7 +91,7 @@ The setup from the [Bedrock guide](../server/SERVER_SETUP.md#alternative-tailsca
9191
| Minecraft edition | `Bedrock Edition` |
9292
| Address | `my-server.tailnet-name.ts.net` |
9393
| Bridge port | `443` |
94-
| Bridge secret key | the `SECRET_KEY` from your compose file |
94+
| Bridge access key | one of the scoped bridge keys, or legacy `SECRET_KEY` |
9595
| Connection type | `Public address, trusted certificate` |
9696

9797
The address preview under the dropdown should read `wss://my-server.tailnet-name.ts.net:443`.
@@ -103,7 +103,7 @@ The address preview under the dropdown should read `wss://my-server.tailnet-name
103103
| Minecraft edition | `Java Edition` |
104104
| Address | `100.101.102.103` |
105105
| Bridge port | `8080` |
106-
| Bridge secret key | the `SECRET_KEY` from your compose file |
106+
| Bridge access key | one of the scoped bridge keys, or legacy `SECRET_KEY` |
107107
| Connection type | `Private network (Tailscale, VPN or LAN)` |
108108

109109
The preview reads `ws://100.101.102.103:8080`. That is unencrypted by design, and safe only because Tailscale already encrypts the route. It will not work from the hosted web app: see [using the web app](web-app.md#tailscale-in-the-web-app).
@@ -114,7 +114,8 @@ Work down the chain, since each step rules out everything before it:
114114

115115
1. **Is the preview the address you expect?** It is shown live under the security dropdown.
116116
2. **Is the port the bridge's port?** Not `19132` (Bedrock game), not `25575` (Java RCON).
117-
3. **Is the key the bridge's `SECRET_KEY`?** Not the RCON password, not the Minecraft allowlist.
117+
3. **Is the key one configured by the bridge?** Use an admin, command,
118+
read-only, or legacy key—not the RCON password or Minecraft allowlist.
118119
4. **Does the connection type match the address?** `Private network` gives
119120
`ws://` and only works over a private route. For **Public certificate**, use
120121
the exact hostname or IP address covered by the certificate; a hostname is

docs/guides/connection-security.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Connection security
22

3-
The Admincraft WebSocket can execute commands and restart the server. Its traffic must therefore be protected either by the network or by TLS.
3+
The Admincraft WebSocket can execute commands and start, stop, or restart the server container. Its traffic must therefore be protected either by the network or by TLS.
4+
5+
## Choose the least-powerful access key
6+
7+
A current bridge can expose separate keys for different jobs. Put the chosen
8+
key in the profile's **Bridge access key** field.
9+
10+
| Bridge variable | Logs and diagnostics | Minecraft commands | Container lifecycle |
11+
| --- | --- | --- | --- |
12+
| `READ_ONLY_SECRET_KEY` | Yes | No | No |
13+
| `COMMAND_SECRET_KEY` | Yes | Yes | No |
14+
| `ADMIN_SECRET_KEY` | Yes | Yes | Yes |
15+
| `SECRET_KEY` | Yes | Yes | Yes; retained for compatibility |
16+
17+
Use different random values for enabled scopes. For a wall display or status
18+
dashboard, use a read-only key. For daily server administration that must not
19+
restart the host container, use a command key. Reserve the admin key for
20+
trusted devices that need lifecycle controls.
21+
22+
The bridge advertises the capabilities granted to the connected key.
23+
Admincraft then removes unavailable command suggestions and controls. Older
24+
bridges that only define `SECRET_KEY` continue to work with full access.
425

526
## Which mode should I choose?
627

docs/guides/interface.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,46 @@ Commands you send and recent output are stored per server on this device. Open
2828
size, timestamps, output limit, automatic scrolling, text filtering, and the
2929
default filter for common server noise.
3030

31+
With a current Admincraft bridge, reconnecting also replays a bounded recent
32+
tail from the Minecraft container. Timestamped event IDs prevent the overlap
33+
from appearing twice. Connection handshakes and automatic status queries do
34+
not appear as ordinary console lines.
35+
36+
Current bridge connections also complete these diagnostic commands:
37+
38+
- `admincraft help` lists commands available to the current access key.
39+
- `admincraft status`, `admincraft health`, and `admincraft uptime` inspect the
40+
Minecraft container.
41+
- `admincraft info` summarizes the bridge, protocol, permission, server, and
42+
capabilities.
43+
- `admincraft version` reports the installed bridge version.
44+
- `admincraft logs [count]` replays up to 1,000 recent lines on demand.
45+
- `admincraft start-server`, `stop-server`, and `restart-server` manage the
46+
container when the profile uses an admin key.
47+
48+
The completion strip and controls follow the capabilities advertised by the
49+
bridge. A read-only key therefore offers diagnostics and logs without exposing
50+
Minecraft commands; a command key omits lifecycle actions.
51+
3152
## Controls
3253

3354
**Controls** turns common commands into buttons for time, weather, difficulty,
34-
players, game rules, and server restart. **Live commands** contains favorite
55+
players, game rules, and server start, stop, and restart. **Live commands** contains favorite
3556
commands saved from the console. The server-response panel at the bottom can be
3657
collapsed when you need more room.
3758

3859
Some values can be observed from server output; others are refreshed with quiet
3960
commands or show the last value set from Admincraft. Direct RCON has fewer live
4061
events because it cannot stream the server log.
4162

63+
Current bridges publish structured container state, world time, and player
64+
counts. Admincraft uses these for the overview and diagnostics without adding
65+
`time`, `list`, or connection messages to the visible server transcript.
66+
67+
The Minecraft `stop` command shuts down the game process. The controls under
68+
**Server** instead ask the bridge to start, stop, or restart the Docker
69+
container, so it can be started again without shell access.
70+
4271
## Settings
4372

4473
**Settings** is divided by purpose:
@@ -54,6 +83,19 @@ Device preferences are intentionally not synchronized with server profiles.
5483
This lets each phone, browser, or desktop keep suitable fonts, layout, and
5584
console behavior.
5685

86+
## Diagnostics and command audit
87+
88+
Open **Overview → Diagnostics** to inspect the connection state, bridge and
89+
protocol versions, access-key permission, server state, last heartbeat, last
90+
log and state event, advertised capabilities, and the most recent connection
91+
error. **Copy** produces a secret-free summary suitable for an issue report.
92+
93+
The same panel keeps a per-server audit of user-issued commands, their source,
94+
and whether they were sent or rejected. This is intentionally separate from
95+
the Minecraft console transcript: background status observations are not audit
96+
entries, and clearing console output does not turn normal server logs into
97+
user actions.
98+
5799
## Notifications
58100

59101
Short notifications appear near the top without blocking controls underneath.

docs/server/SERVER_SETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ sudo netfilter-persistent save
7373
7474
3. Edit the [docker-compose.yml](docker-compose.yml) file:
7575

76-
- Change the `services.websocket.environment.SECRET_KEY` variable for a strong password you will use to control the server with Admincraft. Generate one with `openssl rand -hex 32` and keep it out of any public repository: anyone holding it can run commands on your server.
76+
- Change the `services.websocket.environment.SECRET_KEY` variable for a strong full-access key you will use to control the server with Admincraft. Generate one with `openssl rand -hex 32` and keep it out of any public repository: anyone holding it can run commands and manage the container. Current bridges can instead use `ADMIN_SECRET_KEY`, `COMMAND_SECRET_KEY`, and `READ_ONLY_SECRET_KEY` to issue least-privilege keys; see [Connection security](../guides/connection-security.md#choose-the-least-powerful-access-key).
7777
- Change any other variables you like in `services.minecraft`, like the `LEVEL_NAME` or `LEVEL_SEED`, you can see a full list [here](https://github.com/itzg/docker-minecraft-bedrock-server?tab=readme-ov-file#server-properties).
7878

7979
4. Make sure to edit the [backups-config/config.yml](backups-config/config.yml) file, the `worlds` setting should match the one you have introduced in the setting `LEVEL_NAME` in the [docker-compose.yml](docker-compose.yml). You can also change the backups frequency as you like.

docs/troubleshooting.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Check that **IP / Hostname** and **Secret Key** are filled in, then save the pro
77
## The connection never reaches Connected
88

99
1. Confirm the server address and WebSocket port.
10-
2. Confirm the `SECRET_KEY` exactly matches the WebSocket configuration.
10+
2. Confirm the profile's access key exactly matches one of `ADMIN_SECRET_KEY`,
11+
`COMMAND_SECRET_KEY`, `READ_ONLY_SECRET_KEY`, or legacy `SECRET_KEY` in the
12+
WebSocket configuration.
1113
3. Check that the WebSocket container is running:
1214

1315
```bash

0 commit comments

Comments
 (0)