Skip to content

Add optional setup tour and Sector Alpha agent with guided binding - #40

Merged
cosmosquark merged 23 commits into
masterfrom
codex/sector-alpha-agent
Nov 6, 2026
Merged

cosmosquark merged 23 commits into
masterfrom
codex/sector-alpha-agent

Conversation

@cosmosquark

@cosmosquark cosmosquark commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an optional Sector Alpha agent inside AlphaGSM, plus a skippable first-run tour. The agent ships with the normal alphagsm program. Official agent traffic uses https://alphagsm-api.sector-alpha.net for enrollment, binding, ownership challenges, posted stats, the session socket, job polling, authorization, and results. Sign-in, accounts, and the public directory stay on https://sector-alpha.net. Another provider is selected only with --origin, and that saved origin is then used for every agent operation.

alphagsm agent enroll redeems a ten-minute enrollment code, registers managed servers that already have a public address, turns reporting on, and leaves management off. alphagsm agent run runs the agent in the foreground until you stop it or close the terminal. It opens one outbound WebSocket for presence and job wakes. If that socket cannot open, it uses the existing HTTPS job poll. Authorize and result posts stay on HTTPS. The client requires TLS 1.2 or newer and verified hostnames. No inbound management listener is opened.

Reporting, management, publication, and each status, start, stop, and restart action stay separate consents. Game setup, agent setup, agent bind, and the first-run tour leave reporting and management off and do not install a service.

Keeping the agent running

alphagsm agent run is enough for a foreground session. On Linux, persistence is a separate command:

  • alphagsm agent install-service writes alphagsm.service for the current user (~/.config/systemd/user/ or $XDG_CONFIG_HOME/systemd/user/), enables it, and starts it. It returns at login. It stops at logout unless linger is already enabled. The installer prints that hint and does not run loginctl enable-linger.
  • alphagsm agent install-service --system writes /etc/systemd/system/alphagsm.service, enables it for boot, and starts it as one operator account. The account is --service-user, otherwise SUDO_USER, otherwise USER. Root is rejected. The unit sets User, Group, HOME, and USER. Writing that directory needs root. The command does not call sudo.
  • Both units run the invoked program as alphagsm agent run. ALPHAGSM_CONFIG_LOCATION is copied into the unit when it is set. The unit file contains no secrets.
  • Only one scope can be installed. A second alphagsm agent run stops while the service holds the local lock. Running install-service again restarts the unit so a new enrollment is loaded.
  • alphagsm agent uninstall-service disables and removes the selected unit and leaves the local enrollment in place. Add --system to remove the system unit.
  • Windows and macOS refuse the installer and say to keep alphagsm agent run in the foreground. Ordinary commands do not import the Linux grp or pwd modules. Windows enrollment still fails closed until user-only credential ACLs exist. Local game commands are unaffected.

Binding, ports, and the first-run tour

Operators can use agent bind TAG, agent bind '*', or agent setup. Guided previews infer the game, advertised IP or hostname, player port, query port, name, and capacity, then register private bindings. Each game can use a distinct subdomain on the same machine. Fresh A/AAAA answers must match the machine's expected public addresses before hostname publication. --public-ip supports NAT and multiple addresses. check-endpoint TAG is the local query diagnostic.

Trackmania XML-RPC, Enshrouded query-only settings, and Arma headless roles do not infer a player listener. An explicit --connect-port asks the operator to confirm the actual game listener and NAT mapping.

Player ports are approved separately from query ports. The local primary port supplies the optional report connect_port. queryport remains the query endpoint. --connect-port overrides the public player port. Minecraft's shared player and query port follows a confirmed query override unless a distinct player mapping was explicitly approved.

A skippable first-run tour appears only on a bare launch with a terminal. Enter remembers a skip. --welcome replays it and --skip-welcome supports installation scripts. It offers local server creation, a command walkthrough, and optional Sector Alpha enrollment. Creation, setup, and opening the remote wizard each need a separate confirmation. It does not start a game, enable reporting or management, or install a service. Existing records, wildcard or count selectors, and reserved names, including agent and steam-auth, are rejected before dispatch.

