[GH-ISSUE #5389] RCON: serve vanilla's remote console (enable-rcon, rcon.port, rcon.password) #1660

Closed
opened 2026-11-02 15:48:44 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Akirabane on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5389

Originally assigned to: @Akirabane on GitHub.

🤖 Filed by both Akirabane's AI agent (Claude Code) and Akirabane himself, after his review.

enable-rcon, rcon.port and rcon.password are read from server.properties (horizon-server-files) and the docs say the control API can't turn RCON on, but nothing listens: a vanilla server with enable-rcon=true takes remote console connections, Horizon doesn't. The port map lists RconThread, RconClient and RconConsoleSource as "Horizon has no RCON or GS4 query port" (tools/port_map/rest-020.tsv). Hosting panels, Discord bridges and admin scripts use RCON, so this is what stops them working against a Horizon server.

No pull request, issue or branch for it that I could find on origin/main c27101174 (searched rcon in open and closed pull requests and issues).

Plan

One pull request, crates/horizon-server/src/rcon.rs, started by the supervisor next to the management server (management::start), so it answers while the game restarts:

  • Settings as vanilla's RconThread.create reads them: it listens on server-ip (or 0.0.0.0) and rcon.port. An invalid port (not 1 to 65535) or an empty rcon.password leaves RCON off with vanilla's warning (Invalid rcon port {} found in server.properties, rcon disabled!, No rcon password set in server.properties, rcon disabled!). A port that can't be bound is a warning, not a failed start (Unable to initialise RCON on {}:{}).
  • The protocol as RconClient speaks it: little-endian packets (length, request id, type, payload, two NULs). Type 3 logs in (the id echoed back with type 2 when the password matches, -1 when it doesn't, and the connection stays open); type 2 runs a command once logged in (not logged in: the -1 answer); any other type answers Unknown request <hex>. The output goes back in packets of at most 4096 characters, one empty packet when there is none. A failed command answers Error executing: <command> (<reason>).
  • Commands run as the console does, through the same console <line> request to the game that horizon-server cmd and POST /api/v1/command use. No engine change.
  • Where it deliberately differs (each one named in the code and in docs/server.md): the packets are read as a stream (vanilla takes one read as one packet, so a command split by TCP closes the connection) and a request is at most 1460 bytes as in vanilla; the password is compared in constant time; a connection that hasn't logged in within 30 seconds is closed and there are at most 16 connections at once (vanilla has neither limit).
  • Known gap, for a second pull request: the sender shows as Server rather than Rcon, and broadcast-rcon-to-ops isn't honoured (the feedback of a command from cmd doesn't go to operators today either).

RCON stays off by default and the password travels in clear text; the docs say so and advise to keep the port closed to the internet or tunnelled.

How it is checked

Unit tests for the framing, the login, the split output and the errors, and a test running the real listener against a stand-in for the game's control endpoint. As a player: with a test server, say sent by a small RCON client shows in the game chat, and a wrong password gets the -1 answer. A comparison with the vanilla server.jar on the same packets can follow as its own pull request if the team wants it. No bots and no benchmark.

I'm claiming it next, and will say here if the design needs to change.

Originally created by @Akirabane on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5389 Originally assigned to: @Akirabane on GitHub. > 🤖 Filed by both Akirabane's AI agent (Claude Code) and Akirabane himself, after his review. `enable-rcon`, `rcon.port` and `rcon.password` are read from `server.properties` (`horizon-server-files`) and the docs say the control API can't turn RCON on, but nothing listens: a vanilla server with `enable-rcon=true` takes remote console connections, Horizon doesn't. The port map lists `RconThread`, `RconClient` and `RconConsoleSource` as "Horizon has no RCON or GS4 query port" (`tools/port_map/rest-020.tsv`). Hosting panels, Discord bridges and admin scripts use RCON, so this is what stops them working against a Horizon server. No pull request, issue or branch for it that I could find on `origin/main` c27101174 (searched `rcon` in open and closed pull requests and issues). ## Plan One pull request, `crates/horizon-server/src/rcon.rs`, started by the supervisor next to the management server (`management::start`), so it answers while the game restarts: - **Settings as vanilla's `RconThread.create` reads them**: it listens on `server-ip` (or `0.0.0.0`) and `rcon.port`. An invalid port (not 1 to 65535) or an empty `rcon.password` leaves RCON off with vanilla's warning (`Invalid rcon port {} found in server.properties, rcon disabled!`, `No rcon password set in server.properties, rcon disabled!`). A port that can't be bound is a warning, not a failed start (`Unable to initialise RCON on {}:{}`). - **The protocol as `RconClient` speaks it**: little-endian packets (length, request id, type, payload, two NULs). Type 3 logs in (the id echoed back with type 2 when the password matches, `-1` when it doesn't, and the connection stays open); type 2 runs a command once logged in (not logged in: the `-1` answer); any other type answers `Unknown request <hex>`. The output goes back in packets of at most 4096 characters, one empty packet when there is none. A failed command answers `Error executing: <command> (<reason>)`. - **Commands run as the console does**, through the same `console <line>` request to the game that `horizon-server cmd` and `POST /api/v1/command` use. No engine change. - **Where it deliberately differs** (each one named in the code and in `docs/server.md`): the packets are read as a stream (vanilla takes one `read` as one packet, so a command split by TCP closes the connection) and a request is at most 1460 bytes as in vanilla; the password is compared in constant time; a connection that hasn't logged in within 30 seconds is closed and there are at most 16 connections at once (vanilla has neither limit). - **Known gap, for a second pull request**: the sender shows as `Server` rather than `Rcon`, and `broadcast-rcon-to-ops` isn't honoured (the feedback of a command from `cmd` doesn't go to operators today either). RCON stays off by default and the password travels in clear text; the docs say so and advise to keep the port closed to the internet or tunnelled. ## How it is checked Unit tests for the framing, the login, the split output and the errors, and a test running the real listener against a stand-in for the game's control endpoint. As a player: with a test server, `say` sent by a small RCON client shows in the game chat, and a wrong password gets the `-1` answer. A comparison with the vanilla `server.jar` on the same packets can follow as its own pull request if the team wants it. No bots and no benchmark. I'm claiming it next, and will say here if the design needs to change.
Author
Owner

@Akirabane commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6547559669 --> @Akirabane commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1660
No description provided.