[PR #587] [MERGED] Dedicated server: online mode, and refused logins in the log #2655

Closed
opened 2026-11-02 15:57:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/587
Author: @ludovic111
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: feat/server-online-mode


📝 Commits (2)

  • e7003e7 Dedicated server: online mode, and refused logins in the log
  • d85a16d Merge main into feat/server-online-mode

📊 Changes

10 files changed (+713 additions, -64 deletions)

View changed files

📝 crates/horizon-client/src/auth.rs (+95 -0)
📝 crates/horizon-client/src/game/dedicated.rs (+37 -19)
📝 crates/horizon-client/src/game/scoreboard.rs (+1 -0)
📝 crates/horizon-client/src/lan/conn.rs (+178 -9)
📝 crates/horizon-client/src/lan/guest.rs (+3 -0)
📝 crates/horizon-client/src/lan/hub.rs (+6 -1)
📝 crates/horizon-client/src/lan/mod.rs (+28 -0)
📝 crates/horizon-protocol/src/rsa.rs (+279 -1)
📝 docs/server.md (+6 -6)
📝 tools/test_online_mode_parity.py (+80 -28)

📄 Description

Horizon's dedicated server now supports online-mode=true the way vanilla's ServerLoginPacketListenerImpl does. Until now it logged a warning and ran offline.

Login

  • At start the server logs "Generating keypair" and makes a 1024-bit RSA key pair (horizon-protocol/src/rsa.rs: Miller-Rabin primes, e = 65537, the X.509 public key, PKCS#1 v1.5 decryption).
  • Hello carries an empty server id, the public key and a 4-byte challenge.
  • When the client's Key packet arrives, the server decrypts the shared secret and the challenge, checks the challenge, and turns on AES/CFB8.
  • A "User Authenticator #N" thread asks the session service's verify endpoint (found through the discovery document) whether the player joined. The query is username and serverId, plus ip when prevent-proxy-connections is on.
  • The player gets the account's UUID and its signed properties (skin), and the tab list carries them too.

Log lines and messages, the same as vanilla's

  • UUID of player X is …
  • Disconnecting X (/ip:port): reason
  • Username 'X' tried to join with an invalid session
  • Couldn't verify username because servers are unavailable
  • X (/ip:port) lost connection: …, including when the client drops during login.

A login refused by the gate (whitelist, bans, full server) is now logged as well. Before, nothing was logged.

Harness
tools/test_online_mode_parity.py now also runs Horizon's server. The same five logins run against vanilla's server and against Horizon's, both pointed at the mock session service:

  • signed in, then play;
  • a rejected token;
  • a join the service forgot;
  • no account;
  • not whitelisted.

The harness compares what each client sees and the server lines about the player. Result: 35 checks ok.

Docs
docs/server.md's status table now reads:

  • online mode: works;
  • refused logins: logged.

Secure chat on the server is still missing.

Checks
fmt, workspace clippy and workspace tests pass. The five server harnesses pass on the merged server branches (dedicated_server, online_mode, server_files, server_player_combat, server_player_damage).

Account lookups by name for op and whitelist come next in a stacked PR.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/587 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-online-mode` --- ### 📝 Commits (2) - [`e7003e7`](https://github.com/horizon-rust/horizon/commit/e7003e7d4941709cdd3e2e73eedeb26eb52f63f3) Dedicated server: online mode, and refused logins in the log - [`d85a16d`](https://github.com/horizon-rust/horizon/commit/d85a16daf82877e4dee41c7872db77007c5828a8) Merge main into feat/server-online-mode ### 📊 Changes **10 files changed** (+713 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/auth.rs` (+95 -0) 📝 `crates/horizon-client/src/game/dedicated.rs` (+37 -19) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+1 -0) 📝 `crates/horizon-client/src/lan/conn.rs` (+178 -9) 📝 `crates/horizon-client/src/lan/guest.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+6 -1) 📝 `crates/horizon-client/src/lan/mod.rs` (+28 -0) 📝 `crates/horizon-protocol/src/rsa.rs` (+279 -1) 📝 `docs/server.md` (+6 -6) 📝 `tools/test_online_mode_parity.py` (+80 -28) </details> ### 📄 Description Horizon's dedicated server now supports `online-mode=true` the way vanilla's ServerLoginPacketListenerImpl does. Until now it logged a warning and ran offline. **Login** - At start the server logs "Generating keypair" and makes a 1024-bit RSA key pair (`horizon-protocol/src/rsa.rs`: Miller-Rabin primes, e = 65537, the X.509 public key, PKCS#1 v1.5 decryption). - `Hello` carries an empty server id, the public key and a 4-byte challenge. - When the client's `Key` packet arrives, the server decrypts the shared secret and the challenge, checks the challenge, and turns on AES/CFB8. - A "User Authenticator #N" thread asks the session service's `verify` endpoint (found through the discovery document) whether the player joined. The query is `username` and `serverId`, plus `ip` when `prevent-proxy-connections` is on. - The player gets the account's UUID and its signed properties (skin), and the tab list carries them too. **Log lines and messages, the same as vanilla's** - `UUID of player X is …` - `Disconnecting X (/ip:port): reason` - `Username 'X' tried to join with an invalid session` - `Couldn't verify username because servers are unavailable` - `X (/ip:port) lost connection: …`, including when the client drops during login. A login refused by the gate (whitelist, bans, full server) is now logged as well. Before, nothing was logged. **Harness** `tools/test_online_mode_parity.py` now also runs Horizon's server. The same five logins run against vanilla's server and against Horizon's, both pointed at the mock session service: - signed in, then play; - a rejected token; - a join the service forgot; - no account; - not whitelisted. The harness compares what each client sees and the server lines about the player. Result: 35 checks ok. **Docs** docs/server.md's status table now reads: - online mode: works; - refused logins: logged. Secure chat on the server is still missing. **Checks** fmt, workspace clippy and workspace tests pass. The five server harnesses pass on the merged server branches (dedicated_server, online_mode, server_files, server_player_combat, server_player_damage). Account lookups by name for op and whitelist come next in a stacked PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:57:58 +07:00
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#2655
No description provided.