Security

  • Verified TLS 1.2 or newer, no credentialed redirects, no proxies, and no inbound management listener.
  • Bounded DNS and native parsers, and a ten-second report deadline.
  • Strict optional connect_port accepts only an integer from 1 to 65535, or null. Unknown fields are rejected.
  • Credentials and the journal live outside game datastores, with mode 0700 directories and 0600 files.
  • Public player-stat queries are Minecraft Java vanilla, Minecraft Paper, and Team Fortress 2. TeamSpeak directory listing is a website choice after the name check. Other games keep private reporting, permitted remote actions, and approved player endpoints.
  • Remote control accepts status, start, stop, and restart only.

Docs

Checks on this update

The previous GitHub Actions run failed lint (pylint exit 28: an import cycle and unidiomatic type checks) and the Windows binary (No module named 'grp'). This commit loads grp and pwd only when looking up a system-service account, and moves the TeamSpeak directory message into agent.config so that cycle is gone. Locally, bash ./lint.sh scored 10.00/10 with exit 0, and the agent unit tests passed (257), including a check that importing the service module does not load grp or pwd. The Actions run on this commit is the remaining confirmation.

@cosmosquark cosmosquark changed the title Add opt-in Sector Alpha agent and bounded public queries Add optional Sector Alpha agent with guided binding and hostname validation Oct 15, 2026
@cosmosquark cosmosquark changed the title Add optional Sector Alpha agent with guided binding and hostname validation Add Sector Alpha agent with guided binding and dedicated game-server API Oct 15, 2026
@cosmosquark cosmosquark changed the title Add Sector Alpha agent with guided binding and dedicated game-server API Add Sector Alpha agent with guided binding, player endpoints and dedicated API Oct 15, 2026
@cosmosquark cosmosquark changed the title Add Sector Alpha agent with guided binding, player endpoints and dedicated API Add optional setup tour and Sector Alpha agent with guided binding Oct 16, 2026
@cosmosquark
cosmosquark force-pushed the codex/sector-alpha-agent branch from 02e78ef to 175dbaa Compare October 17, 2026 22:13
An empty db_host starts a private MariaDB 11.5 container and points
LD_LIBRARY_PATH at TeamSpeak's bundled client library. Official agent
stats and remote execution use alphagsm-api.sector-alpha.net.
alphagsm agent query reads the same anonymous status protocols as the website and does not upload the result. alphagsm agent prove places a website challenge in the live TeamSpeak name and restores it. Agent publication stays Minecraft Java, Minecraft Paper, and Team Fortress 2. TeamSpeak directory listing remains a website choice.
Heartbeats run about every 30 seconds. If the socket cannot open, the agent uses the existing HTTPS job poll. Authorize and result posts stay on HTTPS.
The default count query still omits clientlist. A refused channel or client list keeps the server total and marks the roster unavailable.
Comment thread src/agent/socket_channel.py Fixed
alphagsm agent enroll binds managed servers that already have a public address, turns reporting on, and starts ownership challenges. Every agent operation uses https://alphagsm-api.sector-alpha.net unless the saved origin is set. Management stays off. Sector Alpha still verifies a challenge by querying the server.
…agent

# Conflicts:
#	DEVELOPERS.md
#	README.md
#	changelog.txt
#	src/core/main.py
alphagsm agent install-service writes a systemd user unit that runs the same program with agent run, then starts it. The unit does not change reporting or management, and uninstall leaves the local enrollment in place. Outbound agent HTTPS and the WebSocket now require TLS 1.2.
The service runs alphagsm agent run. There is no separate alphagsm-agent program. install-service --system writes a system unit for one operator account and does not run it as root.
…dules.

alphagsm agent run stays in the foreground. install-service enables and starts the user or system unit. Ordinary imports load grp and pwd only for a system account, and the TeamSpeak directory message lives in config so the import cycle is gone.
The site now names the x86_64 tar.gz in the link title and puts the release number in a version label. Setup was stopping before the smoke test could start the server.
@cosmosquark
cosmosquark merged commit d54eacb into master Nov 6, 2026
223 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants